Documentation
¶
Index ¶
- Constants
- Variables
- func ConditionChanged(a, b metav1.Condition) bool
- func ContainsCommonHTTPRoute(a, b []gatewayv1.HTTPRoute) (bool, error)
- func GatewayClassMatchesControllerName(controllerName string) func(object client.Object) bool
- func GatewayHasMatchingControllerFn(ctx context.Context, c client.Client, controllerName string, ...) func(object client.Object) bool
- func GatewayV1GVK(kind string) schema.GroupVersionKind
- func GetBackendServiceName(k8sclient client.Client, namespace string, ...) (string, error)
- func GetConcreteListObject(schemaType schema.GroupVersionKind) runtime.Object
- func GetConcreteObject(schemaType schema.GroupVersionKind) runtime.Object
- func GetGatewaysForSecret(ctx context.Context, c client.Client, obj client.Object, controllerName string, ...) []*gatewayv1.Gateway
- func GetServiceName(svcImport *mcsapiv1beta1.ServiceImport) (string, error)
- func HasListenerSetSupport(scheme *runtime.Scheme) bool
- func HasServiceImportSupport(scheme *runtime.Scheme) bool
- func HasTCPRouteSupport(scheme *runtime.Scheme) bool
- func HasTLSRouteSupport(scheme *runtime.Scheme) bool
- func HasUDPRouteSupport(scheme *runtime.Scheme) bool
- func IsAccepted(conds []metav1.Condition) bool
- func IsBackendReferenceAllowed(originatingNamespace string, be gatewayv1.BackendRef, ...) bool
- func IsConditionPresent(conds []metav1.Condition, condType string) bool
- func IsConfigMap(certRef gatewayv1.LocalObjectReference) bool
- func IsGammaService(parent gatewayv1.ParentReference) bool
- func IsGammaServiceEqual(parent gatewayv1.ParentReference, gammaService *corev1.Service, ...) bool
- func IsGateway(parent gatewayv1.ParentReference) bool
- func IsHTTPSTerminatedListener(listener *gatewayv1.Listener) bool
- func IsListenerNamespaceAllowed(listener gatewayv1.Listener, routeNamespace, gatewayNamespace string, ...) bool
- func IsListenerSet(parent gatewayv1.ParentReference) bool
- func IsParentAttachable(_ context.Context, reconcileParent metav1.Object, route metav1.Object, ...) bool
- func IsSecret(secret gatewayv1.SecretObjectReference) bool
- func IsSecretReferenceAllowed(originatingNamespace string, sr gatewayv1.SecretObjectReference, ...) bool
- func IsService(be gatewayv1.BackendObjectReference) bool
- func IsServiceImport(be gatewayv1.BackendObjectReference) bool
- func IsServiceTargetRef(tr gatewayv1.LocalPolicyTargetReferenceWithSectionName) bool
- func IsTLSPassthroughListener(listener *gatewayv1.Listener) bool
- func IsValidGammaService(svc *corev1.Service) bool
- func IsValidPemFormat(b []byte) bool
- func ListenerEntryToListener(entry gatewayv1.ListenerEntry) gatewayv1.Listener
- func ListenerHostname(listener *gatewayv1.Listener) string
- func ListenerSetParentGateway(ls *gatewayv1.ListenerSet) *types.NamespacedName
- func MergeConditions(existingConditions []metav1.Condition, updates ...metav1.Condition) []metav1.Condition
- func NamespaceDerefOr(namespace *gatewayv1.Namespace, defaultNamespace string) string
- func ObjectsEqual(a, b client.Object) (bool, error)
- func RegisterGatewayAPITypesToScheme(scheme *runtime.Scheme, optionalKinds []schema.GroupVersionKind) error
- func ResolveListenerSetToGateway(ctx context.Context, c client.Client, lsName string, lsNamespace string) *types.NamespacedName
- func SNIHostnamesIntersect(a, b string) bool
- func TestScheme(optionalKinds []schema.GroupVersionKind) *runtime.Scheme
- type BackendTLSPolicyServiceMap
- type BackendTLSPolicyTargetServiceCollection
- func (b *BackendTLSPolicyTargetServiceCollection) DeleteValidPolicy(sectionName gatewayv1.SectionName)
- func (b *BackendTLSPolicyTargetServiceCollection) UpsertConflictedPolicy(btlspFullName types.NamespacedName, btlsp *gatewayv1.BackendTLSPolicy)
- func (b *BackendTLSPolicyTargetServiceCollection) UpsertInvalidPolicy(sectionName gatewayv1.SectionName, btlsp *gatewayv1.BackendTLSPolicy)
- func (b *BackendTLSPolicyTargetServiceCollection) UpsertValidPolicy(sectionName gatewayv1.SectionName, btlsp *gatewayv1.BackendTLSPolicy)
- type NamespaceLabelIndex
Constants ¶
const ( // GatewaySecretIndex indexes Gateways by referenced TLS Secrets. GatewaySecretIndex = "gatewaySecretIndex" // ListenerSetSecretIndex indexes ListenerSets by referenced TLS Secrets. ListenerSetSecretIndex = "listenerSetSecretIndex" )
const ( GatewayClassKind string = "gatewayclasses" GatewayKind string = "gateways" HTTPRouteKind string = "httproutes" GRPCRouteKind string = "grpcroutes" ReferenceGrantKind string = "referencegrants" BackendTLSPolicyKind string = "backendtlspolicies" TLSRouteKind string = "tlsroutes" TCPRouteKind string = "tcproutes" UDPRouteKind string = "udproutes" ListenerSetKind string = "listenersets" ServiceImportKind string = "serviceimports" )
Variables ¶
var AllOptionalKinds = []schema.GroupVersionKind{ GatewayV1GVK(ListenerSetKind), mcsapiv1beta1.SchemeGroupVersion.WithKind(ServiceImportKind), GatewayV1GVK(TCPRouteKind), GatewayV1GVK(UDPRouteKind), }
Functions ¶
func ConditionChanged ¶ added in v1.20.0
func ContainsCommonHTTPRoute ¶ added in v1.20.0
ContainsCommonHTTPRoute checks to see if the two slices of HTTPRoutes contain at least one identical HTTPRoute. If so, returns true.
Returns an error if the two lists contain a HTTPRoute that is the same object with a different generation; this means there has been a HTTPRoute update between when the two lists were generated, and the whole reconciliation must be restarted.
func GatewayClassMatchesControllerName ¶ added in v1.20.0
GatewayClassMatchesControllerName is a closure that returns a function that satisfies the controller-runtime predicate signature, allowing this to be used in predicate contexts as well as others.
func GatewayHasMatchingControllerFn ¶ added in v1.20.0
func GatewayV1GVK ¶ added in v1.20.0
func GatewayV1GVK(kind string) schema.GroupVersionKind
GatewayV1GVK returns the GroupVersionKind for a given Gateway API v1 kind.
func GetBackendServiceName ¶ added in v1.16.0
func GetConcreteListObject ¶ added in v1.20.0
func GetConcreteListObject(schemaType schema.GroupVersionKind) runtime.Object
getConcreteListObject returns a list instance of a concrete object type based on the given GroupVersionKind.
func GetConcreteObject ¶ added in v1.17.0
func GetConcreteObject(schemaType schema.GroupVersionKind) runtime.Object
getConcreteObject returns an instance of a concrete object type based on the given GroupVersionKind.
func GetGatewaysForSecret ¶ added in v1.20.0
func GetServiceName ¶ added in v1.16.0
func GetServiceName(svcImport *mcsapiv1beta1.ServiceImport) (string, error)
func HasListenerSetSupport ¶ added in v1.20.0
func HasServiceImportSupport ¶ added in v1.16.0
HasServiceImportSupport return if the ServiceImport CRD is supported. This checks if the MCS API group ServiceImport CRD is registered in the client scheme and it is expected that it is registered only if the ServiceImport CRD has been installed prior to the client setup.
func HasTCPRouteSupport ¶ added in v1.20.0
HasTCPRouteSupport returns if the TCPRoute CRD is supported. This checks if the Gateway API v1 TCPRoute CRD is registered in the client scheme.
func HasTLSRouteSupport ¶ added in v1.17.4
HasTLSRouteSupport returns if the TLSRoute CRD is supported. This checks if the Gateway API v1alpha2 TLSRoute CRD is registered in the client scheme and it is expected that it is registered only if the TLSRoute CRD has been installed prior to the client setup.
func HasUDPRouteSupport ¶ added in v1.20.0
HasUDPRouteSupport returns if the UDPRoute CRD is supported. This checks if the Gateway API v1 UDPRoute CRD is registered in the client scheme.
func IsAccepted ¶ added in v1.20.0
func IsBackendReferenceAllowed ¶
func IsBackendReferenceAllowed(originatingNamespace string, be gatewayv1.BackendRef, gvk schema.GroupVersionKind, grants []gatewayv1.ReferenceGrant) bool
IsBackendReferenceAllowed returns true if the backend reference is allowed by the reference grant.
func IsConditionPresent ¶ added in v1.18.3
func IsConfigMap ¶ added in v1.20.0
func IsConfigMap(certRef gatewayv1.LocalObjectReference) bool
func IsGammaService ¶ added in v1.16.0
func IsGammaService(parent gatewayv1.ParentReference) bool
func IsGammaServiceEqual ¶ added in v1.17.8
func IsGateway ¶
func IsGateway(parent gatewayv1.ParentReference) bool
func IsHTTPSTerminatedListener ¶ added in v1.19.6
IsHTTPSTerminatedListener returns true for HTTPS listeners that terminate TLS.
func IsListenerNamespaceAllowed ¶ added in v1.19.6
func IsListenerNamespaceAllowed(listener gatewayv1.Listener, routeNamespace, gatewayNamespace string, namespaces NamespaceLabelIndex) bool
IsListenerNamespaceAllowed checks whether a route in routeNamespace is permitted to attach to the given listener based on AllowedRoutes.Namespaces.
func IsListenerSet ¶ added in v1.20.0
func IsListenerSet(parent gatewayv1.ParentReference) bool
func IsParentAttachable ¶ added in v1.20.0
func IsSecret ¶
func IsSecret(secret gatewayv1.SecretObjectReference) bool
func IsSecretReferenceAllowed ¶
func IsSecretReferenceAllowed(originatingNamespace string, sr gatewayv1.SecretObjectReference, gvk schema.GroupVersionKind, grants []gatewayv1.ReferenceGrant) bool
IsSecretReferenceAllowed returns true if the secret reference is allowed by the reference grant.
func IsService ¶
func IsService(be gatewayv1.BackendObjectReference) bool
func IsServiceImport ¶ added in v1.16.0
func IsServiceImport(be gatewayv1.BackendObjectReference) bool
func IsServiceTargetRef ¶ added in v1.20.0
func IsServiceTargetRef(tr gatewayv1.LocalPolicyTargetReferenceWithSectionName) bool
func IsTLSPassthroughListener ¶ added in v1.19.6
IsTLSPassthroughListener returns true for TLS listeners configured for passthrough mode.
func IsValidGammaService ¶ added in v1.20.0
func IsValidPemFormat ¶ added in v1.20.0
IsValidPemFormat checks if the given byte array contains at least one valid PEM formatted object, either certificate or key. This function is not intended to be used for validating the actual content of the PEM block.
func ListenerEntryToListener ¶ added in v1.20.0
func ListenerEntryToListener(entry gatewayv1.ListenerEntry) gatewayv1.Listener
func ListenerHostname ¶ added in v1.19.6
ListenerHostname returns the listener hostname, or an empty string for catch-all listeners.
func ListenerSetParentGateway ¶ added in v1.20.0
func ListenerSetParentGateway(ls *gatewayv1.ListenerSet) *types.NamespacedName
func MergeConditions ¶ added in v1.20.0
func NamespaceDerefOr ¶
func ObjectsEqual ¶ added in v1.20.0
ObjectsEqual checks to see if two Kubernetes objects are the same object (meaning same Kind, Namespace, Name, and Generation). Returns true if all of those are the same.
Kind, Namespace, and Name being the same means that they are the same object but if the Generation is different, then there has been an update to the object between when the two objects were fetched, so any reconciliation should be retried. In this case, returns true but an error, so that we can catch this and fail the reconciliation.
func RegisterGatewayAPITypesToScheme ¶ added in v1.20.0
func RegisterGatewayAPITypesToScheme(scheme *runtime.Scheme, optionalKinds []schema.GroupVersionKind) error
func ResolveListenerSetToGateway ¶ added in v1.20.0
func SNIHostnamesIntersect ¶ added in v1.19.6
SNIHostnamesIntersect returns true when two hostnames can match the same SNI value. Empty hostnames are normalized to catch-all.
func TestScheme ¶ added in v1.20.0
func TestScheme(optionalKinds []schema.GroupVersionKind) *runtime.Scheme
Types ¶
type BackendTLSPolicyServiceMap ¶ added in v1.20.0
type BackendTLSPolicyServiceMap map[types.NamespacedName]*BackendTLSPolicyTargetServiceCollection
BackendTLSPolicyServiceMap is a lookup map that tracks valid and invalid BackendTLSPolicies by the relevant targetRef service full name.
func BuildBackendTLSPolicyLookup ¶ added in v1.20.0
func BuildBackendTLSPolicyLookup(btlspList *gatewayv1.BackendTLSPolicyList) BackendTLSPolicyServiceMap
BuildBackendTLSPolicyLookup builds a lookup map of BackendTLSPolicy by the NamespacedName of referenced backend Services. These are deduplicated using the Gateway API conflict resolution rules (oldest wins, then first lexicographically wins).
type BackendTLSPolicyTargetServiceCollection ¶ added in v1.20.0
type BackendTLSPolicyTargetServiceCollection struct {
// Valid holds the map of the section name on the Service
// to the relevant BackendTLSPolicy.
//
// Note that the an empty value for SectionName means
// "all sections", and will conflict with any other section name.
Valid map[gatewayv1.SectionName]*gatewayv1.BackendTLSPolicy
// Invalid holds the map of the section name on the Service
// to the BackendTLSPolicy that failed Cilium-specific validation.
Invalid map[gatewayv1.SectionName]*gatewayv1.BackendTLSPolicy
// Conflicted holds the all the conflicted BackendTLSPolicies that
// target this Service, with the map key being the object's full name.
// This avoids traversing a slice to find a match all the time.
Conflicted map[types.NamespacedName]*gatewayv1.BackendTLSPolicy
}
BackendTLSPolicyTargetServiceCollection holds all the BackendTLSPolicy objects that targetRef Service, including which ones are valid and which conflicted.
This is required because BackendTLSPolicy objects can: * target multiple Services * target the same Service, with different ports
And, multiple BackendTLSPolicies can also do the same.
Gateway API conflict resolution rules dictate that, when two BackendTLSPolicies target the same Service, the precedence goes, continuing on ties:
1. Oldest BackendTLSPolicy, by creation time 2. First BackendTLSPolicy, lexigraphically sorted.
The BackendTLSPolicyTargetServiceCollection struct holds details about which are the Valid (chosen) policies, and which are Conflicted. This is then used by the status-setting functions to figure out what status to set.
func (*BackendTLSPolicyTargetServiceCollection) DeleteValidPolicy ¶ added in v1.20.0
func (b *BackendTLSPolicyTargetServiceCollection) DeleteValidPolicy(sectionName gatewayv1.SectionName)
func (*BackendTLSPolicyTargetServiceCollection) UpsertConflictedPolicy ¶ added in v1.20.0
func (b *BackendTLSPolicyTargetServiceCollection) UpsertConflictedPolicy(btlspFullName types.NamespacedName, btlsp *gatewayv1.BackendTLSPolicy)
func (*BackendTLSPolicyTargetServiceCollection) UpsertInvalidPolicy ¶ added in v1.20.0
func (b *BackendTLSPolicyTargetServiceCollection) UpsertInvalidPolicy(sectionName gatewayv1.SectionName, btlsp *gatewayv1.BackendTLSPolicy)
func (*BackendTLSPolicyTargetServiceCollection) UpsertValidPolicy ¶ added in v1.20.0
func (b *BackendTLSPolicyTargetServiceCollection) UpsertValidPolicy(sectionName gatewayv1.SectionName, btlsp *gatewayv1.BackendTLSPolicy)
type NamespaceLabelIndex ¶ added in v1.19.6
NamespaceLabelIndex indexes namespace labels by namespace name.
func NewNamespaceLabelIndex ¶ added in v1.19.6
func NewNamespaceLabelIndex(namespaces []corev1.Namespace) NamespaceLabelIndex
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
testhelpers contains functions and fixtures that are helpful for testing multiple parts of the Gateway API code.
|
testhelpers contains functions and fixtures that are helpful for testing multiple parts of the Gateway API code. |