diff --git a/README.md b/README.md index 8f8df6a609..cf6727e87b 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ one of the guides. A complete API reference, please refer to: - [API reference][spec] -- [Go docs for the package](https://pkg.go.dev/sigs.k8s.io/gateway-api/apis/v1alpha1) +- [Go docs for the package](https://pkg.go.dev/sigs.k8s.io/gateway-api/apis/v1alpha2) ## Contributing diff --git a/apis/v1alpha1/backendpolicy_types.go b/apis/v1alpha1/backendpolicy_types.go deleted file mode 100644 index b3f66c9879..0000000000 --- a/apis/v1alpha1/backendpolicy_types.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api,shortName=bp -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// BackendPolicy defines policies associated with backends. For the purpose of -// this API, a backend is defined as any resource that a route can forward -// traffic to. A common example of a backend is a Service. Configuration that is -// implementation specific may be represented with similar implementation -// specific custom resources. -type BackendPolicy struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of BackendPolicy. - Spec BackendPolicySpec `json:"spec,omitempty"` - - // Status defines the current state of BackendPolicy. - Status BackendPolicyStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// BackendPolicyList contains a list of BackendPolicy. -type BackendPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BackendPolicy `json:"items"` -} - -// BackendPolicySpec defines desired policy for a backend. -type BackendPolicySpec struct { - // BackendRefs define which backends this policy should be applied to. This - // policy can only apply to backends within the same namespace. If more than - // one BackendPolicy targets the same backend, precedence must be given to - // the oldest BackendPolicy. - // - // Support: Core - // - // +kubebuilder:validation:MaxItems=16 - BackendRefs []BackendRef `json:"backendRefs"` - - // TLS is the TLS configuration for these backends. - // - // Support: Extended - // - // +optional - TLS *BackendTLSConfig `json:"tls,omitempty"` -} - -// BackendRef identifies an API object within the same namespace -// as the BackendPolicy. -type BackendRef struct { - // Group is the group of the referent. - // - // +kubebuilder:validation:MaxLength=253 - Group string `json:"group"` - - // Kind is the kind of the referent. - // - // +kubebuilder:validation:MaxLength=253 - Kind string `json:"kind"` - - // Name is the name of the referent. - // - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` - - // Port is the port of the referent. If unspecified, this policy applies to - // all ports on the backend. - // - // +optional - Port *PortNumber `json:"port,omitempty"` -} - -// BackendTLSConfig describes TLS configuration for a backend. -type BackendTLSConfig struct { - // CertificateAuthorityRef is a reference to a Kubernetes object that contains - // one or more trusted CA certificates. The CA certificates are used to establish - // a TLS handshake to backends listed in BackendRefs. The referenced object MUST - // reside in the same namespace as BackendPolicy. - // - // CertificateAuthorityRef can reference a standard Kubernetes resource, i.e. - // ConfigMap, or an implementation-specific custom resource. - // - // When stored in a Secret, certificates must be PEM encoded and specified within - // the "ca.crt" data field of the Secret. When multiple certificates are specified, - // the certificates MUST be concatenated by new lines. - // - // CertificateAuthorityRef can also reference a standard Kubernetes resource, i.e. - // ConfigMap, or an implementation-specific custom resource. - // - // Support: Extended - // - // +optional - CertificateAuthorityRef *LocalObjectReference `json:"certificateAuthorityRef,omitempty"` - - // Options are a list of key/value pairs to give extended options to the - // provider. - // - // Support: Implementation-specific - // - // +optional - Options map[string]string `json:"options,omitempty"` -} - -// BackendPolicyStatus defines the observed state of BackendPolicy. Conditions -// that are related to a specific Route or Gateway must be placed on the -// Route(s) using backends configured by this BackendPolicy. -type BackendPolicyStatus struct { - // Conditions describe the current conditions of the BackendPolicy. - // - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// BackendPolicyConditionType is a type of condition used to express the current -// state of a BackendPolicy resource. -type BackendPolicyConditionType string - -const ( - // Indicates that one or more of the the specified backend references could not be resolved. - ConditionNoSuchBackend BackendPolicyConditionType = "NoSuchBackend" -) diff --git a/apis/v1alpha1/gateway_types.go b/apis/v1alpha1/gateway_types.go deleted file mode 100644 index 10135f9f24..0000000000 --- a/apis/v1alpha1/gateway_types.go +++ /dev/null @@ -1,812 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api,shortName=gtw -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// Gateway represents an instantiation of a service-traffic handling -// infrastructure by binding Listeners to a set of IP addresses. -// -// Implementations should add the `gateway-exists-finalizer.networking.x-k8s.io` -// finalizer on the associated GatewayClass whenever Gateway(s) is running. -// This ensures that a GatewayClass associated with a Gateway(s) is not -// deleted while in use. -type Gateway struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of Gateway. - Spec GatewaySpec `json:"spec,omitempty"` - - // Status defines the current state of Gateway. - // - // +kubebuilder:default={conditions: {{type: "Scheduled", status: "False", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}} - Status GatewayStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// GatewayList contains a list of Gateway. -type GatewayList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Gateway `json:"items"` -} - -// GatewaySpec defines the desired state of Gateway. -// -// Not all possible combinations of options specified in the Spec are -// valid. Some invalid configurations can be caught synchronously via a -// webhook, but there are many cases that will require asynchronous -// signaling via the GatewayStatus block. -type GatewaySpec struct { - // GatewayClassName used for this Gateway. This is the name of a - // GatewayClass resource. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - GatewayClassName string `json:"gatewayClassName"` - - // Listeners associated with this Gateway. Listeners define - // logical endpoints that are bound on this Gateway's addresses. - // At least one Listener MUST be specified. - // - // An implementation MAY group Listeners by Port and then collapse each - // group of Listeners into a single Listener if the implementation - // determines that the Listeners in the group are "compatible". An - // implementation MAY also group together and collapse compatible - // Listeners belonging to different Gateways. - // - // For example, an implementation might consider Listeners to be - // compatible with each other if all of the following conditions are - // met: - // - // 1. Either each Listener within the group specifies the "HTTP" - // Protocol or each Listener within the group specifies either - // the "HTTPS" or "TLS" Protocol. - // - // 2. Each Listener within the group specifies a Hostname that is unique - // within the group. - // - // 3. As a special case, one Listener within a group may omit Hostname, - // in which case this Listener matches when no other Listener - // matches. - // - // If the implementation does collapse compatible Listeners, the - // hostname provided in the incoming client request MUST be - // matched to a Listener to find the correct set of Routes. - // The incoming hostname MUST be matched using the Hostname - // field for each Listener in order of most to least specific. - // That is, exact matches must be processed before wildcard - // matches. - // - // If this field specifies multiple Listeners that have the same - // Port value but are not compatible, the implementation must raise - // a "Conflicted" condition in the Listener status. - // - // Support: Core - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=64 - Listeners []Listener `json:"listeners"` - - // Addresses requested for this gateway. This is optional and - // behavior can depend on the GatewayClass. If a value is set - // in the spec and the requested address is invalid, the - // GatewayClass MUST indicate this in the associated entry in - // GatewayStatus.Addresses. - // - // If no Addresses are specified, the GatewayClass may - // schedule the Gateway in an implementation-defined manner, - // assigning an appropriate set of Addresses. - // - // The GatewayClass MUST bind all Listeners to every - // GatewayAddress that it assigns to the Gateway. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Addresses []GatewayAddress `json:"addresses,omitempty"` -} - -// Listener embodies the concept of a logical endpoint where a Gateway can -// accept network connections. Each listener in a Gateway must have a unique -// combination of Hostname, Port, and Protocol. This will be enforced by a -// validating webhook. -type Listener struct { - // Hostname specifies the virtual hostname to match for protocol types that - // define this concept. When unspecified, "", or `*`, all hostnames are - // matched. This field can be omitted for protocols that don't require - // hostname based matching. - // - // Hostname is the fully qualified domain name of a network host, as defined - // by RFC 3986. Note the following deviations from the "host" part of the - // URI as defined in the RFC: - // - // 1. IP literals are not allowed. - // 2. The `:` delimiter is not respected because ports are not allowed. - // - // Hostname can be "precise" which is a domain name without the terminating - // dot of a network host (e.g. "foo.example.com") or "wildcard", which is a - // domain name prefixed with a single wildcard label (e.g. `*.example.com`). - // The wildcard character `*` must appear by itself as the first DNS label - // and matches only a single label. - // - // Support: Core - // - // +optional - Hostname *Hostname `json:"hostname,omitempty"` - - // Port is the network port. Multiple listeners may use the - // same port, subject to the Listener compatibility rules. - // - // Support: Core - Port PortNumber `json:"port"` - - // Protocol specifies the network protocol this listener expects to receive. - // The GatewayClass MUST apply the Hostname match appropriately for each - // protocol: - // - // * For the "TLS" protocol, the Hostname match MUST be - // applied to the [SNI](https://tools.ietf.org/html/rfc6066#section-3) - // server name offered by the client. - // * For the "HTTP" protocol, the Hostname match MUST be - // applied to the host portion of the - // [effective request URI](https://tools.ietf.org/html/rfc7230#section-5.5) - // or the [:authority pseudo-header](https://tools.ietf.org/html/rfc7540#section-8.1.2.3) - // * For the "HTTPS" protocol, the Hostname match MUST be - // applied at both the TLS and HTTP protocol layers. - // - // Support: Core - Protocol ProtocolType `json:"protocol"` - - // TLS is the TLS configuration for the Listener. This field - // is required if the Protocol field is "HTTPS" or "TLS" and - // ignored otherwise. - // - // The association of SNIs to Certificate defined in GatewayTLSConfig is - // defined based on the Hostname field for this listener. - // - // The GatewayClass MUST use the longest matching SNI out of all - // available certificates for any TLS handshake. - // - // Support: Core - // - // +optional - TLS *GatewayTLSConfig `json:"tls,omitempty"` - - // Routes specifies a schema for associating routes with the - // Listener using selectors. A Route is a resource capable of - // servicing a request and allows a cluster operator to expose - // a cluster resource (i.e. Service) by externally-reachable - // URL, load-balance traffic and terminate SSL/TLS. Typically, - // a route is a "HTTPRoute" or "TCPRoute" in group - // "networking.x-k8s.io", however, an implementation may support - // other types of resources. - // - // The Routes selector MUST select a set of objects that - // are compatible with the application protocol specified in - // the Protocol field. - // - // Although a client request may technically match multiple route rules, - // only one rule may ultimately receive the request. Matching precedence - // MUST be determined in order of the following criteria: - // - // * The most specific match. For example, the most specific HTTPRoute match - // is determined by the longest matching combination of hostname and path. - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * If everything else is equivalent, the Route appearing first in - // alphabetical order (namespace/name) should be given precedence. For - // example, foo/bar is given precedence over foo/baz. - // - // All valid portions of a Route selected by this field should be supported. - // Invalid portions of a Route can be ignored (sometimes that will mean the - // full Route). If a portion of a Route transitions from valid to invalid, - // support for that portion of the Route should be dropped to ensure - // consistency. For example, even if a filter specified by a Route is - // invalid, the rest of the Route should still be supported. - // - // Support: Core - Routes RouteBindingSelector `json:"routes"` -} - -// ProtocolType defines the application protocol accepted by a Listener. -// Implementations are not required to accept all the defined protocols. -// If an implementation does not support a specified protocol, it -// should raise a "Detached" condition for the affected Listener with -// a reason of "UnsupportedProtocol". -// -// Core ProtocolType values are listed in the table below. -// -// Implementations can define their own protocols if a core ProtocolType does not -// exist. Such definitions must use prefixed name, such as -// `mycompany.com/my-custom-protocol`. Un-prefixed names are reserved for core -// protocols. Any protocol defined by implementations will fall under custom -// conformance. -type ProtocolType string - -const ( - // Accepts cleartext HTTP/1.1 sessions over TCP. - HTTPProtocolType ProtocolType = "HTTP" - - // Accepts HTTP/1.1 or HTTP/2 sessions over TLS. - HTTPSProtocolType ProtocolType = "HTTPS" - - // Accepts TLS sessions over TCP. - TLSProtocolType ProtocolType = "TLS" - - // Accepts TCP sessions. - TCPProtocolType ProtocolType = "TCP" - - // Accepts UDP packets. - UDPProtocolType ProtocolType = "UDP" -) - -// TLSRouteOverrideType type defines the level of allowance for Routes -// to override a specific TLS setting. -// +kubebuilder:validation:Enum=Allow;Deny -// +kubebuilder:default=Deny -type TLSRouteOverrideType string - -const ( - // Allows the parameter to be configured from all routes. - TLSROuteOVerrideAllow TLSRouteOverrideType = "Allow" - - // Prohibits the parameter from being configured from any route. - TLSRouteOverrideDeny TLSRouteOverrideType = "Deny" -) - -// TLSOverridePolicy defines a schema for overriding TLS settings at the Route -// level. -type TLSOverridePolicy struct { - // Certificate dictates if TLS certificates can be configured - // via Routes. If set to 'Allow', a TLS certificate for a hostname - // defined in a Route takes precedence over the certificate defined in - // Gateway. - // - // Support: Core - // - // +optional - // +kubebuilder:default=Deny - Certificate *TLSRouteOverrideType `json:"certificate,omitempty"` -} - -// GatewayTLSConfig describes a TLS configuration. -type GatewayTLSConfig struct { - // Mode defines the TLS behavior for the TLS session initiated by the client. - // There are two possible modes: - // - Terminate: The TLS session between the downstream client - // and the Gateway is terminated at the Gateway. This mode requires - // certificateRef to be set. - // - Passthrough: The TLS session is NOT terminated by the Gateway. This - // implies that the Gateway can't decipher the TLS stream except for - // the ClientHello message of the TLS protocol. - // CertificateRef field is ignored in this mode. - // - // Support: Core - // - // +optional - // +kubebuilder:default=Terminate - Mode *TLSModeType `json:"mode,omitempty"` - - // CertificateRef is a reference to a Kubernetes object that contains a TLS - // certificate and private key. This certificate is used to establish a TLS - // handshake for requests that match the hostname of the associated listener. - // The referenced object MUST reside in the same namespace as Gateway. - // - // This field is required when mode is set to "Terminate" (default) and - // optional otherwise. - // - // CertificateRef can reference a standard Kubernetes resource, i.e. Secret, - // or an implementation-specific custom resource. - // - // Support: Core (Kubernetes Secrets) - // - // Support: Implementation-specific (Other resource types) - // - // +optional - CertificateRef *LocalObjectReference `json:"certificateRef,omitempty"` - - // RouteOverride dictates if TLS settings can be configured - // via Routes or not. - // - // CertificateRef must be defined even if `routeOverride.certificate` is - // set to 'Allow' as it will be used as the default certificate for the - // listener. - // - // Support: Core - // - // +optional - // +kubebuilder:default={certificate:Deny} - RouteOverride *TLSOverridePolicy `json:"routeOverride,omitempty"` - - // Options are a list of key/value pairs to give extended options - // to the provider. - // - // There variation among providers as to how ciphersuites are - // expressed. If there is a common subset for expressing ciphers - // then it will make sense to loft that as a core API - // construct. - // - // Support: Implementation-specific - // - // +optional - Options map[string]string `json:"options,omitempty"` -} - -// TLSModeType type defines how a Gateway handles TLS sessions. -// -// +kubebuilder:validation:Enum=Terminate;Passthrough -type TLSModeType string - -const ( - // In this mode, TLS session between the downstream client - // and the Gateway is terminated at the Gateway. - TLSModeTerminate TLSModeType = "Terminate" - // In this mode, the TLS session is NOT terminated by the Gateway. This - // implies that the Gateway can't decipher the TLS stream except for - // the ClientHello message of the TLS protocol. - TLSModePassthrough TLSModeType = "Passthrough" -) - -// RouteBindingSelector defines a schema for associating routes with the Gateway. -// If Namespaces and Selector are defined, only routes matching both selectors are -// associated with the Gateway. -type RouteBindingSelector struct { - // Namespaces indicates in which namespaces Routes should be selected - // for this Gateway. This is restricted to the namespace of this Gateway by - // default. - // - // Support: Core - // - // +optional - // +kubebuilder:default={from: Same} - Namespaces *RouteNamespaces `json:"namespaces,omitempty"` - // Selector specifies a set of route labels used for selecting - // routes to associate with the Gateway. If this Selector is defined, - // only routes matching the Selector are associated with the Gateway. - // An empty Selector matches all routes. - // - // Support: Core - // - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty"` - // Group is the group of the route resource to select. Omitting the value or specifying - // the empty string indicates the networking.x-k8s.io API group. - // For example, use the following to select an HTTPRoute: - // - // routes: - // kind: HTTPRoute - // - // Otherwise, if an alternative API group is desired, specify the desired - // group: - // - // routes: - // group: acme.io - // kind: FooRoute - // - // Support: Core - // - // +optional - // +kubebuilder:default=networking.x-k8s.io - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Group *string `json:"group,omitempty"` - // Kind is the kind of the route resource to select. - // - // Kind MUST correspond to kinds of routes that are compatible with the - // application protocol specified in the Listener's Protocol field. - // - // If an implementation does not support or recognize this - // resource type, it SHOULD set the "ResolvedRefs" condition to false for - // this listener with the "InvalidRoutesRef" reason. - // - // Support: Core - Kind string `json:"kind"` -} - -// RouteSelectType specifies where Routes should be selected by a Gateway. -// -// +kubebuilder:validation:Enum=All;Selector;Same -type RouteSelectType string - -const ( - // Routes in all namespaces may be used by this Gateway. - RouteSelectAll RouteSelectType = "All" - // Only Routes in namespaces selected by the selector may be used by this Gateway. - RouteSelectSelector RouteSelectType = "Selector" - // Only Routes in the same namespace as the Gateway may be used by this Gateway. - RouteSelectSame RouteSelectType = "Same" -) - -// RouteNamespaces indicate which namespaces Routes should be selected from. -type RouteNamespaces struct { - // From indicates where Routes will be selected for this Gateway. Possible - // values are: - // * All: Routes in all namespaces may be used by this Gateway. - // * Selector: Routes in namespaces selected by the selector may be used by - // this Gateway. - // * Same: Only Routes in the same namespace may be used by this Gateway. - // - // Support: Core - // - // +optional - // +kubebuilder:default=Same - From *RouteSelectType `json:"from,omitempty"` - - // Selector must be specified when From is set to "Selector". In that case, - // only Routes in Namespaces matching this Selector will be selected by this - // Gateway. This field is ignored for other values of "From". - // - // Support: Core - // - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty"` -} - -// GatewayAddress describes an address that can be bound to a Gateway. -type GatewayAddress struct { - // Type of the address. - // - // Support: Extended - // - // +optional - // +kubebuilder:default=IPAddress - Type *AddressType `json:"type,omitempty"` - - // Value of the address. The validity of the values will depend - // on the type and support by the controller. - // - // Examples: `1.2.3.4`, `128::1`, `my-ip-address`. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Value string `json:"value"` -} - -// AddressType defines how a network address is represented as a text string. -// -// If the requested address is unsupported, the controller -// should raise the "Detached" listener status condition on -// the Gateway with the "UnsupportedAddress" reason. -// -// +kubebuilder:validation:Enum=IPAddress;NamedAddress -type AddressType string - -const ( - // A textual representation of a numeric IP address. IPv4 - // addresses must be in dotted-decimal form. IPv6 addresses - // must be in a standard IPv6 text representation - // (see [RFC 5952](https://tools.ietf.org/html/rfc5952)). - // - // Support: Extended - IPAddressType AddressType = "IPAddress" - - // An opaque identifier that represents a specific IP address. The - // interpretation of the name is dependent on the controller. For - // example, a "NamedAddress" might be a cloud-dependent identifier - // for a static or elastic IP. - // - // Support: Implementation-specific - NamedAddressType AddressType = "NamedAddress" -) - -// GatewayStatus defines the observed state of Gateway. -type GatewayStatus struct { - // Addresses lists the IP addresses that have actually been - // bound to the Gateway. These addresses may differ from the - // addresses in the Spec, e.g. if the Gateway automatically - // assigns an address from a reserved pool. - // - // These addresses should all be of type "IPAddress". - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Addresses []GatewayAddress `json:"addresses,omitempty"` - - // Conditions describe the current conditions of the Gateway. - // - // Implementations should prefer to express Gateway conditions - // using the `GatewayConditionType` and `GatewayConditionReason` - // constants so that operators and tools can converge on a common - // vocabulary to describe Gateway state. - // - // Known condition types are: - // - // * "Scheduled" - // * "Ready" - // - // +optional - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{type: "Scheduled", status: "False", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}} - Conditions []metav1.Condition `json:"conditions,omitempty"` - - // Listeners provide status for each unique listener port defined in the Spec. - // - // +optional - // +listType=map - // +listMapKey=port - // +kubebuilder:validation:MaxItems=64 - Listeners []ListenerStatus `json:"listeners,omitempty"` -} - -// GatewayConditionType is a type of condition associated with a -// Gateway. This type should be used with the GatewayStatus.Conditions -// field. -type GatewayConditionType string - -// GatewayConditionReason defines the set of reasons that explain -// why a particular Gateway condition type has been raised. -type GatewayConditionReason string - -const ( - // This condition is true when the controller managing the - // Gateway has scheduled the Gateway to the underlying network - // infrastructure. - // - // Possible reasons for this condition to be false are: - // - // * "NotReconciled" - // * "NoSuchGatewayClass" - // * "NoResources" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - GatewayConditionScheduled GatewayConditionType = "Scheduled" - - // This reason is used with the "Scheduled" condition when - // been recently created and no controller has reconciled it yet. - GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled" - - // This reason is used with the "Scheduled" condition when the Gateway is - // not scheduled because there is no controller that recognizes the - // GatewayClassName. This reason has been deprecated and will be removed in - // a future release. - // +deprecated - GatewayReasonNoSuchGatewayClass GatewayConditionReason = "NoSuchGatewayClass" - - // This reason is used with the "Scheduled" condition when the - // Gateway is not scheduled because insufficient infrastructure - // resources are available. - GatewayReasonNoResources GatewayConditionReason = "NoResources" -) - -const ( - // This condition is true when the Gateway is expected to be able - // to serve traffic. Note that this does not indicate that the - // Gateway configuration is current or even complete (e.g. the - // controller may still not have reconciled the latest version, - // or some parts of the configuration could be missing). - // - // If both the "ListenersNotValid" and "ListenersNotReady" - // reasons are true, the Gateway controller should prefer the - // "ListenersNotValid" reason. - // - // Possible reasons for this condition to be false are: - // - // * "ListenersNotValid" - // * "ListenersNotReady" - // * "AddressNotAssigned" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - GatewayConditionReady GatewayConditionType = "Ready" - - // This reason is used with the "Ready" condition when one or - // more Listeners have an invalid or unsupported configuration - // and cannot be configured on the Gateway. - GatewayReasonListenersNotValid GatewayConditionReason = "ListenersNotValid" - - // This reason is used with the "Ready" condition when one or - // more Listeners are not ready to serve traffic. - GatewayReasonListenersNotReady GatewayConditionReason = "ListenersNotReady" - - // This reason is used with the "Ready" condition when the requested - // address has not been assigned to the Gateway. This reason - // can be used to express a range of circumstances, including - // (but not limited to) IPAM address exhaustion, invalid - // or unsupported address requests, or a named address not - // being found. - GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned" -) - -// ListenerStatus is the status associated with a Listener. -type ListenerStatus struct { - // Port is the unique Listener port value for which this message is - // reporting the status. - Port PortNumber `json:"port"` - - // Protocol is the Listener protocol value for which this message is - // reporting the status. - Protocol ProtocolType `json:"protocol"` - - // Hostname is the Listener hostname value for which this message is - // reporting the status. - // - // +optional - Hostname *Hostname `json:"hostname,omitempty"` - - // Conditions describe the current condition of this listener. - // - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - Conditions []metav1.Condition `json:"conditions"` -} - -// ListenerConditionType is a type of condition associated with the -// listener. This type should be used with the ListenerStatus.Conditions -// field. -type ListenerConditionType string - -// ListenerConditionReason defines the set of reasons that explain -// why a particular Listener condition type has been raised. -type ListenerConditionReason string - -const ( - // This condition indicates that the controller was unable to resolve - // conflicting specification requirements for this Listener. If a - // Listener is conflicted, its network port should not be configured - // on any network elements. - // - // Possible reasons for this condition to be true are: - // - // * "HostnameConflict" - // * "ProtocolConflict" - // * "RouteConflict" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionConflicted ListenerConditionType = "Conflicted" - - // This reason is used with the "Conflicted" condition when - // the Listener conflicts with hostnames in other Listeners. For - // example, this reason would be used when multiple Listeners on - // the same port use `*` in the hostname field. - ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict" - - // This reason is used with the "Conflicted" condition when - // multiple Listeners are specified with the same Listener port - // number, but have conflicting protocol specifications. - ListenerReasonProtocolConflict ListenerConditionReason = "ProtocolConflict" - - // This reason is used with the "Conflicted" condition when the route - // resources selected for this Listener conflict with other - // specified properties of the Listener (e.g. Protocol). - // For example, a Listener that specifies "UDP" as the protocol - // but a route selector that resolves "TCPRoute" objects. - ListenerReasonRouteConflict ListenerConditionReason = "RouteConflict" -) - -const ( - // This condition indicates that, even though the listener is - // syntactically and semantically valid, the controller is not able - // to configure it on the underlying Gateway infrastructure. - // - // A Listener is specified as a logical requirement, but needs to be - // configured on a network endpoint (i.e. address and port) by a - // controller. The controller may be unable to attach the Listener - // if it specifies an unsupported requirement, or prerequisite - // resources are not available. - // - // Possible reasons for this condition to be true are: - // - // * "PortUnavailable" - // * "UnsupportedExtension" - // * "UnsupportedProtocol" - // * "UnsupportedAddress" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionDetached ListenerConditionType = "Detached" - - // This reason is used with the "Detached" condition when the - // Listener requests a port that cannot be used on the Gateway. - ListenerReasonPortUnavailable ListenerConditionReason = "PortUnavailable" - - // This reason is used with the "Detached" condition when the - // controller detects that an implementation-specific Listener - // extension is being requested, but is not able to support - // the extension. - ListenerReasonUnsupportedExtension ListenerConditionReason = "UnsupportedExtension" - - // This reason is used with the "Detached" condition when the - // Listener could not be attached to be Gateway because its - // protocol type is not supported. - ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol" - - // This reason is used with the "Detached" condition when - // the Listener could not be attached to the Gateway because the - // requested address is not supported. - ListenerReasonUnsupportedAddress ListenerConditionReason = "UnsupportedAddress" -) - -const ( - // This condition indicates whether the controller was able to - // resolve all the object references for the Listener. - // - // Possible reasons for this condition to be false are: - // - // * "DegradedRoutes" - // * "InvalidCertificateRef" - // * "InvalidRoutesRef" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionResolvedRefs ListenerConditionType = "ResolvedRefs" - - // This reason is used with the "ResolvedRefs" condition - // when not all of the routes selected by this Listener could be - // configured. The specific reason for the degraded route should - // be indicated in the route's .Status.Conditions field. - ListenerReasonDegradedRoutes ListenerConditionReason = "DegradedRoutes" - - // This reason is used with the "ResolvedRefs" condition when the - // Listener has a TLS configuration with a TLS CertificateRef - // that is invalid or cannot be resolved. - ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef" - - // This reason is used with the "ResolvedRefs" condition when - // the Listener's Routes selector or kind is invalid or cannot - // be resolved. Note that it is not an error for this selector to - // not resolve any Routes, and the "ResolvedRefs" status condition - // should not be raised in that case. - ListenerReasonInvalidRoutesRef ListenerConditionReason = "InvalidRoutesRef" -) - -const ( - // This condition indicates whether the Listener has been - // configured on the Gateway. - // - // Possible reasons for this condition to be false are: - // - // * "Invalid" - // * "Pending" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionReady ListenerConditionType = "Ready" - - // This reason is used with the "Ready" condition when the - // Listener is syntactically or semantically invalid. - ListenerReasonInvalid ListenerConditionReason = "Invalid" - - // This reason is used with the "Ready" condition when the - // Listener is not yet not online and ready to accept client - // traffic. - ListenerReasonPending ListenerConditionReason = "Pending" -) diff --git a/apis/v1alpha1/gatewayclass_types.go b/apis/v1alpha1/gatewayclass_types.go deleted file mode 100644 index 38349b3df1..0000000000 --- a/apis/v1alpha1/gatewayclass_types.go +++ /dev/null @@ -1,185 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controller` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// GatewayClass describes a class of Gateways available to the user -// for creating Gateway resources. -// -// GatewayClass is a Cluster level resource. -type GatewayClass struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of GatewayClass. - Spec GatewayClassSpec `json:"spec,omitempty"` - - // Status defines the current state of GatewayClass. - // - // +kubebuilder:default={conditions: {{type: "Admitted", status: "False", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}} - Status GatewayClassStatus `json:"status,omitempty"` -} - -// GatewayClassSpec reflects the configuration of a class of Gateways. -type GatewayClassSpec struct { - // Controller is a domain/path string that indicates the - // controller that is managing Gateways of this class. - // - // Example: "acme.io/gateway-controller". - // - // This field is not mutable and cannot be empty. - // - // The format of this field is DOMAIN "/" PATH, where DOMAIN - // and PATH are valid Kubernetes names - // (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - // - // Support: Core - // - // +kubebuilder:validation:MaxLength=253 - Controller string `json:"controller"` - - // ParametersRef is a reference to a resource that contains the configuration - // parameters corresponding to the GatewayClass. This is optional if the - // controller does not require any additional configuration. - // - // ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap, - // or an implementation-specific custom resource. The resource can be - // cluster-scoped or namespace-scoped. - // - // If the referent cannot be found, the GatewayClass's "InvalidParameters" - // status condition will be true. - // - // Support: Custom - // - // +optional - ParametersRef *ParametersReference `json:"parametersRef,omitempty"` -} - -// ParametersReference identifies an API object containing controller-specific -// configuration resource within the cluster. -type ParametersReference struct { - // Group is the group of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Group string `json:"group"` - - // Kind is kind of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Kind string `json:"kind"` - - // Name is the name of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` - - // Scope represents if the referent is a Cluster or Namespace scoped resource. - // This may be set to "Cluster" or "Namespace". - // +kubebuilder:validation:Enum=Cluster;Namespace - // +kubebuilder:default=Cluster - // +optional - Scope *string `json:"scope,omitempty"` - - // Namespace is the namespace of the referent. - // This field is required when scope is set to "Namespace" and ignored when - // scope is set to "Cluster". - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - // +optional - Namespace *string `json:"namespace,omitempty"` -} - -// GatewayClassConditionType is the type for status conditions on -// Gateway resources. This type should be used with the -// GatewayClassStatus.Conditions field. -type GatewayClassConditionType string - -// GatewayClassConditionReason defines the set of reasons that explain why -// a particular GatewayClass condition type has been raised. -type GatewayClassConditionReason string - -const ( - // This condition indicates whether the GatewayClass has been - // admitted by the controller requested in the `spec.controller` - // field. - // - // This condition defaults to False, and MUST be set by a controller when it sees - // a GatewayClass using its controller string. - // The status of this condition MUST be set to true if the controller will support - // provisioning Gateways using this class. Otherwise, this status MUST be set to false. - // If the status is set to false, the controller SHOULD set a Message and Reason as an - // explanation. - // - // Controllers should prefer to use the values of GatewayClassConditionReason - // for the corresponding Reason, where appropriate. - GatewayClassConditionStatusAdmitted GatewayClassConditionType = "Admitted" - - // This reason is used with the "Admitted" condition when the - // GatewayClass was not admitted because the parametersRef field - // was invalid, with more detail in the message. - GatewayClassNotAdmittedInvalidParameters GatewayClassConditionReason = "InvalidParameters" - - // This reason is used with the "Admitted" condition when the - // requested controller has not yet made a decision about whether - // to admit the GatewayClass. It is the default Reason on a new - // GatewayClass. It indicates - GatewayClassNotAdmittedWaiting GatewayClassConditionReason = "Waiting" - - // GatewayClassFinalizerGatewaysExist should be added as a finalizer to the - // GatewayClass whenever there are provisioned Gateways using a GatewayClass. - GatewayClassFinalizerGatewaysExist = "gateway-exists-finalizer.networking.x-k8s.io" -) - -// GatewayClassStatus is the current status for the GatewayClass. -type GatewayClassStatus struct { - // Conditions is the current status from the controller for - // this GatewayClass. - // - // Controllers should prefer to publish conditions using values - // of GatewayClassConditionType for the type of each Condition. - // - // +optional - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{type: "Admitted", status: "False", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}} - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true - -// GatewayClassList contains a list of GatewayClass -type GatewayClassList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []GatewayClass `json:"items"` -} diff --git a/apis/v1alpha1/httproute_types.go b/apis/v1alpha1/httproute_types.go deleted file mode 100644 index e2608942e8..0000000000 --- a/apis/v1alpha1/httproute_types.go +++ /dev/null @@ -1,721 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames` -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// HTTPRoute is the Schema for the HTTPRoute resource. -type HTTPRoute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of HTTPRoute. - Spec HTTPRouteSpec `json:"spec,omitempty"` - - // Status defines the current state of HTTPRoute. - Status HTTPRouteStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// HTTPRouteList contains a list of HTTPRoute. -type HTTPRouteList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []HTTPRoute `json:"items"` -} - -// HTTPRouteSpec defines the desired state of HTTPRoute -type HTTPRouteSpec struct { - // Gateways defines which Gateways can use this Route. - // - // +optional - // +kubebuilder:default={allow: "SameNamespace"} - Gateways *RouteGateways `json:"gateways,omitempty"` - - // Hostnames defines a set of hostname that should match against - // the HTTP Host header to select a HTTPRoute to process the request. - // Hostname is the fully qualified domain name of a network host, - // as defined by RFC 3986. Note the following deviations from the - // "host" part of the URI as defined in the RFC: - // - // 1. IPs are not allowed. - // 2. The `:` delimiter is not respected because ports are not allowed. - // - // Incoming requests are matched against the hostnames before the - // HTTPRoute rules. If no hostname is specified, traffic is routed - // based on the HTTPRouteRules. - // - // Hostname can be "precise" which is a domain name without the terminating - // dot of a network host (e.g. "foo.example.com") or "wildcard", which is - // a domain name prefixed with a single wildcard label (e.g. `*.example.com`). - // The wildcard character `*` must appear by itself as the first DNS - // label and matches only a single label. - // You cannot have a wildcard label by itself (e.g. Host == `*`). - // Requests will be matched against the Host field in the following order: - // - // 1. If Host is precise, the request matches this rule if - // the HTTP Host header is equal to Host. - // 2. If Host is a wildcard, then the request matches this rule if - // the HTTP Host header is to equal to the suffix - // (removing the first label) of the wildcard rule. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Hostnames []Hostname `json:"hostnames,omitempty"` - - // TLS defines the TLS certificate to use for Hostnames defined in this - // Route. This configuration only takes effect if the AllowRouteOverride - // field is set to true in the associated Gateway resource. - // - // Collisions can happen if multiple HTTPRoutes define a TLS certificate - // for the same hostname. In such a case, conflict resolution guiding - // principles apply, specifically, if hostnames are same and two different - // certificates are specified then the certificate in the - // oldest resource wins. - // - // Please note that HTTP Route-selection takes place after the - // TLS Handshake (ClientHello). Due to this, TLS certificate defined - // here will take precedence even if the request has the potential to - // match multiple routes (in case multiple HTTPRoutes share the same - // hostname). - // - // Support: Core - // - // +optional - TLS *RouteTLSConfig `json:"tls,omitempty"` - - // Rules are a list of HTTP matchers, filters and actions. - // - // +optional - // +kubebuilder:validation:MaxItems=16 - // +kubebuilder:default={{matches: {{path: {type: "Prefix", value: "/"}}}}} - Rules []HTTPRouteRule `json:"rules,omitempty"` -} - -// RouteTLSConfig describes a TLS configuration defined at the Route level. -type RouteTLSConfig struct { - // CertificateRef is a reference to a Kubernetes object that contains a TLS - // certificate and private key. This certificate is used to establish a TLS - // handshake for requests that match the hostname of the associated HTTPRoute. - // The referenced object MUST reside in the same namespace as HTTPRoute. - // - // This field is required when the TLS configuration mode of the associated - // Gateway listener is set to "Passthrough". - // - // CertificateRef can reference a standard Kubernetes resource, i.e. Secret, - // or an implementation-specific custom resource. - // - // Support: Core (Kubernetes Secrets) - // - // Support: Implementation-specific (Other resource types) - // - CertificateRef LocalObjectReference `json:"certificateRef"` -} - -// HTTPRouteRule defines semantics for matching an HTTP request based on -// conditions, optionally executing additional processing steps, and forwarding -// the request to an API object. -type HTTPRouteRule struct { - // Matches define conditions used for matching the rule against incoming - // HTTP requests. Each match is independent, i.e. this rule will be matched - // if **any** one of the matches is satisfied. - // - // For example, take the following matches configuration: - // - // ``` - // matches: - // - path: - // value: "/foo" - // headers: - // values: - // version: "2" - // - path: - // value: "/v2/foo" - // ``` - // - // For a request to match against this rule, a request should satisfy - // EITHER of the two conditions: - // - // - path prefixed with `/foo` AND contains the header `version: "2"` - // - path prefix of `/v2/foo` - // - // See the documentation for HTTPRouteMatch on how to specify multiple - // match conditions that should be ANDed together. - // - // If no matches are specified, the default is a prefix - // path match on "/", which has the effect of matching every - // HTTP request. - // - // - // Each client request MUST map to a maximum of one route rule. If a request - // matches multiple rules, matching precedence MUST be determined in order - // of the following criteria, continuing on ties: - // - // * The longest matching hostname. - // * The longest matching path. - // * The largest number of header matches. - // - // If ties still exist across multiple Routes, matching precedence MUST be - // determined in order of the following criteria, continuing on ties: - // - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * The Route appearing first in alphabetical order by - // "{namespace}/{name}". For example, foo/bar is given precedence over - // foo/baz. - // - // If ties still exist within the Route that has been given precedence, - // matching precedence MUST be granted to the first matching rule meeting - // the above criteria. - // - // +optional - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{path:{ type: "Prefix", value: "/"}}} - Matches []HTTPRouteMatch `json:"matches,omitempty"` - - // Filters define the filters that are applied to requests that match - // this rule. - // - // The effects of ordering of multiple behaviors are currently unspecified. - // This can change in the future based on feedback during the alpha stage. - // - // Conformance-levels at this level are defined based on the type of filter: - // - // - ALL core filters MUST be supported by all implementations. - // - Implementers are encouraged to support extended filters. - // - Implementation-specific custom filters have no API guarantees across - // implementations. - // - // Specifying a core filter multiple times has unspecified or custom conformance. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Filters []HTTPRouteFilter `json:"filters,omitempty"` - - // ForwardTo defines the backend(s) where matching requests should be sent. - // If unspecified, the rule performs no forwarding. If unspecified and no - // filters are specified that would result in a response being sent, a 503 - // error code is returned. - // - // +optional - // +kubebuilder:validation:MaxItems=16 - ForwardTo []HTTPRouteForwardTo `json:"forwardTo,omitempty"` -} - -// PathMatchType specifies the semantics of how HTTP paths should be compared. -// Valid PathMatchType values are: -// -// * "Exact" -// * "Prefix" -// * "RegularExpression" -// * "ImplementationSpecific" -// -// Prefix and Exact paths must be syntactically valid: -// -// - Must begin with the '/' character -// - Must not contain consecutive '/' characters (e.g. /foo///, //). -// - For prefix paths, a trailing '/' character in the Path is ignored, -// e.g. /abc and /abc/ specify the same match. -// -// +kubebuilder:validation:Enum=Exact;Prefix;RegularExpression;ImplementationSpecific -type PathMatchType string - -// PathMatchType constants. -const ( - PathMatchExact PathMatchType = "Exact" - PathMatchPrefix PathMatchType = "Prefix" - PathMatchRegularExpression PathMatchType = "RegularExpression" - PathMatchImplementationSpecific PathMatchType = "ImplementationSpecific" -) - -// HeaderMatchType specifies the semantics of how HTTP header values should be -// compared. Valid HeaderMatchType values are: -// -// * "Exact" -// * "RegularExpression" -// * "ImplementationSpecific" -// -// +kubebuilder:validation:Enum=Exact;RegularExpression;ImplementationSpecific -type HeaderMatchType string - -// HeaderMatchType constants. -const ( - HeaderMatchExact HeaderMatchType = "Exact" - HeaderMatchRegularExpression HeaderMatchType = "RegularExpression" - HeaderMatchImplementationSpecific HeaderMatchType = "ImplementationSpecific" -) - -// QueryParamMatchType specifies the semantics of how HTTP query parameter -// values should be compared. Valid QueryParamMatchType values are: -// -// * "Exact" -// * "RegularExpression" -// * "ImplementationSpecific" -// -// +kubebuilder:validation:Enum=Exact;RegularExpression;ImplementationSpecific -type QueryParamMatchType string - -// QueryParamMatchType constants. -const ( - QueryParamMatchExact QueryParamMatchType = "Exact" - QueryParamMatchRegularExpression QueryParamMatchType = "RegularExpression" - QueryParamMatchImplementationSpecific QueryParamMatchType = "ImplementationSpecific" -) - -// HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path. -type HTTPPathMatch struct { - // Type specifies how to match against the path Value. - // - // Support: Core (Exact, Prefix) - // - // Support: Custom (RegularExpression, ImplementationSpecific) - // - // Since RegularExpression PathType has custom conformance, implementations - // can support POSIX, PCRE or any other dialects of regular expressions. - // Please read the implementation's documentation to determine the supported - // dialect. - // - // +optional - // +kubebuilder:default=Prefix - Type *PathMatchType `json:"type,omitempty"` - - // Value of the HTTP path to match against. - // - // +optional - // +kubebuilder:default="/" - Value *string `json:"value,omitempty"` -} - -// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request -// headers. -type HTTPHeaderMatch struct { - // Type specifies how to match against the value of the header. - // - // Support: Core (Exact) - // - // Support: Custom (RegularExpression, ImplementationSpecific) - // - // Since RegularExpression PathType has custom conformance, implementations - // can support POSIX, PCRE or any other dialects of regular expressions. - // Please read the implementation's documentation to determine the supported - // dialect. - // - // HTTP Header name matching MUST be case-insensitive (RFC 2616 - section 4.2). - // - // +optional - // +kubebuilder:default=Exact - Type *HeaderMatchType `json:"type,omitempty"` - - // Values is a map of HTTP Headers to be matched. - // It MUST contain at least one entry. - // - // The HTTP header field name to match is the map key, and the - // value of the HTTP header is the map value. HTTP header field name matching - // MUST be case-insensitive. - // - // Multiple match values are ANDed together, meaning, a request - // must match all the specified headers to select the route. - Values map[string]string `json:"values"` -} - -// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP -// query parameters. -type HTTPQueryParamMatch struct { - // Type specifies how to match against the value of the query parameter. - // - // Support: Extended (Exact) - // - // Support: Custom (RegularExpression, ImplementationSpecific) - // - // Since RegularExpression QueryParamMatchType has custom conformance, - // implementations can support POSIX, PCRE or any other dialects of regular - // expressions. Please read the implementation's documentation to determine - // the supported dialect. - // - // +optional - // +kubebuilder:default=Exact - Type *QueryParamMatchType `json:"type,omitempty"` - - // Values is a map of HTTP query parameters to be matched. It MUST contain - // at least one entry. - // - // The query parameter name to match is the map key, and the value of the - // query parameter is the map value. - // - // Multiple match values are ANDed together, meaning, a request must match - // all the specified query parameters to select the route. - // - // HTTP query parameter matching MUST be case-sensitive for both keys and - // values. (See https://tools.ietf.org/html/rfc7230#section-2.7.3). - // - // Note that the query parameter key MUST always be an exact match by string - // comparison. - Values map[string]string `json:"values"` -} - -// HTTPRouteMatch defines the predicate used to match requests to a given -// action. Multiple match types are ANDed together, i.e. the match will -// evaluate to true only if all conditions are satisfied. -// -// For example, the match below will match a HTTP request only if its path -// starts with `/foo` AND it contains the `version: "1"` header: -// -// ``` -// match: -// path: -// value: "/foo" -// headers: -// values: -// version: "1" -// ``` -type HTTPRouteMatch struct { - // Path specifies a HTTP request path matcher. If this field is not - // specified, a default prefix match on the "/" path is provided. - // - // +optional - // +kubebuilder:default={type: "Prefix", value: "/"} - Path *HTTPPathMatch `json:"path,omitempty"` - - // Headers specifies a HTTP request header matcher. - // - // +optional - Headers *HTTPHeaderMatch `json:"headers,omitempty"` - - // QueryParams specifies a HTTP query parameter matcher. - // - // +optional - QueryParams *HTTPQueryParamMatch `json:"queryParams,omitempty"` - - // ExtensionRef is an optional, implementation-specific extension to the - // "match" behavior. For example, resource "myroutematcher" in group - // "networking.acme.io". If the referent cannot be found, the rule is not - // included in the route. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. The gateway - // status for this route should be updated with a condition that describes - // the error more specifically. - // - // Support: Custom - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} - -// HTTPRouteFilter defines additional processing steps that must be completed -// during the request or response lifecycle. HTTPRouteFilters are meant as an -// extension point to express additional processing that may be done in Gateway -// implementations. Some examples include request or response modification, -// implementing authentication strategies, rate-limiting, and traffic shaping. -// API guarantee/conformance is defined based on the type of the filter. -// TODO(hbagdi): re-render CRDs once controller-tools supports union tags: -// - https://github.com/kubernetes-sigs/controller-tools/pull/298 -// - https://github.com/kubernetes-sigs/controller-tools/issues/461 -// +union -type HTTPRouteFilter struct { - // Type identifies the type of filter to apply. As with other API fields, - // types are classified into three conformance levels: - // - // - Core: Filter types and their corresponding configuration defined by - // "Support: Core" in this package, e.g. "RequestHeaderModifier". All - // implementations must support core filters. - // - // - Extended: Filter types and their corresponding configuration defined by - // "Support: Extended" in this package, e.g. "RequestMirror". Implementers - // are encouraged to support extended filters. - // - // - Custom: Filters that are defined and supported by specific vendors. - // In the future, filters showing convergence in behavior across multiple - // implementations will be considered for inclusion in extended or core - // conformance levels. Filter-specific configuration for such filters - // is specified using the ExtensionRef field. `Type` should be set to - // "ExtensionRef" for custom filters. - // - // Implementers are encouraged to define custom implementation types to - // extend the core API with implementation-specific behavior. - // - // +unionDiscriminator - Type HTTPRouteFilterType `json:"type"` - - // RequestHeaderModifier defines a schema for a filter that modifies request - // headers. - // - // Support: Core - // - // +optional - RequestHeaderModifier *HTTPRequestHeaderFilter `json:"requestHeaderModifier,omitempty"` - - // RequestMirror defines a schema for a filter that mirrors requests. - // - // Support: Extended - // - // +optional - RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror,omitempty"` - - // ExtensionRef is an optional, implementation-specific extension to the - // "filter" behavior. For example, resource "myroutefilter" in group - // "networking.acme.io"). ExtensionRef MUST NOT be used for core and - // extended filters. - // - // Support: Implementation-specific - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} - -// HTTPRouteFilterType identifies a type of HTTPRoute filter. -// +kubebuilder:validation:Enum=RequestHeaderModifier;RequestMirror;ExtensionRef -type HTTPRouteFilterType string - -const ( - // HTTPRouteFilterRequestHeaderModifier can be used to add or remove an HTTP - // header from an HTTP request before it is sent to the upstream target. - // - // Support in HTTPRouteRule: Core - // - // Support in HTTPRouteForwardTo: Extended - HTTPRouteFilterRequestHeaderModifier HTTPRouteFilterType = "RequestHeaderModifier" - - // HTTPRouteFilterRequestMirror can be used to mirror HTTP requests to a - // different backend. The responses from this backend MUST be ignored by - // the Gateway. - // - // Support in HTTPRouteRule: Extended - // - // Support in HTTPRouteForwardTo: Extended - HTTPRouteFilterRequestMirror HTTPRouteFilterType = "RequestMirror" - - // HTTPRouteFilterExtensionRef should be used for configuring custom - // HTTP filters. - // - // Support in HTTPRouteRule: Custom - // - // Support in HTTPRouteForwardTo: Custom - HTTPRouteFilterExtensionRef HTTPRouteFilterType = "ExtensionRef" -) - -// HTTPRequestHeaderFilter defines configuration for the RequestHeaderModifier -// filter. -type HTTPRequestHeaderFilter struct { - // Set overwrites the request with the given header (name, value) - // before the action. - // - // Input: - // GET /foo HTTP/1.1 - // my-header: foo - // - // Config: - // set: {"my-header": "bar"} - // - // Output: - // GET /foo HTTP/1.1 - // my-header: bar - // - // Support: Extended - // - // +optional - Set map[string]string `json:"set,omitempty"` - - // Add adds the given header (name, value) to the request - // before the action. It appends to any existing values associated - // with the header name. - // - // Input: - // GET /foo HTTP/1.1 - // my-header: foo - // - // Config: - // add: {"my-header": "bar"} - // - // Output: - // GET /foo HTTP/1.1 - // my-header: foo - // my-header: bar - // - // Support: Extended - // - // +optional - Add map[string]string `json:"add,omitempty"` - - // Remove the given header(s) from the HTTP request before the - // action. The value of RemoveHeader is a list of HTTP header - // names. Note that the header names are case-insensitive - // [RFC-2616 4.2]. - // - // Input: - // GET /foo HTTP/1.1 - // my-header1: foo - // my-header2: bar - // my-header3: baz - // - // Config: - // remove: ["my-header1", "my-header3"] - // - // Output: - // GET /foo HTTP/1.1 - // my-header2: bar - // - // Support: Extended - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Remove []string `json:"remove,omitempty"` -} - -// HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. -type HTTPRequestMirrorFilter struct { - // ServiceName refers to the name of the Service to mirror matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` - - // BackendRef is a local object reference to mirror matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // Support: Custom - // - // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` - - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. - // - // +optional - Port *PortNumber `json:"port,omitempty"` -} - -// HTTPRouteForwardTo defines how a HTTPRoute should forward a request. -type HTTPRouteForwardTo struct { - // ServiceName refers to the name of the Service to forward matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the route must be dropped - // from the Gateway. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. - // The gateway status for this route should be updated with a - // condition that describes the error more specifically. - // - // The protocol to use should be specified with the AppProtocol field on Service - // resources. This field was introduced in Kubernetes 1.18. If using an earlier version - // of Kubernetes, a `networking.x-k8s.io/app-protocol` annotation on the - // BackendPolicy resource may be used to define the protocol. If the - // AppProtocol field is available, this annotation should not be used. The - // AppProtocol field, when populated, takes precedence over the annotation - // in the BackendPolicy resource. For custom backends, it is encouraged to - // add a semantically-equivalent field in the Custom Resource Definition. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` - - // BackendRef is a reference to a backend to forward matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the route must be dropped - // from the Gateway. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. - // The gateway status for this route should be updated with a - // condition that describes the error more specifically. - // - // Support: Custom - // - // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` - - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. - // - // Support: Core - // - // +optional - Port *PortNumber `json:"port,omitempty"` - - // Weight specifies the proportion of HTTP requests forwarded to the backend - // referenced by the ServiceName or BackendRef field. This is computed as - // weight/(sum of all weights in this ForwardTo list). For non-zero values, - // there may be some epsilon from the exact proportion defined here - // depending on the precision an implementation supports. Weight is not a - // percentage and the sum of weights does not need to equal 100. - // - // If only one backend is specified and it has a weight greater than 0, 100% - // of the traffic is forwarded to that backend. If weight is set to 0, no - // traffic should be forwarded for this entry. If unspecified, weight - // defaults to 1. - // - // Support: Core - // - // +optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=1000000 - Weight *int32 `json:"weight,omitempty"` - - // Filters defined at this-level should be executed if and only if the - // request is being forwarded to the backend defined here. - // - // Support: Custom (For broader support of filters, use the Filters field - // in HTTPRouteRule.) - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Filters []HTTPRouteFilter `json:"filters,omitempty"` -} - -// HTTPRouteStatus defines the observed state of HTTPRoute. -type HTTPRouteStatus struct { - RouteStatus `json:",inline"` -} diff --git a/apis/v1alpha1/local_object_reference_types.go b/apis/v1alpha1/local_object_reference_types.go deleted file mode 100644 index abc80d783d..0000000000 --- a/apis/v1alpha1/local_object_reference_types.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -// LocalObjectReference identifies an API object within the namespace of the -// referrer. -type LocalObjectReference struct { - // Group is the group of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Group string `json:"group"` - - // Kind is kind of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Kind string `json:"kind"` - - // Name is the name of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` -} diff --git a/apis/v1alpha1/shared_types.go b/apis/v1alpha1/shared_types.go deleted file mode 100644 index ca9d0b6a5f..0000000000 --- a/apis/v1alpha1/shared_types.go +++ /dev/null @@ -1,262 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GatewayAllowType specifies which Gateways should be allowed to use a Route. -type GatewayAllowType string - -const ( - // Any Gateway will be able to use this route. - GatewayAllowAll GatewayAllowType = "All" - // Only Gateways that have been specified in GatewayRefs will be able to use this route. - GatewayAllowFromList GatewayAllowType = "FromList" - // Only Gateways within the same namespace as the route will be able to use this route. - GatewayAllowSameNamespace GatewayAllowType = "SameNamespace" -) - -const ( - // AnnotationAppProtocol defines the protocol a Gateway should use for - // communication with a Kubernetes Service. This annotation must be present - // on the BackendPolicy resource and the protocol will apply to all Service - // ports that are selected by BackendPolicy.Spec.BackendRefs. If the - // AppProtocol field is available, this annotation should not be used. The - // AppProtocol field, when populated, takes precedence over this annotation. - // The value of this annotation must be also be a valid value for the - // AppProtocol field. - // - // Examples: - // - // - `networking.x-k8s.io/app-protocol: https` - // - `networking.x-k8s.io/app-protocol: tls` - AnnotationAppProtocol = "networking.x-k8s.io/app-protocol" -) - -// RouteGateways defines which Gateways will be able to use a route. If this -// field results in preventing the selection of a Route by a Gateway, an -// "Admitted" condition with a status of false must be set for the Gateway on -// that Route. -type RouteGateways struct { - // Allow indicates which Gateways will be allowed to use this route. - // Possible values are: - // * All: Gateways in any namespace can use this route. - // * FromList: Only Gateways specified in GatewayRefs may use this route. - // * SameNamespace: Only Gateways in the same namespace may use this route. - // - // +optional - // +kubebuilder:validation:Enum=All;FromList;SameNamespace - // +kubebuilder:default=SameNamespace - Allow *GatewayAllowType `json:"allow,omitempty"` - - // GatewayRefs must be specified when Allow is set to "FromList". In that - // case, only Gateways referenced in this list will be allowed to use this - // route. This field is ignored for other values of "Allow". - // - // +optional - GatewayRefs []GatewayReference `json:"gatewayRefs,omitempty"` -} - -// PortNumber defines a network port. -// -// +kubebuilder:validation:Minimum=1 -// +kubebuilder:validation:Maximum=65535 -type PortNumber int32 - -// GatewayReference identifies a Gateway in a specified namespace. -type GatewayReference struct { - // Name is the name of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` - - // Namespace is the namespace of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Namespace string `json:"namespace"` -} - -// RouteForwardTo defines how a Route should forward a request. -type RouteForwardTo struct { - // ServiceName refers to the name of the Service to forward matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // The protocol to use is defined using AppProtocol field (introduced in - // Kubernetes 1.18) in the Service resource. In the absence of the - // AppProtocol field a `networking.x-k8s.io/app-protocol` annotation on the - // BackendPolicy resource may be used to define the protocol. If the - // AppProtocol field is available, this annotation should not be used. The - // AppProtocol field, when populated, takes precedence over the annotation - // in the BackendPolicy resource. For custom backends, it is encouraged to - // add a semantically-equivalent field in the Custom Resource Definition. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` - - // BackendRef is a reference to a backend to forward matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // Support: Custom - // - // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` - - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. - // - // Support: Core - // - // +optional - Port *PortNumber `json:"port,omitempty"` - - // Weight specifies the proportion of HTTP requests forwarded to the backend - // referenced by the ServiceName or BackendRef field. This is computed as - // weight/(sum of all weights in this ForwardTo list). For non-zero values, - // there may be some epsilon from the exact proportion defined here - // depending on the precision an implementation supports. Weight is not a - // percentage and the sum of weights does not need to equal 100. - // - // If only one backend is specified and it has a weight greater than 0, 100% - // of the traffic is forwarded to that backend. If weight is set to 0, no - // traffic should be forwarded for this entry. If unspecified, weight - // defaults to 1. - // - // Support: Extended - // - // +optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=1000000 - Weight *int32 `json:"weight,omitempty"` -} - -// RouteConditionType is a type of condition for a route. -type RouteConditionType string - -// RouteConditionReason is a reason for a route condition. -type RouteConditionReason string - -const ( - // This condition indicates whether the route has been admitted - // or refused by a Gateway. - ConditionRouteAdmitted RouteConditionType = "Admitted" - - // This reason is used with the "Admitted" condition when the Route has been - // admitted by the Gateway. - RouteReasonAdmitted RouteConditionReason = "Admitted" - - // This reason is used with the "Admitted" condition when the Route has been - // refused by the Gateway. - RouteReasonRefused RouteConditionReason = "Refused" -) - -// RouteGatewayStatus describes the status of a route with respect to an -// associated Gateway. -type RouteGatewayStatus struct { - // GatewayRef is a reference to a Gateway object that is associated with - // the route. - GatewayRef RouteStatusGatewayReference `json:"gatewayRef"` - - // Conditions describes the status of the route with respect to the - // Gateway. The "Admitted" condition must always be specified by controllers - // to indicate whether the route has been admitted or rejected by the Gateway, - // and why. Note that the route's availability is also subject to the Gateway's - // own status conditions and listener status. - // - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// RouteStatusGatewayReference identifies a Gateway in a specified namespace. -// This reference also includes a controller name to simplify cleaning up status -// entries. -type RouteStatusGatewayReference struct { - // Name is the name of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` - - // Namespace is the namespace of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Namespace string `json:"namespace"` - - // Controller is a domain/path string that indicates the controller - // implementing the Gateway. This corresponds with the controller field on - // GatewayClass. - // - // Example: "acme.io/gateway-controller". - // - // The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are - // valid Kubernetes names - // (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - // - // +kubebuilder:validation:MaxLength=253 - // +optional - Controller *string `json:"controller"` -} - -// RouteStatus defines the observed state that is required across -// all route types. -type RouteStatus struct { - // Gateways is a list of Gateways that are associated with the route, - // and the status of the route with respect to each Gateway. When a - // Gateway selects this route, the controller that manages the Gateway - // must add an entry to this list when the controller first sees the - // route and should update the entry as appropriate when the route is - // modified. - // - // A maximum of 100 Gateways will be represented in this list. If this list - // is full, there may be additional Gateways using this Route that are not - // included in the list. An empty list means the route has not been admitted - // by any Gateway. - // - // +kubebuilder:validation:MaxItems=100 - Gateways []RouteGatewayStatus `json:"gateways"` -} - -// Hostname is used to specify a hostname that should be matched. -// -// +kubebuilder:validation:MinLength=1 -// +kubebuilder:validation:MaxLength=253 -type Hostname string diff --git a/apis/v1alpha1/tcproute_types.go b/apis/v1alpha1/tcproute_types.go deleted file mode 100644 index 44bf3f7bb7..0000000000 --- a/apis/v1alpha1/tcproute_types.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// TCPRoute is the Schema for the TCPRoute resource. -type TCPRoute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of TCPRoute. - Spec TCPRouteSpec `json:"spec,omitempty"` - - // Status defines the current state of TCPRoute. - Status TCPRouteStatus `json:"status,omitempty"` -} - -// TCPRouteSpec defines the desired state of TCPRoute -type TCPRouteSpec struct { - // Rules are a list of TCP matchers and actions. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - Rules []TCPRouteRule `json:"rules"` - - // Gateways defines which Gateways can use this Route. - // - // +optional - // +kubebuilder:default={allow: "SameNamespace"} - Gateways *RouteGateways `json:"gateways,omitempty"` -} - -// TCPRouteStatus defines the observed state of TCPRoute -type TCPRouteStatus struct { - RouteStatus `json:",inline"` -} - -// TCPRouteRule is the configuration for a given rule. -type TCPRouteRule struct { - // Matches define conditions used for matching the rule against incoming TCP - // connections. Each match is independent, i.e. this rule will be matched if - // **any** one of the matches is satisfied. If unspecified (i.e. empty), - // this Rule will match all requests for the associated Listener. - // - // Each client request MUST map to a maximum of one route rule. If a request - // matches multiple rules, matching precedence MUST be determined in order - // of the following criteria, continuing on ties: - // - // * The most specific match specified by ExtensionRef. Each implementation - // that supports ExtensionRef may have different ways of determining the - // specificity of the referenced extension. - // - // If ties still exist across multiple Routes, matching precedence MUST be - // determined in order of the following criteria, continuing on ties: - // - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * The Route appearing first in alphabetical order by - // "{namespace}/{name}". For example, foo/bar is given precedence over - // foo/baz. - // - // If ties still exist within the Route that has been given precedence, - // matching precedence MUST be granted to the first matching rule meeting - // the above criteria. - // - // +optional - // +kubebuilder:validation:MaxItems=8 - Matches []TCPRouteMatch `json:"matches,omitempty"` - - // ForwardTo defines the backend(s) where matching requests should - // be sent. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` -} - -// TCPRouteMatch defines the predicate used to match connections to a -// given action. -type TCPRouteMatch struct { - // ExtensionRef is an optional, implementation-specific extension to the - // "match" behavior. For example, resource "mytcproutematcher" in group - // "networking.acme.io". If the referent cannot be found, the rule is not - // included in the route. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. The gateway - // status for this route should be updated with a condition that describes - // the error more specifically. - // - // Support: Custom - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} - -// +kubebuilder:object:root=true - -// TCPRouteList contains a list of TCPRoute -type TCPRouteList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []TCPRoute `json:"items"` -} diff --git a/apis/v1alpha1/tlsroute_types.go b/apis/v1alpha1/tlsroute_types.go deleted file mode 100644 index 021e5673b4..0000000000 --- a/apis/v1alpha1/tlsroute_types.go +++ /dev/null @@ -1,161 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// The TLSRoute resource is similar to TCPRoute, but can be configured -// to match against TLS-specific metadata. This allows more flexibility -// in matching streams for a given TLS listener. -// -// If you need to forward traffic to a single target for a TLS listener, you -// could choose to use a TCPRoute with a TLS listener. -type TLSRoute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of TLSRoute. - Spec TLSRouteSpec `json:"spec,omitempty"` - - // Status defines the current state of TLSRoute. - Status TLSRouteStatus `json:"status,omitempty"` -} - -// TLSRouteSpec defines the desired state of a TLSRoute resource. -type TLSRouteSpec struct { - // Rules are a list of TLS matchers and actions. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - Rules []TLSRouteRule `json:"rules"` - - // Gateways defines which Gateways can use this Route. - // - // +optional - // +kubebuilder:default={allow: "SameNamespace"} - Gateways *RouteGateways `json:"gateways,omitempty"` -} - -// TLSRouteStatus defines the observed state of TLSRoute -type TLSRouteStatus struct { - RouteStatus `json:",inline"` -} - -// TLSRouteRule is the configuration for a given rule. -type TLSRouteRule struct { - // Matches define conditions used for matching the rule against incoming TLS - // connections. Each match is independent, i.e. this rule will be matched if - // **any** one of the matches is satisfied. If unspecified (i.e. empty), - // this Rule will match all requests for the associated Listener. - // - // Each client request MUST map to a maximum of one route rule. If a request - // matches multiple rules, matching precedence MUST be determined in order - // of the following criteria, continuing on ties: - // - // * The longest matching SNI. - // * The longest matching precise SNI (without a wildcard). This means that - // "b.example.com" should be given precedence over "*.example.com". - // * The most specific match specified by ExtensionRef. Each implementation - // that supports ExtensionRef may have different ways of determining the - // specificity of the referenced extension. - // - // If ties still exist across multiple Routes, matching precedence MUST be - // determined in order of the following criteria, continuing on ties: - // - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * The Route appearing first in alphabetical order by - // "{namespace}/{name}". For example, foo/bar is given precedence over - // foo/baz. - // - // If ties still exist within the Route that has been given precedence, - // matching precedence MUST be granted to the first matching rule meeting - // the above criteria. - // - // +optional - // +kubebuilder:validation:MaxItems=8 - Matches []TLSRouteMatch `json:"matches,omitempty"` - - // ForwardTo defines the backend(s) where matching requests should be - // sent. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` -} - -// TLSRouteMatch defines the predicate used to match connections to a -// given action. -type TLSRouteMatch struct { - // SNIs defines a set of SNI names that should match against the - // SNI attribute of TLS ClientHello message in TLS handshake. - // - // SNI can be "precise" which is a domain name without the terminating - // dot of a network host (e.g. "foo.example.com") or "wildcard", which is - // a domain name prefixed with a single wildcard label (e.g. `*.example.com`). - // The wildcard character `*` must appear by itself as the first DNS label - // and matches only a single label. You cannot have a wildcard label by - // itself (e.g. Host == `*`). - // - // Requests will be matched against the Host field in the following order: - // - // 1. If SNI is precise, the request matches this rule if the SNI in - // ClientHello is equal to one of the defined SNIs. - // 2. If SNI is a wildcard, then the request matches this rule if the - // SNI is to equal to the suffix (removing the first label) of the - // wildcard rule. - // 3. If SNIs is unspecified, all requests associated with the gateway TLS - // listener will match. This can be used to define a default backend - // for a TLS listener. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - SNIs []Hostname `json:"snis,omitempty"` - - // ExtensionRef is an optional, implementation-specific extension to the - // "match" behavior. For example, resource "mytlsroutematcher" in group - // "networking.acme.io". If the referent cannot be found, the rule is not - // included in the route. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. The gateway - // status for this route should be updated with a condition that describes - // the error more specifically. - // - // Support: Custom - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} - -// +kubebuilder:object:root=true - -// TLSRouteList contains a list of TLSRoute -type TLSRouteList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []TLSRoute `json:"items"` -} diff --git a/apis/v1alpha1/udproute_types.go b/apis/v1alpha1/udproute_types.go deleted file mode 100644 index 960014eb42..0000000000 --- a/apis/v1alpha1/udproute_types.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// UDPRoute is a resource that specifies how a Gateway should forward UDP traffic. -type UDPRoute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of UDPRoute. - Spec UDPRouteSpec `json:"spec,omitempty"` - - // Status defines the current state of UDPRoute. - Status UDPRouteStatus `json:"status,omitempty"` -} - -// UDPRouteSpec defines the desired state of UDPRoute. -type UDPRouteSpec struct { - // Rules are a list of UDP matchers and actions. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - Rules []UDPRouteRule `json:"rules"` - - // Gateways defines which Gateways can use this Route. - // - // +optional - // +kubebuilder:default={allow: "SameNamespace"} - Gateways *RouteGateways `json:"gateways,omitempty"` -} - -// UDPRouteStatus defines the observed state of UDPRoute. -type UDPRouteStatus struct { - RouteStatus `json:",inline"` -} - -// UDPRouteRule is the configuration for a given rule. -type UDPRouteRule struct { - // Matches define conditions used for matching the rule against incoming UDP - // connections. Each match is independent, i.e. this rule will be matched if - // **any** one of the matches is satisfied. If unspecified (i.e. empty), - // this Rule will match all requests for the associated Listener. - // - // Each client request MUST map to a maximum of one route rule. If a request - // matches multiple rules, matching precedence MUST be determined in order - // of the following criteria, continuing on ties: - // - // * The most specific match specified by ExtensionRef. Each implementation - // that supports ExtensionRef may have different ways of determining the - // specificity of the referenced extension. - // - // If ties still exist across multiple Routes, matching precedence MUST be - // determined in order of the following criteria, continuing on ties: - // - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * The Route appearing first in alphabetical order by - // "{namespace}/{name}". For example, foo/bar is given precedence over - // foo/baz. - // - // If ties still exist within the Route that has been given precedence, - // matching precedence MUST be granted to the first matching rule meeting - // the above criteria. - // - // +optional - // +kubebuilder:validation:MaxItems=8 - Matches []UDPRouteMatch `json:"matches,omitempty"` - - // ForwardTo defines the backend(s) where matching requests should - // be sent. - // - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` -} - -// UDPRouteMatch defines the predicate used to match packets to a -// given action. -type UDPRouteMatch struct { - // ExtensionRef is an optional, implementation-specific extension to the - // "match" behavior. For example, resource "myudproutematcher" in group - // "networking.acme.io". If the referent cannot be found, the rule is not - // included in the route. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. The gateway - // status for this route should be updated with a condition that describes - // the error more specifically. - // - // Support: Custom - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} - -// +kubebuilder:object:root=true - -// UDPRouteList contains a list of UDPRoute -type UDPRouteList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []UDPRoute `json:"items"` -} diff --git a/apis/v1alpha2/validation/httproute_test.go b/apis/v1alpha2/validation/httproute_test.go index ee2262325b..48833572b5 100644 --- a/apis/v1alpha2/validation/httproute_test.go +++ b/apis/v1alpha2/validation/httproute_test.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - pkgutils "sigs.k8s.io/gateway-api/pkg/util" + utils "sigs.k8s.io/gateway-api/apis/v1alpha2/validation/util" ) func TestValidateHTTPRoute(t *testing.T) { @@ -44,7 +44,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -54,7 +54,7 @@ func TestValidateHTTPRoute(t *testing.T) { BackendRef: gatewayv1a2.BackendRef{ BackendObjectReference: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, Weight: utilpointer.Int32(100), }, @@ -70,7 +70,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -81,7 +81,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8081), + Port: utils.PortNumberPtr(8081), }, }, }, @@ -96,7 +96,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -107,7 +107,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -116,7 +116,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: specialService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -131,7 +131,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -153,7 +153,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -179,7 +179,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -190,7 +190,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -210,7 +210,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -230,7 +230,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: specialService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -245,7 +245,7 @@ func TestValidateHTTPRoute(t *testing.T) { Matches: []gatewayv1a2.HTTPRouteMatch{ { Path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, }, @@ -267,7 +267,7 @@ func TestValidateHTTPRoute(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -452,7 +452,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) { BackendRef: gatewayv1a2.BackendRef{ BackendObjectReference: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, Weight: utilpointer.Int32(100), }, @@ -462,7 +462,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -479,7 +479,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) { BackendRef: gatewayv1a2.BackendRef{ BackendObjectReference: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, Filters: []gatewayv1a2.HTTPRouteFilter{ @@ -488,7 +488,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: testService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -497,7 +497,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) { RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ BackendRef: gatewayv1a2.BackendObjectReference{ Name: specialService, - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }, @@ -526,21 +526,21 @@ func TestValidateHTTPPathMatch(t *testing.T) { }{{ name: "invalid httpRoute prefix", path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/."), }, errCount: 1, }, { name: "invalid httpRoute Exact", path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("Exact"), + Type: utils.PathMatchTypePtr("Exact"), Value: utilpointer.String("/foo/./bar"), }, errCount: 1, }, { name: "invalid httpRoute prefix", path: &gatewayv1a2.HTTPPathMatch{ - Type: pkgutils.PathMatchTypePtr("PathPrefix"), + Type: utils.PathMatchTypePtr("PathPrefix"), Value: utilpointer.String("/"), }, errCount: 0, @@ -557,7 +557,7 @@ func TestValidateHTTPPathMatch(t *testing.T) { BackendRef: gatewayv1a2.BackendRef{ BackendObjectReference: gatewayv1a2.BackendObjectReference{ Name: gatewayv1a2.ObjectName("test"), - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }}, @@ -711,7 +711,7 @@ func TestValidateHTTPRouteTypeMatchesField(t *testing.T) { Kind: new(gatewayv1a2.Kind), Name: "name", Namespace: new(gatewayv1a2.Namespace), - Port: pkgutils.PortNumberPtr(22), + Port: utils.PortNumberPtr(22), }}, }, errCount: 0, @@ -817,7 +817,7 @@ func TestValidateHTTPRouteTypeMatchesField(t *testing.T) { BackendRef: gatewayv1a2.BackendRef{ BackendObjectReference: gatewayv1a2.BackendObjectReference{ Name: gatewayv1a2.ObjectName("test"), - Port: pkgutils.PortNumberPtr(8080), + Port: utils.PortNumberPtr(8080), }, }, }}, diff --git a/pkg/util/utils.go b/apis/v1alpha2/validation/util/utils.go similarity index 100% rename from pkg/util/utils.go rename to apis/v1alpha2/validation/util/utils.go diff --git a/pkg/util/utils_test.go b/apis/v1alpha2/validation/util/utils_test.go similarity index 100% rename from pkg/util/utils_test.go rename to apis/v1alpha2/validation/util/utils_test.go diff --git a/apis/v1beta1/gateway_types.go b/apis/v1beta1/gateway_types.go index 2f7f73da5d..0dbb30f0fb 100644 --- a/apis/v1beta1/gateway_types.go +++ b/apis/v1beta1/gateway_types.go @@ -24,7 +24,6 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api,shortName=gtw // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName` // +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value` // +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status` @@ -454,7 +453,6 @@ type GatewayAddress struct { // Type of the address. // // +optional - // +kubebuilder:validation:Enum=IPAddress;Hostname;NamedAddress // +kubebuilder:default=IPAddress Type *AddressType `json:"type,omitempty"` diff --git a/apis/v1beta1/gatewayclass_types.go b/apis/v1beta1/gatewayclass_types.go index ee1a5c5af0..76c10631ac 100644 --- a/apis/v1beta1/gatewayclass_types.go +++ b/apis/v1beta1/gatewayclass_types.go @@ -25,7 +25,6 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName` // +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status` // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` diff --git a/apis/v1beta1/httproute_types.go b/apis/v1beta1/httproute_types.go index 9e978e8303..a62c91117a 100644 --- a/apis/v1beta1/httproute_types.go +++ b/apis/v1beta1/httproute_types.go @@ -24,7 +24,6 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames` // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` @@ -187,6 +186,12 @@ type HTTPRouteRule struct { // Specifying a core filter multiple times has unspecified or custom // conformance. // + // All filters are expected to be compatible with each other except for the + // URLRewrite and RequestRedirect filters, which may not be combined. If an + // implementation can not support other combinations of filters, they must clearly + // document that limitation. In all cases where incompatible or unsupported + // filters are specified, implementations MUST add a warning condition to status. + // // Support: Core // // +optional @@ -716,6 +721,12 @@ const ( // replaced by the substitution value. For example, a path with a prefix // match of "/foo" and a ReplacePrefixMatch substitution of "/bar" will have // the "/foo" prefix replaced with "/bar" in matching requests. + // + // Note that this matches the behavior of the PathPrefix match type. This + // matches full path elements. A path element refers to the list of labels + // in the path split by the `/` separator. When specified, a trailing `/` is + // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all + // match the prefix `/abc`, but the path `/abcd` would not. PrefixMatchHTTPPathModifier HTTPPathModifierType = "ReplacePrefixMatch" ) @@ -741,6 +752,12 @@ type HTTPPathModifier struct { // match of a request during a rewrite or redirect. For example, a request // to "/foo/bar" with a prefix match of "/foo" would be modified to "/bar". // + // Note that this matches the behavior of the PathPrefix match type. This + // matches full path elements. A path element refers to the list of labels + // in the path split by the `/` separator. When specified, a trailing `/` is + // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all + // match the prefix `/abc`, but the path `/abcd` would not. + // // // +kubebuilder:validation:MaxLength=1024 // +optional diff --git a/apis/v1beta1/validation/doc.go b/apis/v1beta1/validation/doc.go new file mode 100644 index 0000000000..426fea6260 --- /dev/null +++ b/apis/v1beta1/validation/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package validation has functions for validating the correctness of api +// objects and explaining what's wrong with them when they're not valid. +package validation // import "sigs.k8s.io/gateway-api/apis/v1beta1/validation" diff --git a/apis/v1beta1/validation/gateway.go b/apis/v1beta1/validation/gateway.go new file mode 100644 index 0000000000..37505b3b26 --- /dev/null +++ b/apis/v1beta1/validation/gateway.go @@ -0,0 +1,128 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "fmt" + "regexp" + + "k8s.io/apimachinery/pkg/util/validation/field" + + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +var ( + // set of protocols for which we need to validate that hostname is empty + protocolsHostnameInvalid = map[gatewayv1a2.ProtocolType]struct{}{ + gatewayv1a2.TCPProtocolType: {}, + gatewayv1a2.UDPProtocolType: {}, + } + // set of protocols for which TLSConfig shall not be present + protocolsTLSInvalid = map[gatewayv1a2.ProtocolType]struct{}{ + gatewayv1a2.HTTPProtocolType: {}, + gatewayv1a2.UDPProtocolType: {}, + gatewayv1a2.TCPProtocolType: {}, + } + + addressTypesValid = map[gatewayv1a2.AddressType]struct{}{ + gatewayv1a2.HostnameAddressType: {}, + gatewayv1a2.IPAddressType: {}, + } +) + +// ValidateGateway validates gw according to the Gateway API specification. +// For additional details of the Gateway spec, refer to: +// https://gateway-api.sigs.k8s.io/v1beta1/references/spec/#gateway.networking.k8s.io/v1beta1.Gateway +// +// Validation that is not possible with CRD annotations may be added here in the future. +// See https://github.com/kubernetes-sigs/gateway-api/issues/868 for more information. +func ValidateGateway(gw *gatewayv1a2.Gateway) field.ErrorList { + return validateGatewaySpec(&gw.Spec, field.NewPath("spec")) +} + +// validateGatewaySpec validates whether required fields of spec are set according to the +// Gateway API specification. +func validateGatewaySpec(spec *gatewayv1a2.GatewaySpec, path *field.Path) field.ErrorList { + var errs field.ErrorList + errs = append(errs, validateGatewayListeners(spec.Listeners, path.Child("listeners"))...) + errs = append(errs, validateAddresses(spec.Addresses, path.Child("addresses"))...) + return errs +} + +// validateGatewayListeners validates whether required fields of listeners are set according +// to the Gateway API specification. +func validateGatewayListeners(listeners []gatewayv1a2.Listener, path *field.Path) field.ErrorList { + var errs field.ErrorList + errs = append(errs, validateListenerTLSConfig(listeners, path)...) + errs = append(errs, validateListenerHostname(listeners, path)...) + return errs +} + +func validateListenerTLSConfig(listeners []gatewayv1a2.Listener, path *field.Path) field.ErrorList { + var errs field.ErrorList + for i, l := range listeners { + if isProtocolInSubset(l.Protocol, protocolsTLSInvalid) && l.TLS != nil { + errs = append(errs, field.Forbidden(path.Index(i).Child("tls"), fmt.Sprintf("should be empty for protocol %v", l.Protocol))) + } + } + return errs +} + +func isProtocolInSubset(protocol gatewayv1a2.ProtocolType, set map[gatewayv1a2.ProtocolType]struct{}) bool { + _, ok := set[protocol] + return ok +} + +// validateListenerHostname validates each listener hostname +// should be empty in case protocol is TCP or UDP +func validateListenerHostname(listeners []gatewayv1a2.Listener, path *field.Path) field.ErrorList { + var errs field.ErrorList + for i, h := range listeners { + if isProtocolInSubset(h.Protocol, protocolsHostnameInvalid) && h.Hostname != nil { + errs = append(errs, field.Forbidden(path.Index(i).Child("hostname"), fmt.Sprintf("should be empty for protocol %v", h.Protocol))) + } + } + return errs +} + +// domainPrefixedStringRegex is a regex used in validation to determine whether +// a provided string is a domain-prefixed string. Domain-prefixed strings are used +// to indicate custom (implementation-specific) address types. +var domainPrefixedStringRegex = regexp.MustCompile(`^([a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\/[a-zA-Z0-9]+$`) + +// validateAddresses validates each listener address +// if there are addresses set. Otherwise, returns no error. +func validateAddresses(addresses []gatewayv1a2.GatewayAddress, path *field.Path) field.ErrorList { + var errs field.ErrorList + + for i, a := range addresses { + if a.Type == nil { + continue + } + _, ok := addressTypesValid[*a.Type] + if !ok { + // Found something that's not one of the upstream AddressTypes + // Next, check for a domain-prefixed string + match := domainPrefixedStringRegex.Match([]byte(*a.Type)) + if !match { + errs = append(errs, field.Invalid(path.Index(i).Child("type"), a.Type, "should either be a defined constant or a domain-prefixed string (example.com/Type)")) + } + } + + } + return errs +} diff --git a/apis/v1beta1/validation/gateway_test.go b/apis/v1beta1/validation/gateway_test.go new file mode 100644 index 0000000000..5418b67fb1 --- /dev/null +++ b/apis/v1beta1/validation/gateway_test.go @@ -0,0 +1,131 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +func TestValidateGateway(t *testing.T) { + listeners := []gatewayv1a2.Listener{ + { + Hostname: nil, + }, + } + addresses := []gatewayv1a2.GatewayAddress{ + { + Type: nil, + }, + } + baseGateway := gatewayv1a2.Gateway{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: metav1.NamespaceDefault, + }, + Spec: gatewayv1a2.GatewaySpec{ + GatewayClassName: "foo", + Listeners: listeners, + Addresses: addresses, + }, + } + tlsConfig := gatewayv1a2.GatewayTLSConfig{} + + testCases := map[string]struct { + mutate func(gw *gatewayv1a2.Gateway) + expectErrsOnFields []string + }{ + "tls config present with http protocol": { + mutate: func(gw *gatewayv1a2.Gateway) { + gw.Spec.Listeners[0].Protocol = gatewayv1a2.HTTPProtocolType + gw.Spec.Listeners[0].TLS = &tlsConfig + }, + expectErrsOnFields: []string{"spec.listeners[0].tls"}, + }, + "tls config present with tcp protocol": { + mutate: func(gw *gatewayv1a2.Gateway) { + gw.Spec.Listeners[0].Protocol = gatewayv1a2.TCPProtocolType + gw.Spec.Listeners[0].TLS = &tlsConfig + }, + expectErrsOnFields: []string{"spec.listeners[0].tls"}, + }, + "hostname present with tcp protocol": { + mutate: func(gw *gatewayv1a2.Gateway) { + hostname := gatewayv1a2.Hostname("foo.bar.com") + gw.Spec.Listeners[0].Hostname = &hostname + gw.Spec.Listeners[0].Protocol = gatewayv1a2.TCPProtocolType + }, + expectErrsOnFields: []string{"spec.listeners[0].hostname"}, + }, + "hostname present with udp protocol": { + mutate: func(gw *gatewayv1a2.Gateway) { + hostname := gatewayv1a2.Hostname("foo.bar.com") + gw.Spec.Listeners[0].Hostname = &hostname + gw.Spec.Listeners[0].Protocol = gatewayv1a2.UDPProtocolType + }, + expectErrsOnFields: []string{"spec.listeners[0].hostname"}, + }, + "Address present with IPAddress": { + mutate: func(gw *gatewayv1a2.Gateway) { + ip := gatewayv1a2.IPAddressType + gw.Spec.Addresses[0].Type = &ip + }, + expectErrsOnFields: []string{}, + }, + "Address present with Hostname": { + mutate: func(gw *gatewayv1a2.Gateway) { + host := gatewayv1a2.HostnameAddressType + gw.Spec.Addresses[0].Type = &host + }, + expectErrsOnFields: []string{}, + }, + "Address present with example.com/CustomAddress": { + mutate: func(gw *gatewayv1a2.Gateway) { + customAddress := gatewayv1a2.AddressType("example.com/CustomAddress") + gw.Spec.Addresses[0].Type = &customAddress + }, + expectErrsOnFields: []string{}, + }, + "Address present with invalid Type": { + mutate: func(gw *gatewayv1a2.Gateway) { + customAddress := gatewayv1a2.AddressType("CustomAddress") + gw.Spec.Addresses[0].Type = &customAddress + }, + expectErrsOnFields: []string{"spec.addresses[0].type"}, + }, + } + + for name, tc := range testCases { + tc := tc + t.Run(name, func(t *testing.T) { + gw := baseGateway.DeepCopy() + tc.mutate(gw) + errs := ValidateGateway(gw) + if len(tc.expectErrsOnFields) != len(errs) { + t.Fatalf("Expected %d errors, got %d errors: %v", len(tc.expectErrsOnFields), len(errs), errs) + } + for i, err := range errs { + if err.Field != tc.expectErrsOnFields[i] { + t.Errorf("Expected error on field: %s, got: %s", tc.expectErrsOnFields[i], err.Error()) + } + } + }) + } +} diff --git a/apis/v1beta1/validation/gatewayclass.go b/apis/v1beta1/validation/gatewayclass.go new file mode 100644 index 0000000000..83da93b072 --- /dev/null +++ b/apis/v1beta1/validation/gatewayclass.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "k8s.io/apimachinery/pkg/util/validation/field" + + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// ValidateGatewayClassUpdate validates an update to oldClass according to the +// Gateway API specification. For additional details of the GatewayClass spec, refer to: +// https://gateway-api.sigs.k8s.io/v1beta1/references/spec/#gateway.networking.k8s.io/v1beta1.GatewayClass +func ValidateGatewayClassUpdate(oldClass, newClass *gatewayv1a2.GatewayClass) field.ErrorList { + if oldClass == nil || newClass == nil { + return nil + } + var errs field.ErrorList + if oldClass.Spec.ControllerName != newClass.Spec.ControllerName { + errs = append(errs, field.Invalid(field.NewPath("spec.controllerName"), newClass.Spec.ControllerName, + "cannot update an immutable field")) + } + return errs +} diff --git a/apis/v1beta1/validation/gatewayclass_test.go b/apis/v1beta1/validation/gatewayclass_test.go new file mode 100644 index 0000000000..02b2c30f88 --- /dev/null +++ b/apis/v1beta1/validation/gatewayclass_test.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "reflect" + "testing" + + "k8s.io/apimachinery/pkg/util/validation/field" + + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +func TestValidateGatewayClassUpdate(t *testing.T) { + type args struct { + oldClass *gatewayv1a2.GatewayClass + newClass *gatewayv1a2.GatewayClass + } + tests := []struct { + name string + args args + want field.ErrorList + }{ + { + name: "changing parameters reference is allowed", + args: args{ + oldClass: &gatewayv1a2.GatewayClass{ + Spec: gatewayv1a2.GatewayClassSpec{ + ControllerName: "foo", + }, + }, + newClass: &gatewayv1a2.GatewayClass{ + Spec: gatewayv1a2.GatewayClassSpec{ + ControllerName: "foo", + ParametersRef: &gatewayv1a2.ParametersReference{ + Group: "example.com", + Kind: "GatewayClassConfig", + Name: "foo", + }, + }, + }, + }, + want: nil, + }, + { + name: "changing controller field results in an error", + args: args{ + oldClass: &gatewayv1a2.GatewayClass{ + Spec: gatewayv1a2.GatewayClassSpec{ + ControllerName: "example.com/gateway", + }, + }, + newClass: &gatewayv1a2.GatewayClass{ + Spec: gatewayv1a2.GatewayClassSpec{ + ControllerName: "example.org/gateway", + }, + }, + }, + want: field.ErrorList{ + { + Type: field.ErrorTypeInvalid, + Field: "spec.controllerName", + Detail: "cannot update an immutable field", + BadValue: gatewayv1a2.GatewayController("example.org/gateway"), + }, + }, + }, + { + name: "nil input result in no errors", + args: args{ + oldClass: nil, + newClass: nil, + }, + want: nil, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + if got := ValidateGatewayClassUpdate(tc.args.oldClass, tc.args.newClass); !reflect.DeepEqual(got, tc.want) { + t.Errorf("ValidateGatewayClassUpdate() = %v, want %v", got, tc.want) + } + }) + } +} diff --git a/apis/v1beta1/validation/httproute.go b/apis/v1beta1/validation/httproute.go new file mode 100644 index 0000000000..ca91c01b16 --- /dev/null +++ b/apis/v1beta1/validation/httproute.go @@ -0,0 +1,234 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "fmt" + "strings" + + "k8s.io/apimachinery/pkg/util/validation/field" + + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +var ( + // repeatableHTTPRouteFilters are filter types that can are allowed to be + // repeated multiple times in a rule. + repeatableHTTPRouteFilters = []gatewayv1a2.HTTPRouteFilterType{ + gatewayv1a2.HTTPRouteFilterExtensionRef, + } + + invalidPathSequences = []string{"//", "/./", "/../", "%2f", "%2F", "#"} + invalidPathSuffixes = []string{"/..", "/."} +) + +// ValidateHTTPRoute validates HTTPRoute according to the Gateway API specification. +// For additional details of the HTTPRoute spec, refer to: +// https://gateway-api.sigs.k8s.io/v1beta1/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRoute +func ValidateHTTPRoute(route *gatewayv1a2.HTTPRoute) field.ErrorList { + return validateHTTPRouteSpec(&route.Spec, field.NewPath("spec")) +} + +// validateHTTPRouteSpec validates that required fields of spec are set according to the +// HTTPRoute specification. +func validateHTTPRouteSpec(spec *gatewayv1a2.HTTPRouteSpec, path *field.Path) field.ErrorList { + var errs field.ErrorList + for i, rule := range spec.Rules { + errs = append(errs, validateHTTPRouteFilters(rule.Filters, rule.Matches, path.Child("rules").Index(i))...) + for j, backendRef := range rule.BackendRefs { + errs = append(errs, validateHTTPRouteFilters(backendRef.Filters, rule.Matches, path.Child("rules").Index(i).Child("backendsrefs").Index(j))...) + } + for j, m := range rule.Matches { + if m.Path != nil { + errs = append(errs, validateHTTPPathMatch(m.Path, path.Child("matches").Index(j).Child("path"))...) + } + } + } + errs = append(errs, validateHTTPRouteBackendServicePorts(spec.Rules, path.Child("rules"))...) + return errs +} + +// validateHTTPRouteBackendServicePorts validates that v1.Service backends always have a port. +func validateHTTPRouteBackendServicePorts(rules []gatewayv1a2.HTTPRouteRule, path *field.Path) field.ErrorList { + var errs field.ErrorList + + for i, rule := range rules { + path = path.Index(i).Child("backendRefs") + for i, ref := range rule.BackendRefs { + if ref.BackendObjectReference.Group != nil && + *ref.BackendObjectReference.Group != "" { + continue + } + + if ref.BackendObjectReference.Kind != nil && + *ref.BackendObjectReference.Kind != "Service" { + continue + } + + if ref.BackendObjectReference.Port == nil { + errs = append(errs, field.Required(path.Index(i).Child("port"), "missing port for Service reference")) + } + } + } + + return errs +} + +// validateHTTPRouteFilters validates that a list of core and extended filters +// is used at most once and that the filter type matches its value +func validateHTTPRouteFilters(filters []gatewayv1a2.HTTPRouteFilter, matches []gatewayv1a2.HTTPRouteMatch, path *field.Path) field.ErrorList { + var errs field.ErrorList + counts := map[gatewayv1a2.HTTPRouteFilterType]int{} + + for i, filter := range filters { + counts[filter.Type]++ + if filter.RequestRedirect != nil && filter.RequestRedirect.Path != nil { + errs = append(errs, validateHTTPPathModifier(*filter.RequestRedirect.Path, matches, path.Index(i).Child("requestRedirect", "path"))...) + } + if filter.URLRewrite != nil && filter.URLRewrite.Path != nil { + errs = append(errs, validateHTTPPathModifier(*filter.URLRewrite.Path, matches, path.Index(i).Child("urlRewrite", "path"))...) + } + errs = append(errs, validateHTTPRouteFilterTypeMatchesValue(filter, path.Index(i))...) + } + // custom filters don't have any validation + for _, key := range repeatableHTTPRouteFilters { + delete(counts, key) + } + + if counts[gatewayv1a2.HTTPRouteFilterRequestRedirect] > 0 && counts[gatewayv1a2.HTTPRouteFilterURLRewrite] > 0 { + errs = append(errs, field.Invalid(path.Child("filters"), gatewayv1a2.HTTPRouteFilterRequestRedirect, "Redirect and Rewrite filters cannot be defined in the same list of filters")) + } + + for filterType, count := range counts { + if count > 1 { + errs = append(errs, field.Invalid(path.Child("filters"), filterType, "cannot be used multiple times in the same rule")) + } + } + return errs +} + +// webhook validation of HTTPPathMatch +func validateHTTPPathMatch(path *gatewayv1a2.HTTPPathMatch, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if path.Type == nil { + return append(allErrs, field.Required(fldPath.Child("type"), "must be specified")) + } + + if path.Value == nil { + return append(allErrs, field.Required(fldPath.Child("value"), "must be specified")) + } + + switch *path.Type { + case gatewayv1a2.PathMatchExact, gatewayv1a2.PathMatchPathPrefix: + if !strings.HasPrefix(*path.Value, "/") { + allErrs = append(allErrs, field.Invalid(fldPath.Child("value"), *path.Value, "must be an absolute path")) + } + if len(*path.Value) > 0 { + for _, invalidSeq := range invalidPathSequences { + if strings.Contains(*path.Value, invalidSeq) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("value"), *path.Value, fmt.Sprintf("must not contain %q", invalidSeq))) + } + } + + for _, invalidSuff := range invalidPathSuffixes { + if strings.HasSuffix(*path.Value, invalidSuff) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("value"), *path.Value, fmt.Sprintf("cannot end with '%s'", invalidSuff))) + } + } + } + case gatewayv1a2.PathMatchRegularExpression: + default: + pathTypes := []string{string(gatewayv1a2.PathMatchExact), string(gatewayv1a2.PathMatchPathPrefix), string(gatewayv1a2.PathMatchRegularExpression)} + allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), *path.Type, pathTypes)) + } + return allErrs +} + +// validateHTTPRouteFilterTypeMatchesValue validates that only the expected fields are +//// set for the specified filter type. +func validateHTTPRouteFilterTypeMatchesValue(filter gatewayv1a2.HTTPRouteFilter, path *field.Path) field.ErrorList { + var errs field.ErrorList + if filter.ExtensionRef != nil && filter.Type != gatewayv1a2.HTTPRouteFilterExtensionRef { + errs = append(errs, field.Invalid(path, filter.ExtensionRef, "must be nil if the HTTPRouteFilter.Type is not ExtensionRef")) + } + if filter.ExtensionRef == nil && filter.Type == gatewayv1a2.HTTPRouteFilterExtensionRef { + errs = append(errs, field.Required(path, "filter.ExtensionRef must be specified for ExtensionRef HTTPRouteFilter.Type")) + } + if filter.RequestHeaderModifier != nil && filter.Type != gatewayv1a2.HTTPRouteFilterRequestHeaderModifier { + errs = append(errs, field.Invalid(path, filter.RequestHeaderModifier, "must be nil if the HTTPRouteFilter.Type is not RequestHeaderModifier")) + } + if filter.RequestHeaderModifier == nil && filter.Type == gatewayv1a2.HTTPRouteFilterRequestHeaderModifier { + errs = append(errs, field.Required(path, "filter.RequestHeaderModifier must be specified for RequestHeaderModifier HTTPRouteFilter.Type")) + } + if filter.RequestMirror != nil && filter.Type != gatewayv1a2.HTTPRouteFilterRequestMirror { + errs = append(errs, field.Invalid(path, filter.RequestMirror, "must be nil if the HTTPRouteFilter.Type is not RequestMirror")) + } + if filter.RequestMirror == nil && filter.Type == gatewayv1a2.HTTPRouteFilterRequestMirror { + errs = append(errs, field.Required(path, "filter.RequestMirror must be specified for RequestMirror HTTPRouteFilter.Type")) + } + if filter.RequestRedirect != nil && filter.Type != gatewayv1a2.HTTPRouteFilterRequestRedirect { + errs = append(errs, field.Invalid(path, filter.RequestRedirect, "must be nil if the HTTPRouteFilter.Type is not RequestRedirect")) + } + if filter.RequestRedirect == nil && filter.Type == gatewayv1a2.HTTPRouteFilterRequestRedirect { + errs = append(errs, field.Required(path, "filter.RequestRedirect must be specified for RequestRedirect HTTPRouteFilter.Type")) + } + if filter.URLRewrite != nil && filter.Type != gatewayv1a2.HTTPRouteFilterURLRewrite { + errs = append(errs, field.Invalid(path, filter.URLRewrite, "must be nil if the HTTPRouteFilter.Type is not URLRewrite")) + } + if filter.URLRewrite == nil && filter.Type == gatewayv1a2.HTTPRouteFilterURLRewrite { + errs = append(errs, field.Required(path, "filter.URLRewrite must be specified for URLRewrite HTTPRouteFilter.Type")) + } + return errs +} + +// validateHTTPPathModifier validates that only the expected fields are set in a +// path modifier. +func validateHTTPPathModifier(modifier gatewayv1a2.HTTPPathModifier, matches []gatewayv1a2.HTTPRouteMatch, path *field.Path) field.ErrorList { + var errs field.ErrorList + if modifier.ReplaceFullPath != nil && modifier.Type != gatewayv1a2.FullPathHTTPPathModifier { + errs = append(errs, field.Invalid(path, modifier.ReplaceFullPath, "must be nil if the HTTPRouteFilter.Type is not ReplaceFullPath")) + } + if modifier.ReplaceFullPath == nil && modifier.Type == gatewayv1a2.FullPathHTTPPathModifier { + errs = append(errs, field.Invalid(path, modifier.ReplaceFullPath, "must not be nil if the HTTPRouteFilter.Type is ReplaceFullPath")) + } + if modifier.ReplacePrefixMatch != nil && modifier.Type != gatewayv1a2.PrefixMatchHTTPPathModifier { + errs = append(errs, field.Invalid(path, modifier.ReplacePrefixMatch, "must be nil if the HTTPRouteFilter.Type is not ReplacePrefixMatch")) + } + if modifier.ReplacePrefixMatch == nil && modifier.Type == gatewayv1a2.PrefixMatchHTTPPathModifier { + errs = append(errs, field.Invalid(path, modifier.ReplacePrefixMatch, "must not be nil if the HTTPRouteFilter.Type is ReplacePrefixMatch")) + } + + if modifier.Type == gatewayv1a2.PrefixMatchHTTPPathModifier && modifier.ReplacePrefixMatch != nil { + if !hasExactlyOnePrefixMatch(matches) { + errs = append(errs, field.Invalid(path, modifier.ReplacePrefixMatch, "exactly one PathPrefix match must be specified to use this path modifier")) + } + } + return errs +} + +func hasExactlyOnePrefixMatch(matches []gatewayv1a2.HTTPRouteMatch) bool { + if len(matches) != 1 || matches[0].Path == nil { + return false + } + pathMatchType := matches[0].Path.Type + if *pathMatchType != gatewayv1a2.PathMatchPathPrefix { + return false + } + + return true +} diff --git a/apis/v1beta1/validation/httproute_test.go b/apis/v1beta1/validation/httproute_test.go new file mode 100644 index 0000000000..e951eb1027 --- /dev/null +++ b/apis/v1beta1/validation/httproute_test.go @@ -0,0 +1,833 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "testing" + + "k8s.io/apimachinery/pkg/util/validation/field" + utilpointer "k8s.io/utils/pointer" + + "sigs.k8s.io/gateway-api/apis/v1beta1" + gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1beta1" + utils "sigs.k8s.io/gateway-api/apis/v1beta1/validation/util" +) + +func TestValidateHTTPRoute(t *testing.T) { + testService := gatewayv1a2.ObjectName("test-service") + specialService := gatewayv1a2.ObjectName("special-service") + pathPrefixMatchType := gatewayv1a2.PathMatchPathPrefix + + tests := []struct { + name string + rules []gatewayv1a2.HTTPRouteRule + errCount int + }{{ + name: "valid httpRoute with no filters", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + BackendRefs: []gatewayv1a2.HTTPBackendRef{ + { + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + Weight: utilpointer.Int32(100), + }, + }, + }, + }, + }, + }, { + name: "valid httpRoute with 1 filter", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8081), + }, + }, + }, + }, + }, + }, + }, { + name: "invalid httpRoute with 2 extended filters", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: specialService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + }, + }, + }, + }, { + name: "invalid httpRoute with mix of filters and one duplicate", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Set: []gatewayv1a2.HTTPHeader{ + { + Name: "special-header", + Value: "foo", + }, + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Add: []gatewayv1a2.HTTPHeader{ + { + Name: "my-header", + Value: "bar", + }, + }, + }, + }, + }, + }, + }, + }, { + name: "invalid httpRoute with multiple duplicate filters", + errCount: 2, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Set: []gatewayv1a2.HTTPHeader{ + { + Name: "special-header", + Value: "foo", + }, + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Add: []gatewayv1a2.HTTPHeader{ + { + Name: "my-header", + Value: "bar", + }, + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: specialService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + }, + }, + }, + }, { + name: "valid httpRoute with duplicate ExtensionRef filters", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Matches: []gatewayv1a2.HTTPRouteMatch{ + { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Set: []gatewayv1a2.HTTPHeader{ + { + Name: "special-header", + Value: "foo", + }, + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: "ExtensionRef", + ExtensionRef: &gatewayv1a2.LocalObjectReference{ + Kind: "Service", + Name: "test", + }, + }, + { + Type: "ExtensionRef", + ExtensionRef: &gatewayv1a2.LocalObjectReference{ + Kind: "Service", + Name: "test", + }, + }, + { + Type: "ExtensionRef", + ExtensionRef: &gatewayv1a2.LocalObjectReference{ + Kind: "Service", + Name: "test", + }, + }, + }, + }, + }, + }, { + name: "valid redirect path modifier", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{ + { + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + RequestRedirect: &gatewayv1a2.HTTPRequestRedirectFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.FullPathHTTPPathModifier, + ReplaceFullPath: utilpointer.String("foo"), + }, + }, + }, + }, + }, + }, + }, { + name: "redirect path modifier with type mismatch", + errCount: 2, + rules: []gatewayv1a2.HTTPRouteRule{{ + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + RequestRedirect: &gatewayv1a2.HTTPRequestRedirectFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplaceFullPath: utilpointer.String("foo"), + }, + }, + }}, + }}, + }, { + name: "valid rewrite path modifier", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{{ + Matches: []gatewayv1a2.HTTPRouteMatch{{ + Path: &gatewayv1a2.HTTPPathMatch{ + Type: &pathPrefixMatchType, + Value: utilpointer.String("/bar"), + }, + }}, + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }}, + }}, + }, { + name: "rewrite path modifier missing path match", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{{ + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }}, + }}, + }, { + name: "rewrite path too many matches", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{{ + Matches: []gatewayv1a2.HTTPRouteMatch{{ + Path: &gatewayv1a2.HTTPPathMatch{ + Type: &pathPrefixMatchType, + Value: utilpointer.String("/foo"), + }, + }, { + Path: &gatewayv1a2.HTTPPathMatch{ + Type: &pathPrefixMatchType, + Value: utilpointer.String("/bar"), + }, + }}, + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }}, + }}, + }, { + name: "redirect path modifier with type mismatch", + errCount: 2, + rules: []gatewayv1a2.HTTPRouteRule{{ + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.FullPathHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }}, + }}, + }, { + name: "rewrite and redirect filters combined (invalid)", + errCount: 3, + rules: []gatewayv1a2.HTTPRouteRule{{ + Filters: []gatewayv1a2.HTTPRouteFilter{{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }, { + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + RequestRedirect: &gatewayv1a2.HTTPRequestRedirectFilter{ + Path: &gatewayv1a2.HTTPPathModifier{ + Type: gatewayv1a2.PrefixMatchHTTPPathModifier, + ReplacePrefixMatch: utilpointer.String("foo"), + }, + }, + }}, + }}, + }} + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + var errs field.ErrorList + route := gatewayv1a2.HTTPRoute{Spec: gatewayv1a2.HTTPRouteSpec{Rules: tc.rules}} + errs = ValidateHTTPRoute(&route) + if len(errs) != tc.errCount { + t.Errorf("got %d errors, want %d errors: %s", len(errs), tc.errCount, errs) + } + }) + } +} + +func TestValidateHTTPBackendUniqueFilters(t *testing.T) { + var testService v1beta1.ObjectName = "testService" + var specialService v1beta1.ObjectName = "specialService" + tests := []struct { + name string + rules []gatewayv1a2.HTTPRouteRule + errCount int + }{{ + name: "valid httpRoute Rules backendref filters", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{ + { + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + Weight: utilpointer.Int32(100), + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + }, + }, + }, + }}, + }, { + name: "invalid httpRoute Rules duplicate mirror filter", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{ + { + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + Filters: []gatewayv1a2.HTTPRouteFilter{ + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + { + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ + BackendRef: gatewayv1a2.BackendObjectReference{ + Name: specialService, + Port: utils.PortNumberPtr(8080), + }, + }, + }, + }, + }, + }, + }}, + }} + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + route := gatewayv1a2.HTTPRoute{Spec: gatewayv1a2.HTTPRouteSpec{Rules: tc.rules}} + errs := ValidateHTTPRoute(&route) + if len(errs) != tc.errCount { + t.Errorf("got %d errors, want %d errors: %s", len(errs), tc.errCount, errs) + } + }) + } +} + +func TestValidateHTTPPathMatch(t *testing.T) { + tests := []struct { + name string + path *gatewayv1a2.HTTPPathMatch + errCount int + }{{ + name: "invalid httpRoute prefix", + path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/."), + }, + errCount: 1, + }, { + name: "invalid httpRoute Exact", + path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("Exact"), + Value: utilpointer.String("/foo/./bar"), + }, + errCount: 1, + }, { + name: "invalid httpRoute prefix", + path: &gatewayv1a2.HTTPPathMatch{ + Type: utils.PathMatchTypePtr("PathPrefix"), + Value: utilpointer.String("/"), + }, + errCount: 0, + }} + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + route := gatewayv1a2.HTTPRoute{Spec: gatewayv1a2.HTTPRouteSpec{ + Rules: []gatewayv1a2.HTTPRouteRule{{ + Matches: []gatewayv1a2.HTTPRouteMatch{{ + Path: tc.path, + }}, + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: gatewayv1a2.ObjectName("test"), + Port: utils.PortNumberPtr(8080), + }, + }, + }}, + }}, + }} + + errs := ValidateHTTPRoute(&route) + if len(errs) != tc.errCount { + t.Errorf("got %d errors, want %d errors: %s", len(errs), tc.errCount, errs) + } + }) + } +} + +func TestValidateServicePort(t *testing.T) { + portPtr := func(n int) *gatewayv1a2.PortNumber { + p := gatewayv1a2.PortNumber(n) + return &p + } + + groupPtr := func(g string) *gatewayv1a2.Group { + p := gatewayv1a2.Group(g) + return &p + } + + kindPtr := func(k string) *gatewayv1a2.Kind { + p := gatewayv1a2.Kind(k) + return &p + } + + tests := []struct { + name string + rules []gatewayv1a2.HTTPRouteRule + errCount int + }{{ + name: "default groupkind with port", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: "backend", + Port: portPtr(99), + }, + }, + }}, + }}, + }, { + name: "default groupkind with no port", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: "backend", + }, + }, + }}, + }}, + }, { + name: "explicit service with port", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Group: groupPtr(""), + Kind: kindPtr("Service"), + Name: "backend", + Port: portPtr(99), + }, + }, + }}, + }}, + }, { + name: "explicit service with no port", + errCount: 1, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Group: groupPtr(""), + Kind: kindPtr("Service"), + Name: "backend", + }, + }, + }}, + }}, + }, { + name: "explicit ref with no port", + errCount: 0, + rules: []gatewayv1a2.HTTPRouteRule{{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Group: groupPtr("foo.example.com"), + Kind: kindPtr("Foo"), + Name: "backend", + }, + }, + }}, + }}, + }} + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + route := gatewayv1a2.HTTPRoute{Spec: gatewayv1a2.HTTPRouteSpec{Rules: tc.rules}} + errs := ValidateHTTPRoute(&route) + if len(errs) != tc.errCount { + t.Errorf("got %d errors, want %d errors: %s", len(errs), tc.errCount, errs) + } + }) + } +} + +func TestValidateHTTPRouteTypeMatchesField(t *testing.T) { + tests := []struct { + name string + routeFilter gatewayv1a2.HTTPRouteFilter + errCount int + }{{ + name: "valid HTTPRouteFilterRequestHeaderModifier route filter", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{ + Set: []gatewayv1a2.HTTPHeader{{Name: "name"}}, + Add: []gatewayv1a2.HTTPHeader{{Name: "add"}}, + Remove: []string{"remove"}, + }, + }, + errCount: 0, + }, { + name: "invalid HTTPRouteFilterRequestHeaderModifier type filter with non-matching field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{}, + }, + errCount: 2, + }, { + name: "invalid HTTPRouteFilterRequestHeaderModifier type filter with empty value field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestHeaderModifier, + }, + errCount: 1, + }, { + name: "valid HTTPRouteFilterRequestMirror route filter", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{BackendRef: gatewayv1a2.BackendObjectReference{ + Group: new(gatewayv1a2.Group), + Kind: new(gatewayv1a2.Kind), + Name: "name", + Namespace: new(gatewayv1a2.Namespace), + Port: utils.PortNumberPtr(22), + }}, + }, + errCount: 0, + }, { + name: "invalid HTTPRouteFilterRequestMirror type filter with non-matching field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + RequestHeaderModifier: &gatewayv1a2.HTTPRequestHeaderFilter{}, + }, + errCount: 2, + }, { + name: "invalid HTTPRouteFilterRequestMirror type filter with empty value field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestMirror, + }, + errCount: 1, + }, { + name: "valid HTTPRouteFilterRequestRedirect route filter", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + RequestRedirect: &gatewayv1a2.HTTPRequestRedirectFilter{ + Scheme: new(string), + Hostname: new(gatewayv1a2.PreciseHostname), + Path: &gatewayv1a2.HTTPPathModifier{}, + Port: new(gatewayv1a2.PortNumber), + StatusCode: new(int), + }, + }, + errCount: 0, + }, { + name: "invalid HTTPRouteFilterRequestRedirect type filter with non-matching field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{}, + }, + errCount: 2, + }, { + name: "invalid HTTPRouteFilterRequestRedirect type filter with empty value field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterRequestRedirect, + }, + errCount: 1, + }, { + name: "valid HTTPRouteFilterExtensionRef filter", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterExtensionRef, + ExtensionRef: &gatewayv1a2.LocalObjectReference{ + Group: "group", + Kind: "kind", + Name: "name", + }, + }, + errCount: 0, + }, { + name: "invalid HTTPRouteFilterExtensionRef type filter with non-matching field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterExtensionRef, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{}, + }, + errCount: 2, + }, { + name: "invalid HTTPRouteFilterExtensionRef type filter with empty value field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterExtensionRef, + }, + errCount: 1, + }, { + name: "valid HTTPRouteFilterURLRewrite route filter", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + URLRewrite: &gatewayv1a2.HTTPURLRewriteFilter{ + Hostname: new(gatewayv1a2.PreciseHostname), + Path: &gatewayv1a2.HTTPPathModifier{}, + }, + }, + errCount: 0, + }, { + name: "invalid HTTPRouteFilterURLRewrite type filter with non-matching field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{}, + }, + errCount: 2, + }, { + name: "invalid HTTPRouteFilterURLRewrite type filter with empty value field", + routeFilter: gatewayv1a2.HTTPRouteFilter{ + Type: gatewayv1a2.HTTPRouteFilterURLRewrite, + }, + errCount: 1, + }, { + name: "empty type filter is valid (caught by CRD validation)", + routeFilter: gatewayv1a2.HTTPRouteFilter{}, + errCount: 0, + }} + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + route := gatewayv1a2.HTTPRoute{ + Spec: gatewayv1a2.HTTPRouteSpec{ + Rules: []gatewayv1a2.HTTPRouteRule{{ + Filters: []gatewayv1a2.HTTPRouteFilter{tc.routeFilter}, + BackendRefs: []gatewayv1a2.HTTPBackendRef{{ + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: gatewayv1a2.ObjectName("test"), + Port: utils.PortNumberPtr(8080), + }, + }, + }}, + }}, + }, + } + errs := ValidateHTTPRoute(&route) + if len(errs) != tc.errCount { + t.Errorf("got %d errors, want %d errors: %s", len(errs), tc.errCount, errs) + } + }) + } +} diff --git a/apis/v1beta1/validation/util/utils.go b/apis/v1beta1/validation/util/utils.go new file mode 100644 index 0000000000..52408574ad --- /dev/null +++ b/apis/v1beta1/validation/util/utils.go @@ -0,0 +1,33 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + gatewayv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// PathMatchTypePtr translates a string to *PathMatchType +func PathMatchTypePtr(s string) *gatewayv1b1.PathMatchType { + result := gatewayv1b1.PathMatchType(s) + return &result +} + +// PortNumberPtr translates an int to a *PortNumber +func PortNumberPtr(p int) *gatewayv1b1.PortNumber { + result := gatewayv1b1.PortNumber(p) + return &result +} diff --git a/apis/v1beta1/validation/util/utils_test.go b/apis/v1beta1/validation/util/utils_test.go new file mode 100644 index 0000000000..9e0deb62da --- /dev/null +++ b/apis/v1beta1/validation/util/utils_test.go @@ -0,0 +1,104 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "testing" + + gatewayv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +func Test_PortNumberPtr(t *testing.T) { + var exportedPort65535 gatewayv1b1.PortNumber = 65535 + var exportedPort1 gatewayv1b1.PortNumber = 1 + var exportedPort0 gatewayv1b1.PortNumber + var exportedPort65536 gatewayv1b1.PortNumber = 65536 + + portNumberPtrTests := []struct { + name string + port int + expectedPort *gatewayv1b1.PortNumber + }{ + { + name: "invalid port number", + port: 0, + expectedPort: &exportedPort0, + }, + { + name: "valid port number", + port: 65535, + expectedPort: &exportedPort65535, + }, + { + name: "invalid port number", + port: 65536, + expectedPort: &exportedPort65536, + }, + { + name: "valid port number", + port: 1, + expectedPort: &exportedPort1, + }, + } + + for _, tc := range portNumberPtrTests { + t.Run(tc.name, func(t *testing.T) { + port := PortNumberPtr(tc.port) + if port == nil || tc.expectedPort == nil { + if port != tc.expectedPort { + t.Errorf("Expected port %d, got %d", tc.expectedPort, port) + } + } else if *port != *tc.expectedPort { + t.Errorf("Expected port %d, got %d", *tc.expectedPort, *port) + } + }) + } +} + +func Test_PathMatchTypePtr(t *testing.T) { + pathMatchTypePtrTests := []struct { + name string + pathType string + expectedPath gatewayv1b1.PathMatchType + }{ + { + name: "valid path exact match", + pathType: "Exact", + expectedPath: gatewayv1b1.PathMatchExact, + }, + + { + name: "valid path prefix match", + pathType: "PathPrefix", + expectedPath: gatewayv1b1.PathMatchPathPrefix, + }, + { + name: "valid path regular expression match", + pathType: "RegularExpression", + expectedPath: gatewayv1b1.PathMatchRegularExpression, + }, + } + + for _, tc := range pathMatchTypePtrTests { + t.Run(tc.name, func(t *testing.T) { + path := PathMatchTypePtr(tc.pathType) + if *path != tc.expectedPath { + t.Errorf("Expected path %s, got %s", tc.expectedPath, *path) + } + }) + } +} diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1beta1/zz_generated.deepcopy.go similarity index 56% rename from apis/v1alpha1/zz_generated.deepcopy.go rename to apis/v1beta1/zz_generated.deepcopy.go index 81696264ad..cbea355eae 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1beta1/zz_generated.deepcopy.go @@ -19,7 +19,7 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1alpha1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,109 +27,63 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendPolicy) DeepCopyInto(out *BackendPolicy) { +func (in *AllowedRoutes) DeepCopyInto(out *AllowedRoutes) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicy. -func (in *BackendPolicy) DeepCopy() *BackendPolicy { - if in == nil { - return nil - } - out := new(BackendPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BackendPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = new(RouteNamespaces) + (*in).DeepCopyInto(*out) } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendPolicyList) DeepCopyInto(out *BackendPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]BackendPolicy, len(*in)) + if in.Kinds != nil { + in, out := &in.Kinds, &out.Kinds + *out = make([]RouteGroupKind, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicyList. -func (in *BackendPolicyList) DeepCopy() *BackendPolicyList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedRoutes. +func (in *AllowedRoutes) DeepCopy() *AllowedRoutes { if in == nil { return nil } - out := new(BackendPolicyList) + out := new(AllowedRoutes) in.DeepCopyInto(out) return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BackendPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendPolicySpec) DeepCopyInto(out *BackendPolicySpec) { +func (in *BackendObjectReference) DeepCopyInto(out *BackendObjectReference) { *out = *in - if in.BackendRefs != nil { - in, out := &in.BackendRefs, &out.BackendRefs - *out = make([]BackendRef, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) + **out = **in } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(BackendTLSConfig) - (*in).DeepCopyInto(*out) + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) + **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicySpec. -func (in *BackendPolicySpec) DeepCopy() *BackendPolicySpec { - if in == nil { - return nil + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) + **out = **in } - out := new(BackendPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendPolicyStatus) DeepCopyInto(out *BackendPolicyStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(PortNumber) + **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicyStatus. -func (in *BackendPolicyStatus) DeepCopy() *BackendPolicyStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendObjectReference. +func (in *BackendObjectReference) DeepCopy() *BackendObjectReference { if in == nil { return nil } - out := new(BackendPolicyStatus) + out := new(BackendObjectReference) in.DeepCopyInto(out) return out } @@ -137,9 +91,10 @@ func (in *BackendPolicyStatus) DeepCopy() *BackendPolicyStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BackendRef) DeepCopyInto(out *BackendRef) { *out = *in - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) + in.BackendObjectReference.DeepCopyInto(&out.BackendObjectReference) + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int32) **out = **in } } @@ -155,28 +110,23 @@ func (in *BackendRef) DeepCopy() *BackendRef { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTLSConfig) DeepCopyInto(out *BackendTLSConfig) { +func (in *CommonRouteSpec) DeepCopyInto(out *CommonRouteSpec) { *out = *in - if in.CertificateAuthorityRef != nil { - in, out := &in.CertificateAuthorityRef, &out.CertificateAuthorityRef - *out = new(LocalObjectReference) - **out = **in - } - if in.Options != nil { - in, out := &in.Options, &out.Options - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val + if in.ParentRefs != nil { + in, out := &in.ParentRefs, &out.ParentRefs + *out = make([]ParentReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSConfig. -func (in *BackendTLSConfig) DeepCopy() *BackendTLSConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRouteSpec. +func (in *CommonRouteSpec) DeepCopy() *CommonRouteSpec { if in == nil { return nil } - out := new(BackendTLSConfig) + out := new(CommonRouteSpec) in.DeepCopyInto(out) return out } @@ -295,6 +245,11 @@ func (in *GatewayClassSpec) DeepCopyInto(out *GatewayClassSpec) { *out = new(ParametersReference) (*in).DeepCopyInto(*out) } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassSpec. @@ -361,21 +316,6 @@ func (in *GatewayList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayReference) DeepCopyInto(out *GatewayReference) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayReference. -func (in *GatewayReference) DeepCopy() *GatewayReference { - if in == nil { - return nil - } - out := new(GatewayReference) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { *out = *in @@ -449,19 +389,16 @@ func (in *GatewayTLSConfig) DeepCopyInto(out *GatewayTLSConfig) { *out = new(TLSModeType) **out = **in } - if in.CertificateRef != nil { - in, out := &in.CertificateRef, &out.CertificateRef - *out = new(LocalObjectReference) - **out = **in - } - if in.RouteOverride != nil { - in, out := &in.RouteOverride, &out.RouteOverride - *out = new(TLSOverridePolicy) - (*in).DeepCopyInto(*out) + if in.CertificateRefs != nil { + in, out := &in.CertificateRefs, &out.CertificateRefs + *out = make([]SecretObjectReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Options != nil { in, out := &in.Options, &out.Options - *out = make(map[string]string, len(*in)) + *out = make(map[AnnotationKey]AnnotationValue, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -478,6 +415,44 @@ func (in *GatewayTLSConfig) DeepCopy() *GatewayTLSConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPBackendRef) DeepCopyInto(out *HTTPBackendRef) { + *out = *in + in.BackendRef.DeepCopyInto(&out.BackendRef) + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]HTTPRouteFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBackendRef. +func (in *HTTPBackendRef) DeepCopy() *HTTPBackendRef { + if in == nil { + return nil + } + out := new(HTTPBackendRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPHeader) DeepCopyInto(out *HTTPHeader) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeader. +func (in *HTTPHeader) DeepCopy() *HTTPHeader { + if in == nil { + return nil + } + out := new(HTTPHeader) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPHeaderMatch) DeepCopyInto(out *HTTPHeaderMatch) { *out = *in @@ -486,13 +461,6 @@ func (in *HTTPHeaderMatch) DeepCopyInto(out *HTTPHeaderMatch) { *out = new(HeaderMatchType) **out = **in } - if in.Values != nil { - in, out := &in.Values, &out.Values - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderMatch. @@ -530,6 +498,31 @@ func (in *HTTPPathMatch) DeepCopy() *HTTPPathMatch { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPPathModifier) DeepCopyInto(out *HTTPPathModifier) { + *out = *in + if in.ReplaceFullPath != nil { + in, out := &in.ReplaceFullPath, &out.ReplaceFullPath + *out = new(string) + **out = **in + } + if in.ReplacePrefixMatch != nil { + in, out := &in.ReplacePrefixMatch, &out.ReplacePrefixMatch + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPathModifier. +func (in *HTTPPathModifier) DeepCopy() *HTTPPathModifier { + if in == nil { + return nil + } + out := new(HTTPPathModifier) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPQueryParamMatch) DeepCopyInto(out *HTTPQueryParamMatch) { *out = *in @@ -538,13 +531,6 @@ func (in *HTTPQueryParamMatch) DeepCopyInto(out *HTTPQueryParamMatch) { *out = new(QueryParamMatchType) **out = **in } - if in.Values != nil { - in, out := &in.Values, &out.Values - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPQueryParamMatch. @@ -562,17 +548,13 @@ func (in *HTTPRequestHeaderFilter) DeepCopyInto(out *HTTPRequestHeaderFilter) { *out = *in if in.Set != nil { in, out := &in.Set, &out.Set - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } + *out = make([]HTTPHeader, len(*in)) + copy(*out, *in) } if in.Add != nil { in, out := &in.Add, &out.Add - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } + *out = make([]HTTPHeader, len(*in)) + copy(*out, *in) } if in.Remove != nil { in, out := &in.Remove, &out.Remove @@ -594,29 +576,55 @@ func (in *HTTPRequestHeaderFilter) DeepCopy() *HTTPRequestHeaderFilter { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRequestMirrorFilter) DeepCopyInto(out *HTTPRequestMirrorFilter) { *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName + in.BackendRef.DeepCopyInto(&out.BackendRef) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. +func (in *HTTPRequestMirrorFilter) DeepCopy() *HTTPRequestMirrorFilter { + if in == nil { + return nil + } + out := new(HTTPRequestMirrorFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRequestRedirectFilter) DeepCopyInto(out *HTTPRequestRedirectFilter) { + *out = *in + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme *out = new(string) **out = **in } - if in.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(PreciseHostname) **out = **in } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(HTTPPathModifier) + (*in).DeepCopyInto(*out) + } if in.Port != nil { in, out := &in.Port, &out.Port *out = new(PortNumber) **out = **in } + if in.StatusCode != nil { + in, out := &in.StatusCode, &out.StatusCode + *out = new(int) + **out = **in + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. -func (in *HTTPRequestMirrorFilter) DeepCopy() *HTTPRequestMirrorFilter { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestRedirectFilter. +func (in *HTTPRequestRedirectFilter) DeepCopy() *HTTPRequestRedirectFilter { if in == nil { return nil } - out := new(HTTPRequestMirrorFilter) + out := new(HTTPRequestRedirectFilter) in.DeepCopyInto(out) return out } @@ -661,6 +669,16 @@ func (in *HTTPRouteFilter) DeepCopyInto(out *HTTPRouteFilter) { *out = new(HTTPRequestMirrorFilter) (*in).DeepCopyInto(*out) } + if in.RequestRedirect != nil { + in, out := &in.RequestRedirect, &out.RequestRedirect + *out = new(HTTPRequestRedirectFilter) + (*in).DeepCopyInto(*out) + } + if in.URLRewrite != nil { + in, out := &in.URLRewrite, &out.URLRewrite + *out = new(HTTPURLRewriteFilter) + (*in).DeepCopyInto(*out) + } if in.ExtensionRef != nil { in, out := &in.ExtensionRef, &out.ExtensionRef *out = new(LocalObjectReference) @@ -678,48 +696,6 @@ func (in *HTTPRouteFilter) DeepCopy() *HTTPRouteFilter { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteForwardTo) DeepCopyInto(out *HTTPRouteForwardTo) { - *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName - *out = new(string) - **out = **in - } - if in.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } - if in.Filters != nil { - in, out := &in.Filters, &out.Filters - *out = make([]HTTPRouteFilter, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteForwardTo. -func (in *HTTPRouteForwardTo) DeepCopy() *HTTPRouteForwardTo { - if in == nil { - return nil - } - out := new(HTTPRouteForwardTo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRouteList) DeepCopyInto(out *HTTPRouteList) { *out = *in @@ -762,17 +738,21 @@ func (in *HTTPRouteMatch) DeepCopyInto(out *HTTPRouteMatch) { } if in.Headers != nil { in, out := &in.Headers, &out.Headers - *out = new(HTTPHeaderMatch) - (*in).DeepCopyInto(*out) + *out = make([]HTTPHeaderMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.QueryParams != nil { in, out := &in.QueryParams, &out.QueryParams - *out = new(HTTPQueryParamMatch) - (*in).DeepCopyInto(*out) + *out = make([]HTTPQueryParamMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } - if in.ExtensionRef != nil { - in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(LocalObjectReference) + if in.Method != nil { + in, out := &in.Method, &out.Method + *out = new(HTTPMethod) **out = **in } } @@ -804,9 +784,9 @@ func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]HTTPRouteForwardTo, len(*in)) + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]HTTPBackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -826,21 +806,12 @@ func (in *HTTPRouteRule) DeepCopy() *HTTPRouteRule { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRouteSpec) DeepCopyInto(out *HTTPRouteSpec) { *out = *in - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = new(RouteGateways) - (*in).DeepCopyInto(*out) - } + in.CommonRouteSpec.DeepCopyInto(&out.CommonRouteSpec) if in.Hostnames != nil { in, out := &in.Hostnames, &out.Hostnames *out = make([]Hostname, len(*in)) copy(*out, *in) } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(RouteTLSConfig) - **out = **in - } if in.Rules != nil { in, out := &in.Rules, &out.Rules *out = make([]HTTPRouteRule, len(*in)) @@ -877,19 +848,48 @@ func (in *HTTPRouteStatus) DeepCopy() *HTTPRouteStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Listener) DeepCopyInto(out *Listener) { +func (in *HTTPURLRewriteFilter) DeepCopyInto(out *HTTPURLRewriteFilter) { *out = *in if in.Hostname != nil { in, out := &in.Hostname, &out.Hostname - *out = new(Hostname) + *out = new(PreciseHostname) **out = **in } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(HTTPPathModifier) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPURLRewriteFilter. +func (in *HTTPURLRewriteFilter) DeepCopy() *HTTPURLRewriteFilter { + if in == nil { + return nil + } + out := new(HTTPURLRewriteFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Listener) DeepCopyInto(out *Listener) { + *out = *in + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(Hostname) + **out = **in + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS *out = new(GatewayTLSConfig) (*in).DeepCopyInto(*out) } - in.Routes.DeepCopyInto(&out.Routes) + if in.AllowedRoutes != nil { + in, out := &in.AllowedRoutes, &out.AllowedRoutes + *out = new(AllowedRoutes) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Listener. @@ -905,10 +905,12 @@ func (in *Listener) DeepCopy() *Listener { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ListenerStatus) DeepCopyInto(out *ListenerStatus) { *out = *in - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(Hostname) - **out = **in + if in.SupportedKinds != nil { + in, out := &in.SupportedKinds, &out.SupportedKinds + *out = make([]RouteGroupKind, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -947,14 +949,9 @@ func (in *LocalObjectReference) DeepCopy() *LocalObjectReference { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ParametersReference) DeepCopyInto(out *ParametersReference) { *out = *in - if in.Scope != nil { - in, out := &in.Scope, &out.Scope - *out = new(string) - **out = **in - } if in.Namespace != nil { in, out := &in.Namespace, &out.Namespace - *out = new(string) + *out = new(Namespace) **out = **in } } @@ -970,46 +967,26 @@ func (in *ParametersReference) DeepCopy() *ParametersReference { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteBindingSelector) DeepCopyInto(out *RouteBindingSelector) { +func (in *ParentReference) DeepCopyInto(out *ParentReference) { *out = *in - if in.Namespaces != nil { - in, out := &in.Namespaces, &out.Namespaces - *out = new(RouteNamespaces) - (*in).DeepCopyInto(*out) - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } if in.Group != nil { in, out := &in.Group, &out.Group - *out = new(string) + *out = new(Group) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteBindingSelector. -func (in *RouteBindingSelector) DeepCopy() *RouteBindingSelector { - if in == nil { - return nil + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) + **out = **in } - out := new(RouteBindingSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteForwardTo) DeepCopyInto(out *RouteForwardTo) { - *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName - *out = new(string) + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) **out = **in } - if in.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) + if in.SectionName != nil { + in, out := &in.SectionName, &out.SectionName + *out = new(SectionName) **out = **in } if in.Port != nil { @@ -1017,67 +994,34 @@ func (in *RouteForwardTo) DeepCopyInto(out *RouteForwardTo) { *out = new(PortNumber) **out = **in } - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteForwardTo. -func (in *RouteForwardTo) DeepCopy() *RouteForwardTo { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParentReference. +func (in *ParentReference) DeepCopy() *ParentReference { if in == nil { return nil } - out := new(RouteForwardTo) + out := new(ParentReference) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteGatewayStatus) DeepCopyInto(out *RouteGatewayStatus) { +func (in *RouteGroupKind) DeepCopyInto(out *RouteGroupKind) { *out = *in - in.GatewayRef.DeepCopyInto(&out.GatewayRef) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGatewayStatus. -func (in *RouteGatewayStatus) DeepCopy() *RouteGatewayStatus { - if in == nil { - return nil - } - out := new(RouteGatewayStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteGateways) DeepCopyInto(out *RouteGateways) { - *out = *in - if in.Allow != nil { - in, out := &in.Allow, &out.Allow - *out = new(GatewayAllowType) + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) **out = **in } - if in.GatewayRefs != nil { - in, out := &in.GatewayRefs, &out.GatewayRefs - *out = make([]GatewayReference, len(*in)) - copy(*out, *in) - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGateways. -func (in *RouteGateways) DeepCopy() *RouteGateways { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGroupKind. +func (in *RouteGroupKind) DeepCopy() *RouteGroupKind { if in == nil { return nil } - out := new(RouteGateways) + out := new(RouteGroupKind) in.DeepCopyInto(out) return out } @@ -1087,7 +1031,7 @@ func (in *RouteNamespaces) DeepCopyInto(out *RouteNamespaces) { *out = *in if in.From != nil { in, out := &in.From, &out.From - *out = new(RouteSelectType) + *out = new(FromNamespaces) **out = **in } if in.Selector != nil { @@ -1108,537 +1052,76 @@ func (in *RouteNamespaces) DeepCopy() *RouteNamespaces { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { +func (in *RouteParentStatus) DeepCopyInto(out *RouteParentStatus) { *out = *in - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = make([]RouteGatewayStatus, len(*in)) + in.ParentRef.DeepCopyInto(&out.ParentRef) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatus. -func (in *RouteStatus) DeepCopy() *RouteStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteParentStatus. +func (in *RouteParentStatus) DeepCopy() *RouteParentStatus { if in == nil { return nil } - out := new(RouteStatus) + out := new(RouteParentStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteStatusGatewayReference) DeepCopyInto(out *RouteStatusGatewayReference) { - *out = *in - if in.Controller != nil { - in, out := &in.Controller, &out.Controller - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatusGatewayReference. -func (in *RouteStatusGatewayReference) DeepCopy() *RouteStatusGatewayReference { - if in == nil { - return nil - } - out := new(RouteStatusGatewayReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteTLSConfig) DeepCopyInto(out *RouteTLSConfig) { - *out = *in - out.CertificateRef = in.CertificateRef -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTLSConfig. -func (in *RouteTLSConfig) DeepCopy() *RouteTLSConfig { - if in == nil { - return nil - } - out := new(RouteTLSConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRoute) DeepCopyInto(out *TCPRoute) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRoute. -func (in *TCPRoute) DeepCopy() *TCPRoute { - if in == nil { - return nil - } - out := new(TCPRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TCPRoute) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRouteList) DeepCopyInto(out *TCPRouteList) { +func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]TCPRoute, len(*in)) + if in.Parents != nil { + in, out := &in.Parents, &out.Parents + *out = make([]RouteParentStatus, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouteList. -func (in *TCPRouteList) DeepCopy() *TCPRouteList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatus. +func (in *RouteStatus) DeepCopy() *RouteStatus { if in == nil { return nil } - out := new(TCPRouteList) + out := new(RouteStatus) in.DeepCopyInto(out) return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TCPRouteList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRouteMatch) DeepCopyInto(out *TCPRouteMatch) { +func (in *SecretObjectReference) DeepCopyInto(out *SecretObjectReference) { *out = *in - if in.ExtensionRef != nil { - in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(LocalObjectReference) + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouteMatch. -func (in *TCPRouteMatch) DeepCopy() *TCPRouteMatch { - if in == nil { - return nil - } - out := new(TCPRouteMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRouteRule) DeepCopyInto(out *TCPRouteRule) { - *out = *in - if in.Matches != nil { - in, out := &in.Matches, &out.Matches - *out = make([]TCPRouteMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouteRule. -func (in *TCPRouteRule) DeepCopy() *TCPRouteRule { - if in == nil { - return nil - } - out := new(TCPRouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRouteSpec) DeepCopyInto(out *TCPRouteSpec) { - *out = *in - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]TCPRouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = new(RouteGateways) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouteSpec. -func (in *TCPRouteSpec) DeepCopy() *TCPRouteSpec { - if in == nil { - return nil - } - out := new(TCPRouteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TCPRouteStatus) DeepCopyInto(out *TCPRouteStatus) { - *out = *in - in.RouteStatus.DeepCopyInto(&out.RouteStatus) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouteStatus. -func (in *TCPRouteStatus) DeepCopy() *TCPRouteStatus { - if in == nil { - return nil - } - out := new(TCPRouteStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSOverridePolicy) DeepCopyInto(out *TLSOverridePolicy) { - *out = *in - if in.Certificate != nil { - in, out := &in.Certificate, &out.Certificate - *out = new(TLSRouteOverrideType) + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) **out = **in } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSOverridePolicy. -func (in *TLSOverridePolicy) DeepCopy() *TLSOverridePolicy { - if in == nil { - return nil - } - out := new(TLSOverridePolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRoute) DeepCopyInto(out *TLSRoute) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRoute. -func (in *TLSRoute) DeepCopy() *TLSRoute { - if in == nil { - return nil - } - out := new(TLSRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TLSRoute) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRouteList) DeepCopyInto(out *TLSRouteList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]TLSRoute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRouteList. -func (in *TLSRouteList) DeepCopy() *TLSRouteList { - if in == nil { - return nil - } - out := new(TLSRouteList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TLSRouteList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRouteMatch) DeepCopyInto(out *TLSRouteMatch) { - *out = *in - if in.SNIs != nil { - in, out := &in.SNIs, &out.SNIs - *out = make([]Hostname, len(*in)) - copy(*out, *in) - } - if in.ExtensionRef != nil { - in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(LocalObjectReference) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRouteMatch. -func (in *TLSRouteMatch) DeepCopy() *TLSRouteMatch { - if in == nil { - return nil - } - out := new(TLSRouteMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRouteRule) DeepCopyInto(out *TLSRouteRule) { - *out = *in - if in.Matches != nil { - in, out := &in.Matches, &out.Matches - *out = make([]TLSRouteMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRouteRule. -func (in *TLSRouteRule) DeepCopy() *TLSRouteRule { - if in == nil { - return nil - } - out := new(TLSRouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRouteSpec) DeepCopyInto(out *TLSRouteSpec) { - *out = *in - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]TLSRouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = new(RouteGateways) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRouteSpec. -func (in *TLSRouteSpec) DeepCopy() *TLSRouteSpec { - if in == nil { - return nil - } - out := new(TLSRouteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSRouteStatus) DeepCopyInto(out *TLSRouteStatus) { - *out = *in - in.RouteStatus.DeepCopyInto(&out.RouteStatus) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSRouteStatus. -func (in *TLSRouteStatus) DeepCopy() *TLSRouteStatus { - if in == nil { - return nil - } - out := new(TLSRouteStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRoute) DeepCopyInto(out *UDPRoute) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRoute. -func (in *UDPRoute) DeepCopy() *UDPRoute { - if in == nil { - return nil - } - out := new(UDPRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *UDPRoute) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRouteList) DeepCopyInto(out *UDPRouteList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]UDPRoute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRouteList. -func (in *UDPRouteList) DeepCopy() *UDPRouteList { - if in == nil { - return nil - } - out := new(UDPRouteList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *UDPRouteList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRouteMatch) DeepCopyInto(out *UDPRouteMatch) { - *out = *in - if in.ExtensionRef != nil { - in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(LocalObjectReference) + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRouteMatch. -func (in *UDPRouteMatch) DeepCopy() *UDPRouteMatch { - if in == nil { - return nil - } - out := new(UDPRouteMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRouteRule) DeepCopyInto(out *UDPRouteRule) { - *out = *in - if in.Matches != nil { - in, out := &in.Matches, &out.Matches - *out = make([]UDPRouteMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRouteRule. -func (in *UDPRouteRule) DeepCopy() *UDPRouteRule { - if in == nil { - return nil - } - out := new(UDPRouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRouteSpec) DeepCopyInto(out *UDPRouteSpec) { - *out = *in - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]UDPRouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Gateways != nil { - in, out := &in.Gateways, &out.Gateways - *out = new(RouteGateways) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRouteSpec. -func (in *UDPRouteSpec) DeepCopy() *UDPRouteSpec { - if in == nil { - return nil - } - out := new(UDPRouteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UDPRouteStatus) DeepCopyInto(out *UDPRouteStatus) { - *out = *in - in.RouteStatus.DeepCopyInto(&out.RouteStatus) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UDPRouteStatus. -func (in *UDPRouteStatus) DeepCopy() *UDPRouteStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretObjectReference. +func (in *SecretObjectReference) DeepCopy() *SecretObjectReference { if in == nil { return nil } - out := new(UDPRouteStatus) + out := new(SecretObjectReference) in.DeepCopyInto(out) return out } diff --git a/apis/v1alpha1/zz_generated.register.go b/apis/v1beta1/zz_generated.register.go similarity index 90% rename from apis/v1alpha1/zz_generated.register.go rename to apis/v1beta1/zz_generated.register.go index ac718c728c..7cb684d1cf 100644 --- a/apis/v1alpha1/zz_generated.register.go +++ b/apis/v1beta1/zz_generated.register.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by register-gen. DO NOT EDIT. -package v1alpha1 +package v1beta1 import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,14 +25,14 @@ import ( ) // GroupName specifies the group name used to register the objects. -const GroupName = "networking.x-k8s.io" +const GroupName = "gateway.networking.k8s.io" // GroupVersion specifies the group and the version used to register the objects. -var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1beta1"} // SchemeGroupVersion is group version used to register these objects // Deprecated: use GroupVersion instead. -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { @@ -58,20 +58,12 @@ func init() { // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &BackendPolicy{}, - &BackendPolicyList{}, &Gateway{}, &GatewayClass{}, &GatewayClassList{}, &GatewayList{}, &HTTPRoute{}, &HTTPRouteList{}, - &TCPRoute{}, - &TCPRouteList{}, - &TLSRoute{}, - &TLSRouteList{}, - &UDPRoute{}, - &UDPRouteList{}, ) // AddToGroupVersion allows the serialization of client types like ListOptions. v1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml b/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml index e9a52a5720..45a9674f15 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_gatewayclasses.yaml @@ -221,6 +221,207 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.controllerName + name: Controller + type: string + - jsonPath: .status.conditions[?(@.type=="Accepted")].status + name: Accepted + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.description + name: Description + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: "GatewayClass describes a class of Gateways available to the + user for creating Gateway resources. \n It is recommended that this resource + be used as a template for Gateways. This means that a Gateway is based on + the state of the GatewayClass at the time it was created and changes to + the GatewayClass or associated parameters are not propagated down to existing + Gateways. This recommendation is intended to limit the blast radius of changes + to GatewayClass or associated parameters. If implementations choose to propagate + GatewayClass changes to existing Gateways, that MUST be clearly documented + by the implementation. \n Whenever one or more Gateways are using a GatewayClass, + implementations MUST add the `gateway-exists-finalizer.gateway.networking.k8s.io` + finalizer on the associated GatewayClass. This ensures that a GatewayClass + associated with a Gateway is not deleted while in use. \n GatewayClass is + a Cluster level resource." + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of GatewayClass. + properties: + controllerName: + description: "ControllerName is the name of the controller that is + managing Gateways of this class. The value of this field MUST be + a domain prefixed path. \n Example: \"example.net/gateway-controller\". + \n This field is not mutable and cannot be empty. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ + type: string + description: + description: Description helps describe a GatewayClass with more details. + maxLength: 64 + type: string + parametersRef: + description: "ParametersRef is a reference to a resource that contains + the configuration parameters corresponding to the GatewayClass. + This is optional if the controller does not require any additional + configuration. \n ParametersRef can reference a standard Kubernetes + resource, i.e. ConfigMap, or an implementation-specific custom resource. + The resource can be cluster-scoped or namespace-scoped. \n If the + referent cannot be found, the GatewayClass's \"InvalidParameters\" + status condition will be true. \n Support: Custom" + properties: + group: + description: Group is the group of the referent. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: Namespace is the namespace of the referent. This + field is required when referring to a Namespace-scoped resource + and MUST be unset when referring to a Cluster-scoped resource. + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - group + - kind + - name + type: object + required: + - controllerName + type: object + status: + default: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: Waiting + status: Unknown + type: Accepted + description: Status defines the current state of GatewayClass. + properties: + conditions: + default: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: Waiting + status: Unknown + type: Accepted + description: "Conditions is the current status from the controller + for this GatewayClass. \n Controllers should prefer to publish conditions + using values of GatewayClassConditionType for the type of each Condition." + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: + \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // +listMapKey=type + \ Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml b/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml index e01c67d575..8498bb148c 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_gateways.yaml @@ -714,6 +714,694 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.gatewayClassName + name: Class + type: string + - jsonPath: .status.addresses[*].value + name: Address + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: Gateway represents an instance of a service-traffic handling + infrastructure by binding Listeners to a set of IP addresses. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of Gateway. + properties: + addresses: + description: "Addresses requested for this Gateway. This is optional + and behavior can depend on the implementation. If a value is set + in the spec and the requested address is invalid or unavailable, + the implementation MUST indicate this in the associated entry in + GatewayStatus.Addresses. \n The Addresses field represents a request + for the address(es) on the \"outside of the Gateway\", that traffic + bound for this Gateway will use. This could be the IP address or + hostname of an external load balancer or other networking infrastructure, + or some other address that traffic will be sent to. \n The .listener.hostname + field is used to route traffic that has already arrived at the Gateway + to the correct in-cluster destination. \n If no Addresses are specified, + the implementation MAY schedule the Gateway in an implementation-specific + manner, assigning an appropriate set of Addresses. \n The implementation + MUST bind all Listeners to every GatewayAddress that it assigns + to the Gateway and add a corresponding entry in GatewayStatus.Addresses. + \n Support: Extended" + items: + description: GatewayAddress describes an address that can be bound + to a Gateway. + properties: + type: + default: IPAddress + description: Type of the address. + type: string + value: + description: "Value of the address. The validity of the values + will depend on the type and support by the controller. \n + Examples: `1.2.3.4`, `128::1`, `my-ip-address`." + maxLength: 253 + minLength: 1 + type: string + required: + - value + type: object + maxItems: 16 + type: array + gatewayClassName: + description: GatewayClassName used for this Gateway. This is the name + of a GatewayClass resource. + maxLength: 253 + minLength: 1 + type: string + listeners: + description: "Listeners associated with this Gateway. Listeners define + logical endpoints that are bound on this Gateway's addresses. At + least one Listener MUST be specified. \n Each listener in a Gateway + must have a unique combination of Hostname, Port, and Protocol. + \n An implementation MAY group Listeners by Port and then collapse + each group of Listeners into a single Listener if the implementation + determines that the Listeners in the group are \"compatible\". An + implementation MAY also group together and collapse compatible Listeners + belonging to different Gateways. \n For example, an implementation + might consider Listeners to be compatible with each other if all + of the following conditions are met: \n 1. Either each Listener + within the group specifies the \"HTTP\" Protocol or each Listener + within the group specifies either the \"HTTPS\" or \"TLS\" Protocol. + \n 2. Each Listener within the group specifies a Hostname that is + unique within the group. \n 3. As a special case, one Listener + within a group may omit Hostname, in which case this Listener + matches when no other Listener matches. \n If the implementation + does collapse compatible Listeners, the hostname provided in the + incoming client request MUST be matched to a Listener to find the + correct set of Routes. The incoming hostname MUST be matched using + the Hostname field for each Listener in order of most to least specific. + That is, exact matches must be processed before wildcard matches. + \n If this field specifies multiple Listeners that have the same + Port value but are not compatible, the implementation must raise + a \"Conflicted\" condition in the Listener status. \n Support: Core" + items: + description: Listener embodies the concept of a logical endpoint + where a Gateway accepts network connections. + properties: + allowedRoutes: + default: + namespaces: + from: Same + description: "AllowedRoutes defines the types of routes that + MAY be attached to a Listener and the trusted namespaces where + those Route resources MAY be present. \n Although a client + request may match multiple route rules, only one rule may + ultimately receive the request. Matching precedence MUST be + determined in order of the following criteria: \n * The most + specific match as defined by the Route type. * The oldest + Route based on creation timestamp. For example, a Route with + \ a creation timestamp of \"2020-09-08 01:02:03\" is given + precedence over a Route with a creation timestamp of \"2020-09-08 + 01:02:04\". * If everything else is equivalent, the Route + appearing first in alphabetical order (namespace/name) should + be given precedence. For example, foo/bar is given precedence + over foo/baz. \n All valid rules within a Route attached to + this Listener should be implemented. Invalid Route rules can + be ignored (sometimes that will mean the full Route). If a + Route rule transitions from valid to invalid, support for + that Route rule should be dropped to ensure consistency. For + example, even if a filter specified by a Route rule is invalid, + the rest of the rules within that Route should still be supported. + \n Support: Core" + properties: + kinds: + description: "Kinds specifies the groups and kinds of Routes + that are allowed to bind to this Gateway Listener. When + unspecified or empty, the kinds of Routes selected are + determined using the Listener protocol. \n A RouteGroupKind + MUST correspond to kinds of Routes that are compatible + with the application protocol specified in the Listener's + Protocol field. If an implementation does not support + or recognize this resource type, it MUST set the \"ResolvedRefs\" + condition to False for this Listener with the \"InvalidRouteKinds\" + reason. \n Support: Core" + items: + description: RouteGroupKind indicates the group and kind + of a Route resource. + properties: + group: + default: gateway.networking.k8s.io + description: Group is the group of the Route. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is the kind of the Route. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + required: + - kind + type: object + maxItems: 8 + type: array + namespaces: + default: + from: Same + description: "Namespaces indicates namespaces from which + Routes may be attached to this Listener. This is restricted + to the namespace of this Gateway by default. \n Support: + Core" + properties: + from: + default: Same + description: "From indicates where Routes will be selected + for this Gateway. Possible values are: * All: Routes + in all namespaces may be used by this Gateway. * Selector: + Routes in namespaces selected by the selector may + be used by this Gateway. * Same: Only Routes in + the same namespace may be used by this Gateway. \n + Support: Core" + enum: + - All + - Selector + - Same + type: string + selector: + description: "Selector must be specified when From is + set to \"Selector\". In that case, only Routes in + Namespaces matching this Selector will be selected + by this Gateway. This field is ignored for other values + of \"From\". \n Support: Core" + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + type: object + type: object + hostname: + description: "Hostname specifies the virtual hostname to match + for protocol types that define this concept. When unspecified, + all hostnames are matched. This field is ignored for protocols + that don't require hostname based matching. \n Implementations + MUST apply Hostname matching appropriately for each of the + following protocols: \n * TLS: The Listener Hostname MUST + match the SNI. * HTTP: The Listener Hostname MUST match the + Host header of the request. * HTTPS: The Listener Hostname + SHOULD match at both the TLS and HTTP protocol layers as + described above. If an implementation does not ensure that + both the SNI and Host header match the Listener hostname, + \ it MUST clearly document that. \n For HTTPRoute and TLSRoute + resources, there is an interaction with the `spec.hostnames` + array. When both listener and route specify hostnames, there + MUST be an intersection between the values for a Route to + be accepted. For more information, refer to the Route specific + Hostnames documentation. \n Hostnames that are prefixed with + a wildcard label (`*.`) are interpreted as a suffix match. + That means that a match for `*.example.com` would match both + `test.example.com`, and `foo.test.example.com`, but not `example.com`. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + name: + description: "Name is the name of the Listener. This name MUST + be unique within a Gateway. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + port: + description: "Port is the network port. Multiple listeners may + use the same port, subject to the Listener compatibility rules. + \n Support: Core" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + protocol: + description: "Protocol specifies the network protocol this listener + expects to receive. \n Support: Core" + maxLength: 255 + minLength: 1 + pattern: ^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$ + type: string + tls: + description: "TLS is the TLS configuration for the Listener. + This field is required if the Protocol field is \"HTTPS\" + or \"TLS\". It is invalid to set this field if the Protocol + field is \"HTTP\", \"TCP\", or \"UDP\". \n The association + of SNIs to Certificate defined in GatewayTLSConfig is defined + based on the Hostname field for this listener. \n The GatewayClass + MUST use the longest matching SNI out of all available certificates + for any TLS handshake. \n Support: Core" + properties: + certificateRefs: + description: "CertificateRefs contains a series of references + to Kubernetes objects that contains TLS certificates and + private keys. These certificates are used to establish + a TLS handshake for requests that match the hostname of + the associated listener. \n A single CertificateRef to + a Kubernetes Secret has \"Core\" support. Implementations + MAY choose to support attaching multiple certificates + to a Listener, but this behavior is implementation-specific. + \n References to a resource in different namespace are + invalid UNLESS there is a ReferenceGrant in the target + namespace that allows the certificate to be attached. + If a ReferenceGrant does not allow this reference, the + \"ResolvedRefs\" condition MUST be set to False for this + listener with the \"InvalidCertificateRef\" reason. \n + This field is required to have at least one element when + the mode is set to \"Terminate\" (default) and is optional + otherwise. \n CertificateRefs can reference to standard + Kubernetes resources, i.e. Secret, or implementation-specific + custom resources. \n Support: Core - A single reference + to a Kubernetes Secret of type kubernetes.io/tls \n Support: + Implementation-specific (More than one reference or other + resource types)" + items: + description: "SecretObjectReference identifies an API + object including its namespace, defaulting to Secret. + \n The API object must be valid in the cluster; the + Group and Kind must be registered in the cluster for + this reference to be valid. \n References to objects + with invalid Group and Kind are not valid, and must + be rejected by the implementation, with appropriate + Conditions set on the containing object." + properties: + group: + default: "" + description: Group is the group of the referent. For + example, "networking.k8s.io". When unspecified (empty + string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Secret + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the backend. + When unspecified, the local namespace is inferred. + \n Note that when a namespace is specified, a ReferenceGrant + object is required in the referent namespace to + allow that namespace's owner to accept the reference. + See the ReferenceGrant documentation for details. + \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - name + type: object + maxItems: 64 + type: array + mode: + default: Terminate + description: "Mode defines the TLS behavior for the TLS + session initiated by the client. There are two possible + modes: \n - Terminate: The TLS session between the downstream + client and the Gateway is terminated at the Gateway. + This mode requires certificateRefs to be set and contain + at least one element. - Passthrough: The TLS session is + NOT terminated by the Gateway. This implies that the + Gateway can't decipher the TLS stream except for the + ClientHello message of the TLS protocol. CertificateRefs + field is ignored in this mode. \n Support: Core" + enum: + - Terminate + - Passthrough + type: string + options: + additionalProperties: + description: AnnotationValue is the value of an annotation + in Gateway API. This is used for validation of maps + such as TLS options. This roughly matches Kubernetes + annotation validation, although the length validation + in that case is based on the entire size of the annotations + struct. + maxLength: 4096 + minLength: 0 + type: string + description: "Options are a list of key/value pairs to enable + extended TLS configuration for each implementation. For + example, configuring the minimum TLS version or supported + cipher suites. \n A set of common keys MAY be defined + by the API in the future. To avoid any ambiguity, implementation-specific + definitions MUST use domain-prefixed names, such as `example.com/my-custom-option`. + Un-prefixed names are reserved for key names defined by + Gateway API. \n Support: Implementation-specific" + maxProperties: 16 + type: object + type: object + required: + - name + - port + - protocol + type: object + maxItems: 64 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + required: + - gatewayClassName + - listeners + type: object + status: + default: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: NotReconciled + status: Unknown + type: Scheduled + description: Status defines the current state of Gateway. + properties: + addresses: + description: Addresses lists the IP addresses that have actually been + bound to the Gateway. These addresses may differ from the addresses + in the Spec, e.g. if the Gateway automatically assigns an address + from a reserved pool. + items: + description: GatewayAddress describes an address that can be bound + to a Gateway. + properties: + type: + default: IPAddress + description: Type of the address. + type: string + value: + description: "Value of the address. The validity of the values + will depend on the type and support by the controller. \n + Examples: `1.2.3.4`, `128::1`, `my-ip-address`." + maxLength: 253 + minLength: 1 + type: string + required: + - value + type: object + maxItems: 16 + type: array + conditions: + default: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: NotReconciled + status: Unknown + type: Scheduled + description: "Conditions describe the current conditions of the Gateway. + \n Implementations should prefer to express Gateway conditions using + the `GatewayConditionType` and `GatewayConditionReason` constants + so that operators and tools can converge on a common vocabulary + to describe Gateway state. \n Known condition types are: \n * \"Scheduled\" + * \"Ready\"" + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: + \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // +listMapKey=type + \ Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + listeners: + description: Listeners provide status for each unique listener port + defined in the Spec. + items: + description: ListenerStatus is the status associated with a Listener. + properties: + attachedRoutes: + description: AttachedRoutes represents the total number of Routes + that have been successfully attached to this Listener. + format: int32 + type: integer + conditions: + description: Conditions describe the current condition of this + listener. + items: + description: "Condition contains details for one aspect of + the current state of this API Resource. --- This struct + is intended for direct use as an array at the field path + .status.conditions. For example, type FooStatus struct{ + \ // Represents the observations of a foo's current state. + \ // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // + +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should + be when the underlying condition changed. If that is + not known, then using the time when the API field changed + is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, + if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the + current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier + indicating the reason for the condition's last transition. + Producers of specific condition types may define expected + values and meanings for this field, and whether the + values are considered a guaranteed API. The value should + be a CamelCase string. This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across + resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability + to deconflict is important. The regex it matches is + (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + name: + description: Name is the name of the Listener that this status + corresponds to. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + supportedKinds: + description: "SupportedKinds is the list indicating the Kinds + supported by this listener. This MUST represent the kinds + an implementation supports for that Listener configuration. + \n If kinds are specified in Spec that are not supported, + they MUST NOT appear in this list and an implementation MUST + set the \"ResolvedRefs\" condition to \"False\" with the \"InvalidRouteKinds\" + reason. If both valid and invalid Route kinds are specified, + the implementation MUST reference the valid Route kinds that + have been specified." + items: + description: RouteGroupKind indicates the group and kind of + a Route resource. + properties: + group: + default: gateway.networking.k8s.io + description: Group is the group of the Route. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is the kind of the Route. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + required: + - kind + type: object + maxItems: 8 + type: array + required: + - attachedRoutes + - conditions + - name + - supportedKinds + type: object + maxItems: 64 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml index 4d0ef8f6c1..946412451d 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml @@ -1550,6 +1550,1538 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.hostnames + name: Hostnames + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: HTTPRoute provides a way to route HTTP requests. This includes + the capability to match requests by hostname, path, header, or query param. + Filters can be used to specify additional processing steps. Backends specify + where matching requests should be routed. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of HTTPRoute. + properties: + hostnames: + description: "Hostnames defines a set of hostname that should match + against the HTTP Host header to select a HTTPRoute to process the + request. This matches the RFC 1123 definition of a hostname with + 2 notable exceptions: \n 1. IPs are not allowed. 2. A hostname may + be prefixed with a wildcard label (`*.`). The wildcard label + must appear by itself as the first label. \n If a hostname is specified + by both the Listener and HTTPRoute, there must be at least one intersecting + hostname for the HTTPRoute to be attached to the Listener. For example: + \n * A Listener with `test.example.com` as the hostname matches + HTTPRoutes that have either not specified any hostnames, or have + specified at least one of `test.example.com` or `*.example.com`. + * A Listener with `*.example.com` as the hostname matches HTTPRoutes + \ that have either not specified any hostnames or have specified + at least one hostname that matches the Listener hostname. For + example, `*.example.com`, `test.example.com`, and `foo.test.example.com` + would all match. On the other hand, `example.com` and `test.example.net` + would not match. \n Hostnames that are prefixed with a wildcard + label (`*.`) are interpreted as a suffix match. That means that + a match for `*.example.com` would match both `test.example.com`, + and `foo.test.example.com`, but not `example.com`. \n If both the + Listener and HTTPRoute have specified hostnames, any HTTPRoute hostnames + that do not match the Listener hostname MUST be ignored. For example, + if a Listener specified `*.example.com`, and the HTTPRoute specified + `test.example.com` and `test.example.net`, `test.example.net` must + not be considered for a match. \n If both the Listener and HTTPRoute + have specified hostnames, and none match with the criteria above, + then the HTTPRoute is not accepted. The implementation must raise + an 'Accepted' Condition with a status of `False` in the corresponding + RouteParentStatus. \n Support: Core" + items: + description: "Hostname is the fully qualified domain name of a network + host. This matches the RFC 1123 definition of a hostname with + 2 notable exceptions: \n 1. IPs are not allowed. 2. A hostname + may be prefixed with a wildcard label (`*.`). The wildcard label + must appear by itself as the first label. \n Hostname can be \"precise\" + which is a domain name without the terminating dot of a network + host (e.g. \"foo.example.com\") or \"wildcard\", which is a domain + name prefixed with a single wildcard label (e.g. `*.example.com`). + \n Note that as per RFC1035 and RFC1123, a *label* must consist + of lower case alphanumeric characters or '-', and must start and + end with an alphanumeric character. No other punctuation is allowed." + maxLength: 253 + minLength: 1 + pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + maxItems: 16 + type: array + parentRefs: + description: "ParentRefs references the resources (usually Gateways) + that a Route wants to be attached to. Note that the referenced parent + resource needs to allow this for the attachment to be complete. + For Gateways, that means the Gateway needs to allow attachment from + Routes of this kind and namespace. \n The only kind of parent resource + with \"Core\" support is Gateway. This API may be extended in the + future to support additional kinds of parent resources such as one + of the route kinds. \n It is invalid to reference an identical parent + more than once. It is valid to reference multiple distinct sections + within the same parent resource, such as 2 Listeners within a Gateway. + \n It is possible to separately reference multiple distinct objects + that may be collapsed by an implementation. For example, some implementations + may choose to merge compatible Gateway Listeners together. If that + is the case, the list of routes attached to those resources should + also be merged." + items: + description: "ParentReference identifies an API object (usually + a Gateway) that can be considered a parent of this resource (usually + a route). The only kind of parent resource with \"Core\" support + is Gateway. This API may be extended in the future to support + additional kinds of parent resources, such as HTTPRoute. \n The + API object must be valid in the cluster; the Group and Kind must + be registered in the cluster for this reference to be valid." + properties: + group: + default: gateway.networking.k8s.io + description: "Group is the group of the referent. \n Support: + Core" + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Gateway + description: "Kind is kind of the referent. \n Support: Core + (Gateway) Support: Custom (Other Resources)" + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: "Name is the name of the referent. \n Support: + Core" + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the referent. When + unspecified (or empty string), this refers to the local namespace + of the Route. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: "Port is the network port this Route targets. It + can be interpreted differently based on the type of parent + resource. \n When the parent resource is a Gateway, this targets + all listeners listening on the specified port that also support + this kind of Route(and select this Route). It's not recommended + to set `Port` unless the networking behaviors specified in + a Route must apply to a specific port as opposed to a listener(s) + whose port(s) may be changed. When both Port and SectionName + are specified, the name and port of the selected listener + must match both specified values. \n Implementations MAY choose + to support other parent resources. Implementations supporting + other types of parent resources MUST clearly document how/if + Port is interpreted. \n For the purpose of status, an attachment + is considered successful as long as the parent resource accepts + it partially. For example, Gateway listeners can restrict + which Routes can attach to them by Route kind, namespace, + or hostname. If 1 of 2 Gateway listeners accept attachment + from the referencing Route, the Route MUST be considered successfully + attached. If no Gateway listeners accept attachment from this + Route, the Route MUST be considered detached from the Gateway. + \n Support: Extended \n " + format: int32 + maximum: 65535 + minimum: 1 + type: integer + sectionName: + description: "SectionName is the name of a section within the + target resource. In the following resources, SectionName is + interpreted as the following: \n * Gateway: Listener Name. + When both Port (experimental) and SectionName are specified, + the name and port of the selected listener must match both + specified values. \n Implementations MAY choose to support + attaching Routes to other resources. If that is the case, + they MUST clearly document how SectionName is interpreted. + \n When unspecified (empty string), this will reference the + entire resource. For the purpose of status, an attachment + is considered successful if at least one section in the parent + resource accepts it. For example, Gateway listeners can restrict + which Routes can attach to them by Route kind, namespace, + or hostname. If 1 of 2 Gateway listeners accept attachment + from the referencing Route, the Route MUST be considered successfully + attached. If no Gateway listeners accept attachment from this + Route, the Route MUST be considered detached from the Gateway. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - name + type: object + maxItems: 32 + type: array + rules: + default: + - matches: + - path: + type: PathPrefix + value: / + description: Rules are a list of HTTP matchers, filters and actions. + items: + description: HTTPRouteRule defines semantics for matching an HTTP + request based on conditions (matches), processing it (filters), + and forwarding the request to an API object (backendRefs). + properties: + backendRefs: + description: "BackendRefs defines the backend(s) where matching + requests should be sent. \n A 404 status code MUST be returned + if there are no BackendRefs or filters specified that would + result in a response being sent. \n A BackendRef is considered + invalid when it refers to: \n * an unknown or unsupported + kind of resource * a resource that does not exist * a resource + in another namespace when the reference has not been explicitly + allowed by a ReferenceGrant (or equivalent concept). \n When + a BackendRef is invalid, 404 status codes MUST be returned + for requests that would have otherwise been routed to an invalid + backend. If multiple backends are specified, and some are + invalid, the proportion of requests that would otherwise have + been routed to an invalid backend MUST receive a 404 status + code. \n When a BackendRef refers to a Service that has no + ready endpoints, it is recommended to return a 503 status + code. \n Support: Core for Kubernetes Service Support: Custom + for any other resource \n Support for weight: Core" + items: + description: HTTPBackendRef defines how a HTTPRoute should + forward an HTTP request. + properties: + filters: + description: "Filters defined at this level should be + executed if and only if the request is being forwarded + to the backend defined here. \n Support: Custom (For + broader support of filters, use the Filters field in + HTTPRouteRule.)" + items: + description: HTTPRouteFilter defines processing steps + that must be completed during the request or response + lifecycle. HTTPRouteFilters are meant as an extension + point to express processing that may be done in Gateway + implementations. Some examples include request or + response modification, implementing authentication + strategies, rate-limiting, and traffic shaping. API + guarantee/conformance is defined based on the type + of the filter. + properties: + extensionRef: + description: "ExtensionRef is an optional, implementation-specific + extension to the \"filter\" behavior. For example, + resource \"myroutefilter\" in group \"networking.example.net\"). + ExtensionRef MUST NOT be used for core and extended + filters. \n Support: Implementation-specific" + properties: + group: + description: Group is the group of the referent. + For example, "networking.k8s.io". When unspecified + (empty string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. For + example "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + requestHeaderModifier: + description: "RequestHeaderModifier defines a schema + for a filter that modifies request headers. \n + Support: Core" + properties: + add: + description: "Add adds the given header(s) (name, + value) to the request before the action. It + appends to any existing values associated + with the header name. \n Input: GET /foo + HTTP/1.1 my-header: foo \n Config: add: + \ - name: \"my-header\" value: \"bar\" + \n Output: GET /foo HTTP/1.1 my-header: + foo my-header: bar" + items: + description: HTTPHeader represents an HTTP + Header name and value as defined by RFC + 7230. + properties: + name: + description: "Name is the name of the + HTTP Header to be matched. Name matching + MUST be case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an + equivalent name MUST be considered for + a match. Subsequent entries with an + equivalent header name MUST be ignored. + Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP + Header to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + remove: + description: "Remove the given header(s) from + the HTTP request before the action. The value + of Remove is a list of HTTP header names. + Note that the header names are case-insensitive + (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + \n Input: GET /foo HTTP/1.1 my-header1: + foo my-header2: bar my-header3: baz \n + Config: remove: [\"my-header1\", \"my-header3\"] + \n Output: GET /foo HTTP/1.1 my-header2: + bar" + items: + type: string + maxItems: 16 + type: array + set: + description: "Set overwrites the request with + the given header (name, value) before the + action. \n Input: GET /foo HTTP/1.1 my-header: + foo \n Config: set: - name: \"my-header\" + \ value: \"bar\" \n Output: GET /foo + HTTP/1.1 my-header: bar" + items: + description: HTTPHeader represents an HTTP + Header name and value as defined by RFC + 7230. + properties: + name: + description: "Name is the name of the + HTTP Header to be matched. Name matching + MUST be case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an + equivalent name MUST be considered for + a match. Subsequent entries with an + equivalent header name MUST be ignored. + Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP + Header to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + requestMirror: + description: "RequestMirror defines a schema for + a filter that mirrors requests. Requests are sent + to the specified destination, but responses from + that destination are ignored. \n Support: Extended" + properties: + backendRef: + description: "BackendRef references a resource + where mirrored requests are sent. \n If the + referent cannot be found, this BackendRef + is invalid and must be dropped from the Gateway. + The controller must ensure the \"ResolvedRefs\" + condition on the Route status is set to `status: + False` and not configure this backend in the + underlying implementation. \n If there is + a cross-namespace reference to an *existing* + object that is not allowed by a ReferenceGrant, + the controller must ensure the \"ResolvedRefs\" + \ condition on the Route is set to `status: + False`, with the \"RefNotPermitted\" reason + and not configure this backend in the underlying + implementation. \n In either error case, the + Message of the `ResolvedRefs` Condition should + be used to provide more detail about the problem. + \n Support: Extended for Kubernetes Service + Support: Custom for any other resource" + properties: + group: + default: "" + description: Group is the group of the referent. + For example, "networking.k8s.io". When + unspecified (empty string), core API group + is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. + For example "HTTPRoute" or "Service". + Defaults to "Service" when not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace + of the backend. When unspecified, the + local namespace is inferred. \n Note that + when a namespace is specified, a ReferenceGrant + object is required in the referent namespace + to allow that namespace's owner to accept + the reference. See the ReferenceGrant + documentation for details. \n Support: + Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination + port number to use for this resource. + Port is required when the referent is + a Kubernetes Service. For other resources, + destination port might be derived from + the referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - name + type: object + required: + - backendRef + type: object + requestRedirect: + description: "RequestRedirect defines a schema for + a filter that responds to the request with an + HTTP redirection. \n Support: Core" + properties: + hostname: + description: "Hostname is the hostname to be + used in the value of the `Location` header + in the response. When empty, the hostname + of the request is used. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + path: + description: "Path defines parameters used to + modify the path of the incoming request. The + modified path is then used to construct the + `Location` header. When empty, the request + path is used as-is. \n Support: Extended \n + " + properties: + replaceFullPath: + description: "ReplaceFullPath specifies + the value with which to replace the full + path of a request during a rewrite or + redirect. \n " + maxLength: 1024 + type: string + replacePrefixMatch: + description: "ReplacePrefixMatch specifies + the value with which to replace the prefix + match of a request during a rewrite or + redirect. For example, a request to \"/foo/bar\" + with a prefix match of \"/foo\" would + be modified to \"/bar\". \n Note that + this matches the behavior of the PathPrefix + match type. This matches full path elements. + A path element refers to the list of labels + in the path split by the `/` separator. + When specified, a trailing `/` is ignored. + For example, the paths `/abc`, `/abc/`, + and `/abc/def` would all match the prefix + `/abc`, but the path `/abcd` would not. + \n " + maxLength: 1024 + type: string + type: + description: "Type defines the type of path + modifier. Additional types may be added + in a future release of the API. \n " + enum: + - ReplaceFullPath + - ReplacePrefixMatch + type: string + required: + - type + type: object + port: + description: "Port is the port to be used in + the value of the `Location` header in the + response. When empty, port (if specified) + of the request is used. \n Support: Extended" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + scheme: + description: "Scheme is the scheme to be used + in the value of the `Location` header in the + response. When empty, the scheme of the request + is used. \n Support: Extended" + enum: + - http + - https + type: string + statusCode: + default: 302 + description: "StatusCode is the HTTP status + code to be used in response. \n Support: Core" + enum: + - 301 + - 302 + type: integer + type: object + type: + description: "Type identifies the type of filter + to apply. As with other API fields, types are + classified into three conformance levels: \n - + Core: Filter types and their corresponding configuration + defined by \"Support: Core\" in this package, + e.g. \"RequestHeaderModifier\". All implementations + must support core filters. \n - Extended: Filter + types and their corresponding configuration defined + by \"Support: Extended\" in this package, e.g. + \"RequestMirror\". Implementers are encouraged + to support extended filters. \n - Custom: Filters + that are defined and supported by specific vendors. + \ In the future, filters showing convergence + in behavior across multiple implementations + will be considered for inclusion in extended or + core conformance levels. Filter-specific configuration + for such filters is specified using the ExtensionRef + field. `Type` should be set to \"ExtensionRef\" + for custom filters. \n Implementers are encouraged + to define custom implementation types to extend + the core API with implementation-specific behavior. + \n If a reference to a custom filter type cannot + be resolved, the filter MUST NOT be skipped. Instead, + requests that would have been processed by that + filter MUST receive a HTTP error response. \n " + enum: + - RequestHeaderModifier + - RequestMirror + - RequestRedirect + - URLRewrite + - ExtensionRef + type: string + urlRewrite: + description: "URLRewrite defines a schema for a + filter that modifies a request during forwarding. + Support: Extended \n " + properties: + hostname: + description: "Hostname is the value to be used + to replace the Host header value during forwarding. + \n Support: Extended \n " + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + path: + description: "Path defines a path rewrite. \n + Support: Extended \n " + properties: + replaceFullPath: + description: "ReplaceFullPath specifies + the value with which to replace the full + path of a request during a rewrite or + redirect. \n " + maxLength: 1024 + type: string + replacePrefixMatch: + description: "ReplacePrefixMatch specifies + the value with which to replace the prefix + match of a request during a rewrite or + redirect. For example, a request to \"/foo/bar\" + with a prefix match of \"/foo\" would + be modified to \"/bar\". \n Note that + this matches the behavior of the PathPrefix + match type. This matches full path elements. + A path element refers to the list of labels + in the path split by the `/` separator. + When specified, a trailing `/` is ignored. + For example, the paths `/abc`, `/abc/`, + and `/abc/def` would all match the prefix + `/abc`, but the path `/abcd` would not. + \n " + maxLength: 1024 + type: string + type: + description: "Type defines the type of path + modifier. Additional types may be added + in a future release of the API. \n " + enum: + - ReplaceFullPath + - ReplacePrefixMatch + type: string + required: + - type + type: object + type: object + required: + - type + type: object + maxItems: 16 + type: array + group: + default: "" + description: Group is the group of the referent. For example, + "networking.k8s.io". When unspecified (empty string), + core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". Defaults to "Service" when + not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the backend. + When unspecified, the local namespace is inferred. \n + Note that when a namespace is specified, a ReferenceGrant + object is required in the referent namespace to allow + that namespace's owner to accept the reference. See + the ReferenceGrant documentation for details. \n Support: + Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port might be derived from the referent + resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + weight: + default: 1 + description: "Weight specifies the proportion of requests + forwarded to the referenced backend. This is computed + as weight/(sum of all weights in this BackendRefs list). + For non-zero values, there may be some epsilon from + the exact proportion defined here depending on the precision + an implementation supports. Weight is not a percentage + and the sum of weights does not need to equal 100. \n + If only one backend is specified and it has a weight + greater than 0, 100% of the traffic is forwarded to + that backend. If weight is set to 0, no traffic should + be forwarded for this entry. If unspecified, weight + defaults to 1. \n Support for this field varies based + on the context where used." + format: int32 + maximum: 1000000 + minimum: 0 + type: integer + required: + - name + type: object + maxItems: 16 + type: array + filters: + description: "Filters define the filters that are applied to + requests that match this rule. \n The effects of ordering + of multiple behaviors are currently unspecified. This can + change in the future based on feedback during the alpha stage. + \n Conformance-levels at this level are defined based on the + type of filter: \n - ALL core filters MUST be supported by + all implementations. - Implementers are encouraged to support + extended filters. - Implementation-specific custom filters + have no API guarantees across implementations. \n Specifying + a core filter multiple times has unspecified or custom conformance. + \n All filters are expected to be compatible with each other + except for the URLRewrite and RequestRedirect filters, which + may not be combined. If an implementation can not support + other combinations of filters, they must clearly document + that limitation. In all cases where incompatible or unsupported + filters are specified, implementations MUST add a warning + condition to status. \n Support: Core" + items: + description: HTTPRouteFilter defines processing steps that + must be completed during the request or response lifecycle. + HTTPRouteFilters are meant as an extension point to express + processing that may be done in Gateway implementations. + Some examples include request or response modification, + implementing authentication strategies, rate-limiting, and + traffic shaping. API guarantee/conformance is defined based + on the type of the filter. + properties: + extensionRef: + description: "ExtensionRef is an optional, implementation-specific + extension to the \"filter\" behavior. For example, + resource \"myroutefilter\" in group \"networking.example.net\"). + ExtensionRef MUST NOT be used for core and extended + filters. \n Support: Implementation-specific" + properties: + group: + description: Group is the group of the referent. For + example, "networking.k8s.io". When unspecified (empty + string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + requestHeaderModifier: + description: "RequestHeaderModifier defines a schema for + a filter that modifies request headers. \n Support: + Core" + properties: + add: + description: "Add adds the given header(s) (name, + value) to the request before the action. It appends + to any existing values associated with the header + name. \n Input: GET /foo HTTP/1.1 my-header: + foo \n Config: add: - name: \"my-header\" value: + \"bar\" \n Output: GET /foo HTTP/1.1 my-header: + foo my-header: bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST + be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + remove: + description: "Remove the given header(s) from the + HTTP request before the action. The value of Remove + is a list of HTTP header names. Note that the header + names are case-insensitive (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + \n Input: GET /foo HTTP/1.1 my-header1: foo + \ my-header2: bar my-header3: baz \n Config: + \ remove: [\"my-header1\", \"my-header3\"] \n Output: + \ GET /foo HTTP/1.1 my-header2: bar" + items: + type: string + maxItems: 16 + type: array + set: + description: "Set overwrites the request with the + given header (name, value) before the action. \n + Input: GET /foo HTTP/1.1 my-header: foo \n Config: + \ set: - name: \"my-header\" value: \"bar\" + \n Output: GET /foo HTTP/1.1 my-header: bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST + be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + requestMirror: + description: "RequestMirror defines a schema for a filter + that mirrors requests. Requests are sent to the specified + destination, but responses from that destination are + ignored. \n Support: Extended" + properties: + backendRef: + description: "BackendRef references a resource where + mirrored requests are sent. \n If the referent cannot + be found, this BackendRef is invalid and must be + dropped from the Gateway. The controller must ensure + the \"ResolvedRefs\" condition on the Route status + is set to `status: False` and not configure this + backend in the underlying implementation. \n If + there is a cross-namespace reference to an *existing* + object that is not allowed by a ReferenceGrant, + the controller must ensure the \"ResolvedRefs\" + \ condition on the Route is set to `status: False`, + with the \"RefNotPermitted\" reason and not configure + this backend in the underlying implementation. \n + In either error case, the Message of the `ResolvedRefs` + Condition should be used to provide more detail + about the problem. \n Support: Extended for Kubernetes + Service Support: Custom for any other resource" + properties: + group: + default: "" + description: Group is the group of the referent. + For example, "networking.k8s.io". When unspecified + (empty string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. For + example "HTTPRoute" or "Service". Defaults to + "Service" when not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the + backend. When unspecified, the local namespace + is inferred. \n Note that when a namespace is + specified, a ReferenceGrant object is required + in the referent namespace to allow that namespace's + owner to accept the reference. See the ReferenceGrant + documentation for details. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination port + number to use for this resource. Port is required + when the referent is a Kubernetes Service. For + other resources, destination port might be derived + from the referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - name + type: object + required: + - backendRef + type: object + requestRedirect: + description: "RequestRedirect defines a schema for a filter + that responds to the request with an HTTP redirection. + \n Support: Core" + properties: + hostname: + description: "Hostname is the hostname to be used + in the value of the `Location` header in the response. + When empty, the hostname of the request is used. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + path: + description: "Path defines parameters used to modify + the path of the incoming request. The modified path + is then used to construct the `Location` header. + When empty, the request path is used as-is. \n Support: + Extended \n " + properties: + replaceFullPath: + description: "ReplaceFullPath specifies the value + with which to replace the full path of a request + during a rewrite or redirect. \n " + maxLength: 1024 + type: string + replacePrefixMatch: + description: "ReplacePrefixMatch specifies the + value with which to replace the prefix match + of a request during a rewrite or redirect. For + example, a request to \"/foo/bar\" with a prefix + match of \"/foo\" would be modified to \"/bar\". + \n Note that this matches the behavior of the + PathPrefix match type. This matches full path + elements. A path element refers to the list + of labels in the path split by the `/` separator. + When specified, a trailing `/` is ignored. For + example, the paths `/abc`, `/abc/`, and `/abc/def` + would all match the prefix `/abc`, but the path + `/abcd` would not. \n " + maxLength: 1024 + type: string + type: + description: "Type defines the type of path modifier. + Additional types may be added in a future release + of the API. \n " + enum: + - ReplaceFullPath + - ReplacePrefixMatch + type: string + required: + - type + type: object + port: + description: "Port is the port to be used in the value + of the `Location` header in the response. When empty, + port (if specified) of the request is used. \n Support: + Extended" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + scheme: + description: "Scheme is the scheme to be used in the + value of the `Location` header in the response. + When empty, the scheme of the request is used. \n + Support: Extended" + enum: + - http + - https + type: string + statusCode: + default: 302 + description: "StatusCode is the HTTP status code to + be used in response. \n Support: Core" + enum: + - 301 + - 302 + type: integer + type: object + type: + description: "Type identifies the type of filter to apply. + As with other API fields, types are classified into + three conformance levels: \n - Core: Filter types and + their corresponding configuration defined by \"Support: + Core\" in this package, e.g. \"RequestHeaderModifier\". + All implementations must support core filters. \n + - Extended: Filter types and their corresponding configuration + defined by \"Support: Extended\" in this package, + e.g. \"RequestMirror\". Implementers are encouraged + to support extended filters. \n - Custom: Filters that + are defined and supported by specific vendors. In + the future, filters showing convergence in behavior + across multiple implementations will be considered + for inclusion in extended or core conformance levels. + Filter-specific configuration for such filters is + specified using the ExtensionRef field. `Type` should + be set to \"ExtensionRef\" for custom filters. \n + Implementers are encouraged to define custom implementation + types to extend the core API with implementation-specific + behavior. \n If a reference to a custom filter type + cannot be resolved, the filter MUST NOT be skipped. + Instead, requests that would have been processed by + that filter MUST receive a HTTP error response. \n " + enum: + - RequestHeaderModifier + - RequestMirror + - RequestRedirect + - URLRewrite + - ExtensionRef + type: string + urlRewrite: + description: "URLRewrite defines a schema for a filter + that modifies a request during forwarding. Support: + Extended \n " + properties: + hostname: + description: "Hostname is the value to be used to + replace the Host header value during forwarding. + \n Support: Extended \n " + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + path: + description: "Path defines a path rewrite. \n Support: + Extended \n " + properties: + replaceFullPath: + description: "ReplaceFullPath specifies the value + with which to replace the full path of a request + during a rewrite or redirect. \n " + maxLength: 1024 + type: string + replacePrefixMatch: + description: "ReplacePrefixMatch specifies the + value with which to replace the prefix match + of a request during a rewrite or redirect. For + example, a request to \"/foo/bar\" with a prefix + match of \"/foo\" would be modified to \"/bar\". + \n Note that this matches the behavior of the + PathPrefix match type. This matches full path + elements. A path element refers to the list + of labels in the path split by the `/` separator. + When specified, a trailing `/` is ignored. For + example, the paths `/abc`, `/abc/`, and `/abc/def` + would all match the prefix `/abc`, but the path + `/abcd` would not. \n " + maxLength: 1024 + type: string + type: + description: "Type defines the type of path modifier. + Additional types may be added in a future release + of the API. \n " + enum: + - ReplaceFullPath + - ReplacePrefixMatch + type: string + required: + - type + type: object + type: object + required: + - type + type: object + maxItems: 16 + type: array + matches: + default: + - path: + type: PathPrefix + value: / + description: "Matches define conditions used for matching the + rule against incoming HTTP requests. Each match is independent, + i.e. this rule will be matched if **any** one of the matches + is satisfied. \n For example, take the following matches configuration: + \n ``` matches: - path: value: \"/foo\" headers: - + name: \"version\" value: \"v2\" - path: value: \"/v2/foo\" + ``` \n For a request to match against this rule, a request + must satisfy EITHER of the two conditions: \n - path prefixed + with `/foo` AND contains the header `version: v2` - path prefix + of `/v2/foo` \n See the documentation for HTTPRouteMatch on + how to specify multiple match conditions that should be ANDed + together. \n If no matches are specified, the default is a + prefix path match on \"/\", which has the effect of matching + every HTTP request. \n Proxy or Load Balancer routing configuration + generated from HTTPRoutes MUST prioritize rules based on the + following criteria, continuing on ties. Precedence must be + given to the the Rule with the largest number of: \n * Characters + in a matching non-wildcard hostname. * Characters in a matching + hostname. * Characters in a matching path. * Header matches. + * Query param matches. \n If ties still exist across multiple + Routes, matching precedence MUST be determined in order of + the following criteria, continuing on ties: \n * The oldest + Route based on creation timestamp. * The Route appearing first + in alphabetical order by \"{namespace}/{name}\". \n If ties + still exist within the Route that has been given precedence, + matching precedence MUST be granted to the first matching + rule meeting the above criteria. \n When no rules matching + a request have been successfully attached to the parent a + request is coming from, a HTTP 404 status code MUST be returned." + items: + description: "HTTPRouteMatch defines the predicate used to + match requests to a given action. Multiple match types are + ANDed together, i.e. the match will evaluate to true only + if all conditions are satisfied. \n For example, the match + below will match a HTTP request only if its path starts + with `/foo` AND it contains the `version: v1` header: \n + ``` match: path: value: \"/foo\" headers: - name: + \"version\" value \"v1\" ```" + properties: + headers: + description: Headers specifies HTTP request header matchers. + Multiple match values are ANDed together, meaning, a + request must match all the specified headers to select + the route. + items: + description: HTTPHeaderMatch describes how to select + a HTTP route by matching HTTP request headers. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case insensitive. + (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent header + names, only the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST be + ignored. Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered equivalent. + \n When a header is repeated in an HTTP request, + it is implementation-specific behavior as to how + this is represented. Generally, proxies should + follow the guidance from the RFC: https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 + regarding processing a repeated header, with special + handling for \"Set-Cookie\"." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + type: + default: Exact + description: "Type specifies how to match against + the value of the header. \n Support: Core (Exact) + \n Support: Custom (RegularExpression) \n Since + RegularExpression HeaderMatchType has custom conformance, + implementations can support POSIX, PCRE or any + other dialects of regular expressions. Please + read the implementation's documentation to determine + the supported dialect." + enum: + - Exact + - RegularExpression + type: string + value: + description: Value is the value of HTTP Header to + be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + method: + description: "Method specifies HTTP method matcher. When + specified, this route will be matched only if the request + has the specified method. \n Support: Extended" + enum: + - GET + - HEAD + - POST + - PUT + - DELETE + - CONNECT + - OPTIONS + - TRACE + - PATCH + type: string + path: + default: + type: PathPrefix + value: / + description: Path specifies a HTTP request path matcher. + If this field is not specified, a default prefix match + on the "/" path is provided. + properties: + type: + default: PathPrefix + description: "Type specifies how to match against + the path Value. \n Support: Core (Exact, PathPrefix) + \n Support: Custom (RegularExpression)" + enum: + - Exact + - PathPrefix + - RegularExpression + type: string + value: + default: / + description: Value of the HTTP path to match against. + maxLength: 1024 + type: string + type: object + queryParams: + description: QueryParams specifies HTTP query parameter + matchers. Multiple match values are ANDed together, + meaning, a request must match all the specified query + parameters to select the route. + items: + description: HTTPQueryParamMatch describes how to select + a HTTP route by matching HTTP query parameters. + properties: + name: + description: Name is the name of the HTTP query + param to be matched. This must be an exact string + match. (See https://tools.ietf.org/html/rfc7230#section-2.7.3). + maxLength: 256 + minLength: 1 + type: string + type: + default: Exact + description: "Type specifies how to match against + the value of the query parameter. \n Support: + Extended (Exact) \n Support: Custom (RegularExpression) + \n Since RegularExpression QueryParamMatchType + has custom conformance, implementations can support + POSIX, PCRE or any other dialects of regular expressions. + Please read the implementation's documentation + to determine the supported dialect." + enum: + - Exact + - RegularExpression + type: string + value: + description: Value is the value of HTTP query param + to be matched. + maxLength: 1024 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + maxItems: 8 + type: array + type: object + maxItems: 16 + type: array + type: object + status: + description: Status defines the current state of HTTPRoute. + properties: + parents: + description: "Parents is a list of parent resources (usually Gateways) + that are associated with the route, and the status of the route + with respect to each parent. When this route attaches to a parent, + the controller that manages the parent must add an entry to this + list when the controller first sees the route and should update + the entry as appropriate when the route or gateway is modified. + \n Note that parent references that cannot be resolved by an implementation + of this API will not be added to this list. Implementations of this + API can only populate Route status for the Gateways/parent resources + they are responsible for. \n A maximum of 32 Gateways will be represented + in this list. An empty list means the route has not been attached + to any Gateway." + items: + description: RouteParentStatus describes the status of a route with + respect to an associated Parent. + properties: + conditions: + description: "Conditions describes the status of the route with + respect to the Gateway. Note that the route's availability + is also subject to the Gateway's own status conditions and + listener status. \n If the Route's ParentRef specifies an + existing Gateway that supports Routes of this kind AND that + Gateway's controller has sufficient access, then that Gateway's + controller MUST set the \"Accepted\" condition on the Route, + to indicate whether the route has been accepted or rejected + by the Gateway, and why. \n A Route MUST be considered \"Accepted\" + if at least one of the Route's rules is implemented by the + Gateway. \n There are a number of cases where the \"Accepted\" + condition may not be set due to lack of controller visibility, + that includes when: \n * The Route refers to a non-existent + parent. * The Route is of a type that the controller does + not support. * The Route is in a namespace the the controller + does not have access to." + items: + description: "Condition contains details for one aspect of + the current state of this API Resource. --- This struct + is intended for direct use as an array at the field path + .status.conditions. For example, type FooStatus struct{ + \ // Represents the observations of a foo's current state. + \ // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // + +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should + be when the underlying condition changed. If that is + not known, then using the time when the API field changed + is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, + if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the + current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier + indicating the reason for the condition's last transition. + Producers of specific condition types may define expected + values and meanings for this field, and whether the + values are considered a guaranteed API. The value should + be a CamelCase string. This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across + resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability + to deconflict is important. The regex it matches is + (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + controllerName: + description: "ControllerName is a domain/path string that indicates + the name of the controller that wrote this status. This corresponds + with the controllerName field on GatewayClass. \n Example: + \"example.net/gateway-controller\". \n The format of this + field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid + Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). + \n Controllers MUST populate this field when writing status. + Controllers should ensure that entries to status populated + with their ControllerName are cleaned up when they are no + longer necessary." + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ + type: string + parentRef: + description: ParentRef corresponds with a ParentRef in the spec + that this RouteParentStatus struct describes the status of. + properties: + group: + default: gateway.networking.k8s.io + description: "Group is the group of the referent. \n Support: + Core" + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Gateway + description: "Kind is kind of the referent. \n Support: + Core (Gateway) Support: Custom (Other Resources)" + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: "Name is the name of the referent. \n Support: + Core" + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the referent. + When unspecified (or empty string), this refers to the + local namespace of the Route. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: "Port is the network port this Route targets. + It can be interpreted differently based on the type of + parent resource. \n When the parent resource is a Gateway, + this targets all listeners listening on the specified + port that also support this kind of Route(and select this + Route). It's not recommended to set `Port` unless the + networking behaviors specified in a Route must apply to + a specific port as opposed to a listener(s) whose port(s) + may be changed. When both Port and SectionName are specified, + the name and port of the selected listener must match + both specified values. \n Implementations MAY choose to + support other parent resources. Implementations supporting + other types of parent resources MUST clearly document + how/if Port is interpreted. \n For the purpose of status, + an attachment is considered successful as long as the + parent resource accepts it partially. For example, Gateway + listeners can restrict which Routes can attach to them + by Route kind, namespace, or hostname. If 1 of 2 Gateway + listeners accept attachment from the referencing Route, + the Route MUST be considered successfully attached. If + no Gateway listeners accept attachment from this Route, + the Route MUST be considered detached from the Gateway. + \n Support: Extended \n " + format: int32 + maximum: 65535 + minimum: 1 + type: integer + sectionName: + description: "SectionName is the name of a section within + the target resource. In the following resources, SectionName + is interpreted as the following: \n * Gateway: Listener + Name. When both Port (experimental) and SectionName are + specified, the name and port of the selected listener + must match both specified values. \n Implementations MAY + choose to support attaching Routes to other resources. + If that is the case, they MUST clearly document how SectionName + is interpreted. \n When unspecified (empty string), this + will reference the entire resource. For the purpose of + status, an attachment is considered successful if at least + one section in the parent resource accepts it. For example, + Gateway listeners can restrict which Routes can attach + to them by Route kind, namespace, or hostname. If 1 of + 2 Gateway listeners accept attachment from the referencing + Route, the Route MUST be considered successfully attached. + If no Gateway listeners accept attachment from this Route, + the Route MUST be considered detached from the Gateway. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - name + type: object + required: + - controllerName + - parentRef + type: object + maxItems: 32 + type: array + required: + - parents + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 85a0613078..f1f648e77e 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -1,8 +1,4 @@ resources: -- standard/gateway.networking.k8s.io_gatewayclasses.yaml -- standard/gateway.networking.k8s.io_gateways.yaml -- standard/gateway.networking.k8s.io_httproutes.yaml -- standard/gateway.networking.k8s.io_referencegrants.yaml -- standard/gateway.networking.k8s.io_tcproutes.yaml -- standard/gateway.networking.k8s.io_tlsroutes.yaml -- standard/gateway.networking.k8s.io_udproutes.yaml +- gateway.networking.k8s.io_gatewayclasses.yaml +- gateway.networking.k8s.io_gateways.yaml +- gateway.networking.k8s.io_httproutes.yaml \ No newline at end of file diff --git a/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml b/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml index addb458c21..9426382317 100644 --- a/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml @@ -221,6 +221,207 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.controllerName + name: Controller + type: string + - jsonPath: .status.conditions[?(@.type=="Accepted")].status + name: Accepted + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.description + name: Description + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: "GatewayClass describes a class of Gateways available to the + user for creating Gateway resources. \n It is recommended that this resource + be used as a template for Gateways. This means that a Gateway is based on + the state of the GatewayClass at the time it was created and changes to + the GatewayClass or associated parameters are not propagated down to existing + Gateways. This recommendation is intended to limit the blast radius of changes + to GatewayClass or associated parameters. If implementations choose to propagate + GatewayClass changes to existing Gateways, that MUST be clearly documented + by the implementation. \n Whenever one or more Gateways are using a GatewayClass, + implementations MUST add the `gateway-exists-finalizer.gateway.networking.k8s.io` + finalizer on the associated GatewayClass. This ensures that a GatewayClass + associated with a Gateway is not deleted while in use. \n GatewayClass is + a Cluster level resource." + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of GatewayClass. + properties: + controllerName: + description: "ControllerName is the name of the controller that is + managing Gateways of this class. The value of this field MUST be + a domain prefixed path. \n Example: \"example.net/gateway-controller\". + \n This field is not mutable and cannot be empty. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ + type: string + description: + description: Description helps describe a GatewayClass with more details. + maxLength: 64 + type: string + parametersRef: + description: "ParametersRef is a reference to a resource that contains + the configuration parameters corresponding to the GatewayClass. + This is optional if the controller does not require any additional + configuration. \n ParametersRef can reference a standard Kubernetes + resource, i.e. ConfigMap, or an implementation-specific custom resource. + The resource can be cluster-scoped or namespace-scoped. \n If the + referent cannot be found, the GatewayClass's \"InvalidParameters\" + status condition will be true. \n Support: Custom" + properties: + group: + description: Group is the group of the referent. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: Namespace is the namespace of the referent. This + field is required when referring to a Namespace-scoped resource + and MUST be unset when referring to a Cluster-scoped resource. + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - group + - kind + - name + type: object + required: + - controllerName + type: object + status: + default: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: Waiting + status: Unknown + type: Accepted + description: Status defines the current state of GatewayClass. + properties: + conditions: + default: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: Waiting + status: Unknown + type: Accepted + description: "Conditions is the current status from the controller + for this GatewayClass. \n Controllers should prefer to publish conditions + using values of GatewayClassConditionType for the type of each Condition." + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: + \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // +listMapKey=type + \ Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/standard/gateway.networking.k8s.io_gateways.yaml b/config/crd/standard/gateway.networking.k8s.io_gateways.yaml index 7356c0c5bb..93e9290867 100644 --- a/config/crd/standard/gateway.networking.k8s.io_gateways.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_gateways.yaml @@ -714,6 +714,694 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.gatewayClassName + name: Class + type: string + - jsonPath: .status.addresses[*].value + name: Address + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: Gateway represents an instance of a service-traffic handling + infrastructure by binding Listeners to a set of IP addresses. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of Gateway. + properties: + addresses: + description: "Addresses requested for this Gateway. This is optional + and behavior can depend on the implementation. If a value is set + in the spec and the requested address is invalid or unavailable, + the implementation MUST indicate this in the associated entry in + GatewayStatus.Addresses. \n The Addresses field represents a request + for the address(es) on the \"outside of the Gateway\", that traffic + bound for this Gateway will use. This could be the IP address or + hostname of an external load balancer or other networking infrastructure, + or some other address that traffic will be sent to. \n The .listener.hostname + field is used to route traffic that has already arrived at the Gateway + to the correct in-cluster destination. \n If no Addresses are specified, + the implementation MAY schedule the Gateway in an implementation-specific + manner, assigning an appropriate set of Addresses. \n The implementation + MUST bind all Listeners to every GatewayAddress that it assigns + to the Gateway and add a corresponding entry in GatewayStatus.Addresses. + \n Support: Extended" + items: + description: GatewayAddress describes an address that can be bound + to a Gateway. + properties: + type: + default: IPAddress + description: Type of the address. + type: string + value: + description: "Value of the address. The validity of the values + will depend on the type and support by the controller. \n + Examples: `1.2.3.4`, `128::1`, `my-ip-address`." + maxLength: 253 + minLength: 1 + type: string + required: + - value + type: object + maxItems: 16 + type: array + gatewayClassName: + description: GatewayClassName used for this Gateway. This is the name + of a GatewayClass resource. + maxLength: 253 + minLength: 1 + type: string + listeners: + description: "Listeners associated with this Gateway. Listeners define + logical endpoints that are bound on this Gateway's addresses. At + least one Listener MUST be specified. \n Each listener in a Gateway + must have a unique combination of Hostname, Port, and Protocol. + \n An implementation MAY group Listeners by Port and then collapse + each group of Listeners into a single Listener if the implementation + determines that the Listeners in the group are \"compatible\". An + implementation MAY also group together and collapse compatible Listeners + belonging to different Gateways. \n For example, an implementation + might consider Listeners to be compatible with each other if all + of the following conditions are met: \n 1. Either each Listener + within the group specifies the \"HTTP\" Protocol or each Listener + within the group specifies either the \"HTTPS\" or \"TLS\" Protocol. + \n 2. Each Listener within the group specifies a Hostname that is + unique within the group. \n 3. As a special case, one Listener + within a group may omit Hostname, in which case this Listener + matches when no other Listener matches. \n If the implementation + does collapse compatible Listeners, the hostname provided in the + incoming client request MUST be matched to a Listener to find the + correct set of Routes. The incoming hostname MUST be matched using + the Hostname field for each Listener in order of most to least specific. + That is, exact matches must be processed before wildcard matches. + \n If this field specifies multiple Listeners that have the same + Port value but are not compatible, the implementation must raise + a \"Conflicted\" condition in the Listener status. \n Support: Core" + items: + description: Listener embodies the concept of a logical endpoint + where a Gateway accepts network connections. + properties: + allowedRoutes: + default: + namespaces: + from: Same + description: "AllowedRoutes defines the types of routes that + MAY be attached to a Listener and the trusted namespaces where + those Route resources MAY be present. \n Although a client + request may match multiple route rules, only one rule may + ultimately receive the request. Matching precedence MUST be + determined in order of the following criteria: \n * The most + specific match as defined by the Route type. * The oldest + Route based on creation timestamp. For example, a Route with + \ a creation timestamp of \"2020-09-08 01:02:03\" is given + precedence over a Route with a creation timestamp of \"2020-09-08 + 01:02:04\". * If everything else is equivalent, the Route + appearing first in alphabetical order (namespace/name) should + be given precedence. For example, foo/bar is given precedence + over foo/baz. \n All valid rules within a Route attached to + this Listener should be implemented. Invalid Route rules can + be ignored (sometimes that will mean the full Route). If a + Route rule transitions from valid to invalid, support for + that Route rule should be dropped to ensure consistency. For + example, even if a filter specified by a Route rule is invalid, + the rest of the rules within that Route should still be supported. + \n Support: Core" + properties: + kinds: + description: "Kinds specifies the groups and kinds of Routes + that are allowed to bind to this Gateway Listener. When + unspecified or empty, the kinds of Routes selected are + determined using the Listener protocol. \n A RouteGroupKind + MUST correspond to kinds of Routes that are compatible + with the application protocol specified in the Listener's + Protocol field. If an implementation does not support + or recognize this resource type, it MUST set the \"ResolvedRefs\" + condition to False for this Listener with the \"InvalidRouteKinds\" + reason. \n Support: Core" + items: + description: RouteGroupKind indicates the group and kind + of a Route resource. + properties: + group: + default: gateway.networking.k8s.io + description: Group is the group of the Route. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is the kind of the Route. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + required: + - kind + type: object + maxItems: 8 + type: array + namespaces: + default: + from: Same + description: "Namespaces indicates namespaces from which + Routes may be attached to this Listener. This is restricted + to the namespace of this Gateway by default. \n Support: + Core" + properties: + from: + default: Same + description: "From indicates where Routes will be selected + for this Gateway. Possible values are: * All: Routes + in all namespaces may be used by this Gateway. * Selector: + Routes in namespaces selected by the selector may + be used by this Gateway. * Same: Only Routes in + the same namespace may be used by this Gateway. \n + Support: Core" + enum: + - All + - Selector + - Same + type: string + selector: + description: "Selector must be specified when From is + set to \"Selector\". In that case, only Routes in + Namespaces matching this Selector will be selected + by this Gateway. This field is ignored for other values + of \"From\". \n Support: Core" + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + type: object + type: object + hostname: + description: "Hostname specifies the virtual hostname to match + for protocol types that define this concept. When unspecified, + all hostnames are matched. This field is ignored for protocols + that don't require hostname based matching. \n Implementations + MUST apply Hostname matching appropriately for each of the + following protocols: \n * TLS: The Listener Hostname MUST + match the SNI. * HTTP: The Listener Hostname MUST match the + Host header of the request. * HTTPS: The Listener Hostname + SHOULD match at both the TLS and HTTP protocol layers as + described above. If an implementation does not ensure that + both the SNI and Host header match the Listener hostname, + \ it MUST clearly document that. \n For HTTPRoute and TLSRoute + resources, there is an interaction with the `spec.hostnames` + array. When both listener and route specify hostnames, there + MUST be an intersection between the values for a Route to + be accepted. For more information, refer to the Route specific + Hostnames documentation. \n Hostnames that are prefixed with + a wildcard label (`*.`) are interpreted as a suffix match. + That means that a match for `*.example.com` would match both + `test.example.com`, and `foo.test.example.com`, but not `example.com`. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + name: + description: "Name is the name of the Listener. This name MUST + be unique within a Gateway. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + port: + description: "Port is the network port. Multiple listeners may + use the same port, subject to the Listener compatibility rules. + \n Support: Core" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + protocol: + description: "Protocol specifies the network protocol this listener + expects to receive. \n Support: Core" + maxLength: 255 + minLength: 1 + pattern: ^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$ + type: string + tls: + description: "TLS is the TLS configuration for the Listener. + This field is required if the Protocol field is \"HTTPS\" + or \"TLS\". It is invalid to set this field if the Protocol + field is \"HTTP\", \"TCP\", or \"UDP\". \n The association + of SNIs to Certificate defined in GatewayTLSConfig is defined + based on the Hostname field for this listener. \n The GatewayClass + MUST use the longest matching SNI out of all available certificates + for any TLS handshake. \n Support: Core" + properties: + certificateRefs: + description: "CertificateRefs contains a series of references + to Kubernetes objects that contains TLS certificates and + private keys. These certificates are used to establish + a TLS handshake for requests that match the hostname of + the associated listener. \n A single CertificateRef to + a Kubernetes Secret has \"Core\" support. Implementations + MAY choose to support attaching multiple certificates + to a Listener, but this behavior is implementation-specific. + \n References to a resource in different namespace are + invalid UNLESS there is a ReferenceGrant in the target + namespace that allows the certificate to be attached. + If a ReferenceGrant does not allow this reference, the + \"ResolvedRefs\" condition MUST be set to False for this + listener with the \"InvalidCertificateRef\" reason. \n + This field is required to have at least one element when + the mode is set to \"Terminate\" (default) and is optional + otherwise. \n CertificateRefs can reference to standard + Kubernetes resources, i.e. Secret, or implementation-specific + custom resources. \n Support: Core - A single reference + to a Kubernetes Secret of type kubernetes.io/tls \n Support: + Implementation-specific (More than one reference or other + resource types)" + items: + description: "SecretObjectReference identifies an API + object including its namespace, defaulting to Secret. + \n The API object must be valid in the cluster; the + Group and Kind must be registered in the cluster for + this reference to be valid. \n References to objects + with invalid Group and Kind are not valid, and must + be rejected by the implementation, with appropriate + Conditions set on the containing object." + properties: + group: + default: "" + description: Group is the group of the referent. For + example, "networking.k8s.io". When unspecified (empty + string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Secret + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the backend. + When unspecified, the local namespace is inferred. + \n Note that when a namespace is specified, a ReferenceGrant + object is required in the referent namespace to + allow that namespace's owner to accept the reference. + See the ReferenceGrant documentation for details. + \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - name + type: object + maxItems: 64 + type: array + mode: + default: Terminate + description: "Mode defines the TLS behavior for the TLS + session initiated by the client. There are two possible + modes: \n - Terminate: The TLS session between the downstream + client and the Gateway is terminated at the Gateway. + This mode requires certificateRefs to be set and contain + at least one element. - Passthrough: The TLS session is + NOT terminated by the Gateway. This implies that the + Gateway can't decipher the TLS stream except for the + ClientHello message of the TLS protocol. CertificateRefs + field is ignored in this mode. \n Support: Core" + enum: + - Terminate + - Passthrough + type: string + options: + additionalProperties: + description: AnnotationValue is the value of an annotation + in Gateway API. This is used for validation of maps + such as TLS options. This roughly matches Kubernetes + annotation validation, although the length validation + in that case is based on the entire size of the annotations + struct. + maxLength: 4096 + minLength: 0 + type: string + description: "Options are a list of key/value pairs to enable + extended TLS configuration for each implementation. For + example, configuring the minimum TLS version or supported + cipher suites. \n A set of common keys MAY be defined + by the API in the future. To avoid any ambiguity, implementation-specific + definitions MUST use domain-prefixed names, such as `example.com/my-custom-option`. + Un-prefixed names are reserved for key names defined by + Gateway API. \n Support: Implementation-specific" + maxProperties: 16 + type: object + type: object + required: + - name + - port + - protocol + type: object + maxItems: 64 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + required: + - gatewayClassName + - listeners + type: object + status: + default: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: NotReconciled + status: Unknown + type: Scheduled + description: Status defines the current state of Gateway. + properties: + addresses: + description: Addresses lists the IP addresses that have actually been + bound to the Gateway. These addresses may differ from the addresses + in the Spec, e.g. if the Gateway automatically assigns an address + from a reserved pool. + items: + description: GatewayAddress describes an address that can be bound + to a Gateway. + properties: + type: + default: IPAddress + description: Type of the address. + type: string + value: + description: "Value of the address. The validity of the values + will depend on the type and support by the controller. \n + Examples: `1.2.3.4`, `128::1`, `my-ip-address`." + maxLength: 253 + minLength: 1 + type: string + required: + - value + type: object + maxItems: 16 + type: array + conditions: + default: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: Waiting for controller + reason: NotReconciled + status: Unknown + type: Scheduled + description: "Conditions describe the current conditions of the Gateway. + \n Implementations should prefer to express Gateway conditions using + the `GatewayConditionType` and `GatewayConditionReason` constants + so that operators and tools can converge on a common vocabulary + to describe Gateway state. \n Known condition types are: \n * \"Scheduled\" + * \"Ready\"" + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: + \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // +listMapKey=type + \ Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + listeners: + description: Listeners provide status for each unique listener port + defined in the Spec. + items: + description: ListenerStatus is the status associated with a Listener. + properties: + attachedRoutes: + description: AttachedRoutes represents the total number of Routes + that have been successfully attached to this Listener. + format: int32 + type: integer + conditions: + description: Conditions describe the current condition of this + listener. + items: + description: "Condition contains details for one aspect of + the current state of this API Resource. --- This struct + is intended for direct use as an array at the field path + .status.conditions. For example, type FooStatus struct{ + \ // Represents the observations of a foo's current state. + \ // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // + +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should + be when the underlying condition changed. If that is + not known, then using the time when the API field changed + is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, + if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the + current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier + indicating the reason for the condition's last transition. + Producers of specific condition types may define expected + values and meanings for this field, and whether the + values are considered a guaranteed API. The value should + be a CamelCase string. This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across + resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability + to deconflict is important. The regex it matches is + (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + name: + description: Name is the name of the Listener that this status + corresponds to. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + supportedKinds: + description: "SupportedKinds is the list indicating the Kinds + supported by this listener. This MUST represent the kinds + an implementation supports for that Listener configuration. + \n If kinds are specified in Spec that are not supported, + they MUST NOT appear in this list and an implementation MUST + set the \"ResolvedRefs\" condition to \"False\" with the \"InvalidRouteKinds\" + reason. If both valid and invalid Route kinds are specified, + the implementation MUST reference the valid Route kinds that + have been specified." + items: + description: RouteGroupKind indicates the group and kind of + a Route resource. + properties: + group: + default: gateway.networking.k8s.io + description: Group is the group of the Route. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is the kind of the Route. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + required: + - kind + type: object + maxItems: 8 + type: array + required: + - attachedRoutes + - conditions + - name + - supportedKinds + type: object + maxItems: 64 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml index e5abe435ec..49483b8c87 100644 --- a/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml @@ -1305,6 +1305,1293 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.hostnames + name: Hostnames + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: HTTPRoute provides a way to route HTTP requests. This includes + the capability to match requests by hostname, path, header, or query param. + Filters can be used to specify additional processing steps. Backends specify + where matching requests should be routed. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec defines the desired state of HTTPRoute. + properties: + hostnames: + description: "Hostnames defines a set of hostname that should match + against the HTTP Host header to select a HTTPRoute to process the + request. This matches the RFC 1123 definition of a hostname with + 2 notable exceptions: \n 1. IPs are not allowed. 2. A hostname may + be prefixed with a wildcard label (`*.`). The wildcard label + must appear by itself as the first label. \n If a hostname is specified + by both the Listener and HTTPRoute, there must be at least one intersecting + hostname for the HTTPRoute to be attached to the Listener. For example: + \n * A Listener with `test.example.com` as the hostname matches + HTTPRoutes that have either not specified any hostnames, or have + specified at least one of `test.example.com` or `*.example.com`. + * A Listener with `*.example.com` as the hostname matches HTTPRoutes + \ that have either not specified any hostnames or have specified + at least one hostname that matches the Listener hostname. For + example, `*.example.com`, `test.example.com`, and `foo.test.example.com` + would all match. On the other hand, `example.com` and `test.example.net` + would not match. \n Hostnames that are prefixed with a wildcard + label (`*.`) are interpreted as a suffix match. That means that + a match for `*.example.com` would match both `test.example.com`, + and `foo.test.example.com`, but not `example.com`. \n If both the + Listener and HTTPRoute have specified hostnames, any HTTPRoute hostnames + that do not match the Listener hostname MUST be ignored. For example, + if a Listener specified `*.example.com`, and the HTTPRoute specified + `test.example.com` and `test.example.net`, `test.example.net` must + not be considered for a match. \n If both the Listener and HTTPRoute + have specified hostnames, and none match with the criteria above, + then the HTTPRoute is not accepted. The implementation must raise + an 'Accepted' Condition with a status of `False` in the corresponding + RouteParentStatus. \n Support: Core" + items: + description: "Hostname is the fully qualified domain name of a network + host. This matches the RFC 1123 definition of a hostname with + 2 notable exceptions: \n 1. IPs are not allowed. 2. A hostname + may be prefixed with a wildcard label (`*.`). The wildcard label + must appear by itself as the first label. \n Hostname can be \"precise\" + which is a domain name without the terminating dot of a network + host (e.g. \"foo.example.com\") or \"wildcard\", which is a domain + name prefixed with a single wildcard label (e.g. `*.example.com`). + \n Note that as per RFC1035 and RFC1123, a *label* must consist + of lower case alphanumeric characters or '-', and must start and + end with an alphanumeric character. No other punctuation is allowed." + maxLength: 253 + minLength: 1 + pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + maxItems: 16 + type: array + parentRefs: + description: "ParentRefs references the resources (usually Gateways) + that a Route wants to be attached to. Note that the referenced parent + resource needs to allow this for the attachment to be complete. + For Gateways, that means the Gateway needs to allow attachment from + Routes of this kind and namespace. \n The only kind of parent resource + with \"Core\" support is Gateway. This API may be extended in the + future to support additional kinds of parent resources such as one + of the route kinds. \n It is invalid to reference an identical parent + more than once. It is valid to reference multiple distinct sections + within the same parent resource, such as 2 Listeners within a Gateway. + \n It is possible to separately reference multiple distinct objects + that may be collapsed by an implementation. For example, some implementations + may choose to merge compatible Gateway Listeners together. If that + is the case, the list of routes attached to those resources should + also be merged." + items: + description: "ParentReference identifies an API object (usually + a Gateway) that can be considered a parent of this resource (usually + a route). The only kind of parent resource with \"Core\" support + is Gateway. This API may be extended in the future to support + additional kinds of parent resources, such as HTTPRoute. \n The + API object must be valid in the cluster; the Group and Kind must + be registered in the cluster for this reference to be valid." + properties: + group: + default: gateway.networking.k8s.io + description: "Group is the group of the referent. \n Support: + Core" + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Gateway + description: "Kind is kind of the referent. \n Support: Core + (Gateway) Support: Custom (Other Resources)" + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: "Name is the name of the referent. \n Support: + Core" + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the referent. When + unspecified (or empty string), this refers to the local namespace + of the Route. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + sectionName: + description: "SectionName is the name of a section within the + target resource. In the following resources, SectionName is + interpreted as the following: \n * Gateway: Listener Name. + When both Port (experimental) and SectionName are specified, + the name and port of the selected listener must match both + specified values. \n Implementations MAY choose to support + attaching Routes to other resources. If that is the case, + they MUST clearly document how SectionName is interpreted. + \n When unspecified (empty string), this will reference the + entire resource. For the purpose of status, an attachment + is considered successful if at least one section in the parent + resource accepts it. For example, Gateway listeners can restrict + which Routes can attach to them by Route kind, namespace, + or hostname. If 1 of 2 Gateway listeners accept attachment + from the referencing Route, the Route MUST be considered successfully + attached. If no Gateway listeners accept attachment from this + Route, the Route MUST be considered detached from the Gateway. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - name + type: object + maxItems: 32 + type: array + rules: + default: + - matches: + - path: + type: PathPrefix + value: / + description: Rules are a list of HTTP matchers, filters and actions. + items: + description: HTTPRouteRule defines semantics for matching an HTTP + request based on conditions (matches), processing it (filters), + and forwarding the request to an API object (backendRefs). + properties: + backendRefs: + description: "BackendRefs defines the backend(s) where matching + requests should be sent. \n A 404 status code MUST be returned + if there are no BackendRefs or filters specified that would + result in a response being sent. \n A BackendRef is considered + invalid when it refers to: \n * an unknown or unsupported + kind of resource * a resource that does not exist * a resource + in another namespace when the reference has not been explicitly + allowed by a ReferenceGrant (or equivalent concept). \n When + a BackendRef is invalid, 404 status codes MUST be returned + for requests that would have otherwise been routed to an invalid + backend. If multiple backends are specified, and some are + invalid, the proportion of requests that would otherwise have + been routed to an invalid backend MUST receive a 404 status + code. \n When a BackendRef refers to a Service that has no + ready endpoints, it is recommended to return a 503 status + code. \n Support: Core for Kubernetes Service Support: Custom + for any other resource \n Support for weight: Core" + items: + description: HTTPBackendRef defines how a HTTPRoute should + forward an HTTP request. + properties: + filters: + description: "Filters defined at this level should be + executed if and only if the request is being forwarded + to the backend defined here. \n Support: Custom (For + broader support of filters, use the Filters field in + HTTPRouteRule.)" + items: + description: HTTPRouteFilter defines processing steps + that must be completed during the request or response + lifecycle. HTTPRouteFilters are meant as an extension + point to express processing that may be done in Gateway + implementations. Some examples include request or + response modification, implementing authentication + strategies, rate-limiting, and traffic shaping. API + guarantee/conformance is defined based on the type + of the filter. + properties: + extensionRef: + description: "ExtensionRef is an optional, implementation-specific + extension to the \"filter\" behavior. For example, + resource \"myroutefilter\" in group \"networking.example.net\"). + ExtensionRef MUST NOT be used for core and extended + filters. \n Support: Implementation-specific" + properties: + group: + description: Group is the group of the referent. + For example, "networking.k8s.io". When unspecified + (empty string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. For + example "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + requestHeaderModifier: + description: "RequestHeaderModifier defines a schema + for a filter that modifies request headers. \n + Support: Core" + properties: + add: + description: "Add adds the given header(s) (name, + value) to the request before the action. It + appends to any existing values associated + with the header name. \n Input: GET /foo + HTTP/1.1 my-header: foo \n Config: add: + \ - name: \"my-header\" value: \"bar\" + \n Output: GET /foo HTTP/1.1 my-header: + foo my-header: bar" + items: + description: HTTPHeader represents an HTTP + Header name and value as defined by RFC + 7230. + properties: + name: + description: "Name is the name of the + HTTP Header to be matched. Name matching + MUST be case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an + equivalent name MUST be considered for + a match. Subsequent entries with an + equivalent header name MUST be ignored. + Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP + Header to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + remove: + description: "Remove the given header(s) from + the HTTP request before the action. The value + of Remove is a list of HTTP header names. + Note that the header names are case-insensitive + (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + \n Input: GET /foo HTTP/1.1 my-header1: + foo my-header2: bar my-header3: baz \n + Config: remove: [\"my-header1\", \"my-header3\"] + \n Output: GET /foo HTTP/1.1 my-header2: + bar" + items: + type: string + maxItems: 16 + type: array + set: + description: "Set overwrites the request with + the given header (name, value) before the + action. \n Input: GET /foo HTTP/1.1 my-header: + foo \n Config: set: - name: \"my-header\" + \ value: \"bar\" \n Output: GET /foo + HTTP/1.1 my-header: bar" + items: + description: HTTPHeader represents an HTTP + Header name and value as defined by RFC + 7230. + properties: + name: + description: "Name is the name of the + HTTP Header to be matched. Name matching + MUST be case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an + equivalent name MUST be considered for + a match. Subsequent entries with an + equivalent header name MUST be ignored. + Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP + Header to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + requestMirror: + description: "RequestMirror defines a schema for + a filter that mirrors requests. Requests are sent + to the specified destination, but responses from + that destination are ignored. \n Support: Extended" + properties: + backendRef: + description: "BackendRef references a resource + where mirrored requests are sent. \n If the + referent cannot be found, this BackendRef + is invalid and must be dropped from the Gateway. + The controller must ensure the \"ResolvedRefs\" + condition on the Route status is set to `status: + False` and not configure this backend in the + underlying implementation. \n If there is + a cross-namespace reference to an *existing* + object that is not allowed by a ReferenceGrant, + the controller must ensure the \"ResolvedRefs\" + \ condition on the Route is set to `status: + False`, with the \"RefNotPermitted\" reason + and not configure this backend in the underlying + implementation. \n In either error case, the + Message of the `ResolvedRefs` Condition should + be used to provide more detail about the problem. + \n Support: Extended for Kubernetes Service + Support: Custom for any other resource" + properties: + group: + default: "" + description: Group is the group of the referent. + For example, "networking.k8s.io". When + unspecified (empty string), core API group + is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. + For example "HTTPRoute" or "Service". + Defaults to "Service" when not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace + of the backend. When unspecified, the + local namespace is inferred. \n Note that + when a namespace is specified, a ReferenceGrant + object is required in the referent namespace + to allow that namespace's owner to accept + the reference. See the ReferenceGrant + documentation for details. \n Support: + Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination + port number to use for this resource. + Port is required when the referent is + a Kubernetes Service. For other resources, + destination port might be derived from + the referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - name + type: object + required: + - backendRef + type: object + requestRedirect: + description: "RequestRedirect defines a schema for + a filter that responds to the request with an + HTTP redirection. \n Support: Core" + properties: + hostname: + description: "Hostname is the hostname to be + used in the value of the `Location` header + in the response. When empty, the hostname + of the request is used. \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + port: + description: "Port is the port to be used in + the value of the `Location` header in the + response. When empty, port (if specified) + of the request is used. \n Support: Extended" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + scheme: + description: "Scheme is the scheme to be used + in the value of the `Location` header in the + response. When empty, the scheme of the request + is used. \n Support: Extended" + enum: + - http + - https + type: string + statusCode: + default: 302 + description: "StatusCode is the HTTP status + code to be used in response. \n Support: Core" + enum: + - 301 + - 302 + type: integer + type: object + type: + description: "Type identifies the type of filter + to apply. As with other API fields, types are + classified into three conformance levels: \n - + Core: Filter types and their corresponding configuration + defined by \"Support: Core\" in this package, + e.g. \"RequestHeaderModifier\". All implementations + must support core filters. \n - Extended: Filter + types and their corresponding configuration defined + by \"Support: Extended\" in this package, e.g. + \"RequestMirror\". Implementers are encouraged + to support extended filters. \n - Custom: Filters + that are defined and supported by specific vendors. + \ In the future, filters showing convergence + in behavior across multiple implementations + will be considered for inclusion in extended or + core conformance levels. Filter-specific configuration + for such filters is specified using the ExtensionRef + field. `Type` should be set to \"ExtensionRef\" + for custom filters. \n Implementers are encouraged + to define custom implementation types to extend + the core API with implementation-specific behavior. + \n If a reference to a custom filter type cannot + be resolved, the filter MUST NOT be skipped. Instead, + requests that would have been processed by that + filter MUST receive a HTTP error response. \n " + enum: + - RequestHeaderModifier + - RequestMirror + - RequestRedirect + - ExtensionRef + type: string + required: + - type + type: object + maxItems: 16 + type: array + group: + default: "" + description: Group is the group of the referent. For example, + "networking.k8s.io". When unspecified (empty string), + core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". Defaults to "Service" when + not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the backend. + When unspecified, the local namespace is inferred. \n + Note that when a namespace is specified, a ReferenceGrant + object is required in the referent namespace to allow + that namespace's owner to accept the reference. See + the ReferenceGrant documentation for details. \n Support: + Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port might be derived from the referent + resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + weight: + default: 1 + description: "Weight specifies the proportion of requests + forwarded to the referenced backend. This is computed + as weight/(sum of all weights in this BackendRefs list). + For non-zero values, there may be some epsilon from + the exact proportion defined here depending on the precision + an implementation supports. Weight is not a percentage + and the sum of weights does not need to equal 100. \n + If only one backend is specified and it has a weight + greater than 0, 100% of the traffic is forwarded to + that backend. If weight is set to 0, no traffic should + be forwarded for this entry. If unspecified, weight + defaults to 1. \n Support for this field varies based + on the context where used." + format: int32 + maximum: 1000000 + minimum: 0 + type: integer + required: + - name + type: object + maxItems: 16 + type: array + filters: + description: "Filters define the filters that are applied to + requests that match this rule. \n The effects of ordering + of multiple behaviors are currently unspecified. This can + change in the future based on feedback during the alpha stage. + \n Conformance-levels at this level are defined based on the + type of filter: \n - ALL core filters MUST be supported by + all implementations. - Implementers are encouraged to support + extended filters. - Implementation-specific custom filters + have no API guarantees across implementations. \n Specifying + a core filter multiple times has unspecified or custom conformance. + \n All filters are expected to be compatible with each other + except for the URLRewrite and RequestRedirect filters, which + may not be combined. If an implementation can not support + other combinations of filters, they must clearly document + that limitation. In all cases where incompatible or unsupported + filters are specified, implementations MUST add a warning + condition to status. \n Support: Core" + items: + description: HTTPRouteFilter defines processing steps that + must be completed during the request or response lifecycle. + HTTPRouteFilters are meant as an extension point to express + processing that may be done in Gateway implementations. + Some examples include request or response modification, + implementing authentication strategies, rate-limiting, and + traffic shaping. API guarantee/conformance is defined based + on the type of the filter. + properties: + extensionRef: + description: "ExtensionRef is an optional, implementation-specific + extension to the \"filter\" behavior. For example, + resource \"myroutefilter\" in group \"networking.example.net\"). + ExtensionRef MUST NOT be used for core and extended + filters. \n Support: Implementation-specific" + properties: + group: + description: Group is the group of the referent. For + example, "networking.k8s.io". When unspecified (empty + string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the referent. For example + "HTTPRoute" or "Service". + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + requestHeaderModifier: + description: "RequestHeaderModifier defines a schema for + a filter that modifies request headers. \n Support: + Core" + properties: + add: + description: "Add adds the given header(s) (name, + value) to the request before the action. It appends + to any existing values associated with the header + name. \n Input: GET /foo HTTP/1.1 my-header: + foo \n Config: add: - name: \"my-header\" value: + \"bar\" \n Output: GET /foo HTTP/1.1 my-header: + foo my-header: bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST + be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + remove: + description: "Remove the given header(s) from the + HTTP request before the action. The value of Remove + is a list of HTTP header names. Note that the header + names are case-insensitive (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + \n Input: GET /foo HTTP/1.1 my-header1: foo + \ my-header2: bar my-header3: baz \n Config: + \ remove: [\"my-header1\", \"my-header3\"] \n Output: + \ GET /foo HTTP/1.1 my-header2: bar" + items: + type: string + maxItems: 16 + type: array + set: + description: "Set overwrites the request with the + given header (name, value) before the action. \n + Input: GET /foo HTTP/1.1 my-header: foo \n Config: + \ set: - name: \"my-header\" value: \"bar\" + \n Output: GET /foo HTTP/1.1 my-header: bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST + be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + requestMirror: + description: "RequestMirror defines a schema for a filter + that mirrors requests. Requests are sent to the specified + destination, but responses from that destination are + ignored. \n Support: Extended" + properties: + backendRef: + description: "BackendRef references a resource where + mirrored requests are sent. \n If the referent cannot + be found, this BackendRef is invalid and must be + dropped from the Gateway. The controller must ensure + the \"ResolvedRefs\" condition on the Route status + is set to `status: False` and not configure this + backend in the underlying implementation. \n If + there is a cross-namespace reference to an *existing* + object that is not allowed by a ReferenceGrant, + the controller must ensure the \"ResolvedRefs\" + \ condition on the Route is set to `status: False`, + with the \"RefNotPermitted\" reason and not configure + this backend in the underlying implementation. \n + In either error case, the Message of the `ResolvedRefs` + Condition should be used to provide more detail + about the problem. \n Support: Extended for Kubernetes + Service Support: Custom for any other resource" + properties: + group: + default: "" + description: Group is the group of the referent. + For example, "networking.k8s.io". When unspecified + (empty string), core API group is inferred. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Service + description: Kind is kind of the referent. For + example "HTTPRoute" or "Service". Defaults to + "Service" when not specified. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the + backend. When unspecified, the local namespace + is inferred. \n Note that when a namespace is + specified, a ReferenceGrant object is required + in the referent namespace to allow that namespace's + owner to accept the reference. See the ReferenceGrant + documentation for details. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + port: + description: Port specifies the destination port + number to use for this resource. Port is required + when the referent is a Kubernetes Service. For + other resources, destination port might be derived + from the referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - name + type: object + required: + - backendRef + type: object + requestRedirect: + description: "RequestRedirect defines a schema for a filter + that responds to the request with an HTTP redirection. + \n Support: Core" + properties: + hostname: + description: "Hostname is the hostname to be used + in the value of the `Location` header in the response. + When empty, the hostname of the request is used. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + port: + description: "Port is the port to be used in the value + of the `Location` header in the response. When empty, + port (if specified) of the request is used. \n Support: + Extended" + format: int32 + maximum: 65535 + minimum: 1 + type: integer + scheme: + description: "Scheme is the scheme to be used in the + value of the `Location` header in the response. + When empty, the scheme of the request is used. \n + Support: Extended" + enum: + - http + - https + type: string + statusCode: + default: 302 + description: "StatusCode is the HTTP status code to + be used in response. \n Support: Core" + enum: + - 301 + - 302 + type: integer + type: object + type: + description: "Type identifies the type of filter to apply. + As with other API fields, types are classified into + three conformance levels: \n - Core: Filter types and + their corresponding configuration defined by \"Support: + Core\" in this package, e.g. \"RequestHeaderModifier\". + All implementations must support core filters. \n + - Extended: Filter types and their corresponding configuration + defined by \"Support: Extended\" in this package, + e.g. \"RequestMirror\". Implementers are encouraged + to support extended filters. \n - Custom: Filters that + are defined and supported by specific vendors. In + the future, filters showing convergence in behavior + across multiple implementations will be considered + for inclusion in extended or core conformance levels. + Filter-specific configuration for such filters is + specified using the ExtensionRef field. `Type` should + be set to \"ExtensionRef\" for custom filters. \n + Implementers are encouraged to define custom implementation + types to extend the core API with implementation-specific + behavior. \n If a reference to a custom filter type + cannot be resolved, the filter MUST NOT be skipped. + Instead, requests that would have been processed by + that filter MUST receive a HTTP error response. \n " + enum: + - RequestHeaderModifier + - RequestMirror + - RequestRedirect + - ExtensionRef + type: string + required: + - type + type: object + maxItems: 16 + type: array + matches: + default: + - path: + type: PathPrefix + value: / + description: "Matches define conditions used for matching the + rule against incoming HTTP requests. Each match is independent, + i.e. this rule will be matched if **any** one of the matches + is satisfied. \n For example, take the following matches configuration: + \n ``` matches: - path: value: \"/foo\" headers: - + name: \"version\" value: \"v2\" - path: value: \"/v2/foo\" + ``` \n For a request to match against this rule, a request + must satisfy EITHER of the two conditions: \n - path prefixed + with `/foo` AND contains the header `version: v2` - path prefix + of `/v2/foo` \n See the documentation for HTTPRouteMatch on + how to specify multiple match conditions that should be ANDed + together. \n If no matches are specified, the default is a + prefix path match on \"/\", which has the effect of matching + every HTTP request. \n Proxy or Load Balancer routing configuration + generated from HTTPRoutes MUST prioritize rules based on the + following criteria, continuing on ties. Precedence must be + given to the the Rule with the largest number of: \n * Characters + in a matching non-wildcard hostname. * Characters in a matching + hostname. * Characters in a matching path. * Header matches. + * Query param matches. \n If ties still exist across multiple + Routes, matching precedence MUST be determined in order of + the following criteria, continuing on ties: \n * The oldest + Route based on creation timestamp. * The Route appearing first + in alphabetical order by \"{namespace}/{name}\". \n If ties + still exist within the Route that has been given precedence, + matching precedence MUST be granted to the first matching + rule meeting the above criteria. \n When no rules matching + a request have been successfully attached to the parent a + request is coming from, a HTTP 404 status code MUST be returned." + items: + description: "HTTPRouteMatch defines the predicate used to + match requests to a given action. Multiple match types are + ANDed together, i.e. the match will evaluate to true only + if all conditions are satisfied. \n For example, the match + below will match a HTTP request only if its path starts + with `/foo` AND it contains the `version: v1` header: \n + ``` match: path: value: \"/foo\" headers: - name: + \"version\" value \"v1\" ```" + properties: + headers: + description: Headers specifies HTTP request header matchers. + Multiple match values are ANDed together, meaning, a + request must match all the specified headers to select + the route. + items: + description: HTTPHeaderMatch describes how to select + a HTTP route by matching HTTP request headers. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case insensitive. + (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent header + names, only the first entry with an equivalent + name MUST be considered for a match. Subsequent + entries with an equivalent header name MUST be + ignored. Due to the case-insensitivity of header + names, \"foo\" and \"Foo\" are considered equivalent. + \n When a header is repeated in an HTTP request, + it is implementation-specific behavior as to how + this is represented. Generally, proxies should + follow the guidance from the RFC: https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 + regarding processing a repeated header, with special + handling for \"Set-Cookie\"." + maxLength: 256 + minLength: 1 + pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$ + type: string + type: + default: Exact + description: "Type specifies how to match against + the value of the header. \n Support: Core (Exact) + \n Support: Custom (RegularExpression) \n Since + RegularExpression HeaderMatchType has custom conformance, + implementations can support POSIX, PCRE or any + other dialects of regular expressions. Please + read the implementation's documentation to determine + the supported dialect." + enum: + - Exact + - RegularExpression + type: string + value: + description: Value is the value of HTTP Header to + be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + method: + description: "Method specifies HTTP method matcher. When + specified, this route will be matched only if the request + has the specified method. \n Support: Extended" + enum: + - GET + - HEAD + - POST + - PUT + - DELETE + - CONNECT + - OPTIONS + - TRACE + - PATCH + type: string + path: + default: + type: PathPrefix + value: / + description: Path specifies a HTTP request path matcher. + If this field is not specified, a default prefix match + on the "/" path is provided. + properties: + type: + default: PathPrefix + description: "Type specifies how to match against + the path Value. \n Support: Core (Exact, PathPrefix) + \n Support: Custom (RegularExpression)" + enum: + - Exact + - PathPrefix + - RegularExpression + type: string + value: + default: / + description: Value of the HTTP path to match against. + maxLength: 1024 + type: string + type: object + queryParams: + description: QueryParams specifies HTTP query parameter + matchers. Multiple match values are ANDed together, + meaning, a request must match all the specified query + parameters to select the route. + items: + description: HTTPQueryParamMatch describes how to select + a HTTP route by matching HTTP query parameters. + properties: + name: + description: Name is the name of the HTTP query + param to be matched. This must be an exact string + match. (See https://tools.ietf.org/html/rfc7230#section-2.7.3). + maxLength: 256 + minLength: 1 + type: string + type: + default: Exact + description: "Type specifies how to match against + the value of the query parameter. \n Support: + Extended (Exact) \n Support: Custom (RegularExpression) + \n Since RegularExpression QueryParamMatchType + has custom conformance, implementations can support + POSIX, PCRE or any other dialects of regular expressions. + Please read the implementation's documentation + to determine the supported dialect." + enum: + - Exact + - RegularExpression + type: string + value: + description: Value is the value of HTTP query param + to be matched. + maxLength: 1024 + minLength: 1 + type: string + required: + - name + - value + type: object + maxItems: 16 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + maxItems: 8 + type: array + type: object + maxItems: 16 + type: array + type: object + status: + description: Status defines the current state of HTTPRoute. + properties: + parents: + description: "Parents is a list of parent resources (usually Gateways) + that are associated with the route, and the status of the route + with respect to each parent. When this route attaches to a parent, + the controller that manages the parent must add an entry to this + list when the controller first sees the route and should update + the entry as appropriate when the route or gateway is modified. + \n Note that parent references that cannot be resolved by an implementation + of this API will not be added to this list. Implementations of this + API can only populate Route status for the Gateways/parent resources + they are responsible for. \n A maximum of 32 Gateways will be represented + in this list. An empty list means the route has not been attached + to any Gateway." + items: + description: RouteParentStatus describes the status of a route with + respect to an associated Parent. + properties: + conditions: + description: "Conditions describes the status of the route with + respect to the Gateway. Note that the route's availability + is also subject to the Gateway's own status conditions and + listener status. \n If the Route's ParentRef specifies an + existing Gateway that supports Routes of this kind AND that + Gateway's controller has sufficient access, then that Gateway's + controller MUST set the \"Accepted\" condition on the Route, + to indicate whether the route has been accepted or rejected + by the Gateway, and why. \n A Route MUST be considered \"Accepted\" + if at least one of the Route's rules is implemented by the + Gateway. \n There are a number of cases where the \"Accepted\" + condition may not be set due to lack of controller visibility, + that includes when: \n * The Route refers to a non-existent + parent. * The Route is of a type that the controller does + not support. * The Route is in a namespace the the controller + does not have access to." + items: + description: "Condition contains details for one aspect of + the current state of this API Resource. --- This struct + is intended for direct use as an array at the field path + .status.conditions. For example, type FooStatus struct{ + \ // Represents the observations of a foo's current state. + \ // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type + \ // +patchStrategy=merge // +listType=map // + +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should + be when the underlying condition changed. If that is + not known, then using the time when the API field changed + is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, + if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the + current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier + indicating the reason for the condition's last transition. + Producers of specific condition types may define expected + values and meanings for this field, and whether the + values are considered a guaranteed API. The value should + be a CamelCase string. This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across + resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability + to deconflict is important. The regex it matches is + (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 8 + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + controllerName: + description: "ControllerName is a domain/path string that indicates + the name of the controller that wrote this status. This corresponds + with the controllerName field on GatewayClass. \n Example: + \"example.net/gateway-controller\". \n The format of this + field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid + Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). + \n Controllers MUST populate this field when writing status. + Controllers should ensure that entries to status populated + with their ControllerName are cleaned up when they are no + longer necessary." + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ + type: string + parentRef: + description: ParentRef corresponds with a ParentRef in the spec + that this RouteParentStatus struct describes the status of. + properties: + group: + default: gateway.networking.k8s.io + description: "Group is the group of the referent. \n Support: + Core" + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + default: Gateway + description: "Kind is kind of the referent. \n Support: + Core (Gateway) Support: Custom (Other Resources)" + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: "Name is the name of the referent. \n Support: + Core" + maxLength: 253 + minLength: 1 + type: string + namespace: + description: "Namespace is the namespace of the referent. + When unspecified (or empty string), this refers to the + local namespace of the Route. \n Support: Core" + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + sectionName: + description: "SectionName is the name of a section within + the target resource. In the following resources, SectionName + is interpreted as the following: \n * Gateway: Listener + Name. When both Port (experimental) and SectionName are + specified, the name and port of the selected listener + must match both specified values. \n Implementations MAY + choose to support attaching Routes to other resources. + If that is the case, they MUST clearly document how SectionName + is interpreted. \n When unspecified (empty string), this + will reference the entire resource. For the purpose of + status, an attachment is considered successful if at least + one section in the parent resource accepts it. For example, + Gateway listeners can restrict which Routes can attach + to them by Route kind, namespace, or hostname. If 1 of + 2 Gateway listeners accept attachment from the referencing + Route, the Route MUST be considered successfully attached. + If no Gateway listeners accept attachment from this Route, + the Route MUST be considered detached from the Gateway. + \n Support: Core" + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - name + type: object + required: + - controllerName + - parentRef + type: object + maxItems: 32 + type: array + required: + - parents + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml b/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml deleted file mode 100644 index c599fb2c06..0000000000 --- a/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml +++ /dev/null @@ -1,145 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891 - gateway.networking.k8s.io/bundle-version: v0.5.0-dev - gateway.networking.k8s.io/channel: standard - creationTimestamp: null - name: referencegrants.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: ReferenceGrant - listKind: ReferenceGrantList - plural: referencegrants - shortNames: - - refgrant - singular: referencegrant - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: "ReferenceGrant identifies kinds of resources in other namespaces - that are trusted to reference the specified kinds of resources in the same - namespace as the policy. \n Each ReferenceGrant can be used to represent - a unique trust relationship. Additional Reference Policies can be used to - add to the set of trusted sources of inbound references for the namespace - they are defined within. \n All cross-namespace references in Gateway API - (with the exception of cross-namespace Gateway-route attachment) require - a ReferenceGrant. \n Support: Core" - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the desired state of ReferenceGrant. - properties: - from: - description: "From describes the trusted namespaces and kinds that - can reference the resources described in \"To\". Each entry in this - list must be considered to be an additional place that references - can be valid from, or to put this another way, entries must be combined - using OR. \n Support: Core" - items: - description: ReferenceGrantFrom describes trusted namespaces and - kinds. - properties: - group: - description: "Group is the group of the referent. When empty, - the Kubernetes core API group is inferred. \n Support: Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - description: "Kind is the kind of the referent. Although implementations - may support additional resources, the following Route types - are part of the \"Core\" support level for this field: \n - * HTTPRoute * TCPRoute * TLSRoute * UDPRoute" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - namespace: - description: "Namespace is the namespace of the referent. \n - Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - required: - - group - - kind - - namespace - type: object - maxItems: 16 - minItems: 1 - type: array - to: - description: "To describes the resources that may be referenced by - the resources described in \"From\". Each entry in this list must - be considered to be an additional place that references can be valid - to, or to put this another way, entries must be combined using OR. - \n Support: Core" - items: - description: ReferenceGrantTo describes what Kinds are allowed as - targets of the references. - properties: - group: - description: "Group is the group of the referent. When empty, - the Kubernetes core API group is inferred. \n Support: Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - description: "Kind is the kind of the referent. Although implementations - may support additional resources, the following types are - part of the \"Core\" support level for this field: \n * Service" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: Name is the name of the referent. When unspecified, - this policy refers to all resources of the specified Group - and Kind in the local namespace. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - type: object - maxItems: 16 - minItems: 1 - type: array - required: - - from - - to - type: object - type: object - served: true - storage: true - subresources: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/standard/gateway.networking.k8s.io_referencepolicies.yaml b/config/crd/standard/gateway.networking.k8s.io_referencepolicies.yaml deleted file mode 100644 index 00915b10fa..0000000000 --- a/config/crd/standard/gateway.networking.k8s.io_referencepolicies.yaml +++ /dev/null @@ -1,145 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891 - gateway.networking.k8s.io/bundle-version: v0.5.0-dev - gateway.networking.k8s.io/channel: standard - creationTimestamp: null - name: referencegrants.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: ReferenceGrant - listKind: ReferenceGrantList - plural: referencegrants - shortNames: - - refpol - singular: referencegrant - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: "ReferenceGrant identifies kinds of resources in other namespaces - that are trusted to reference the specified kinds of resources in the same - namespace as the policy. \n Each ReferenceGrant can be used to represent - a unique trust relationship. Additional Reference Policies can be used to - add to the set of trusted sources of inbound references for the namespace - they are defined within. \n All cross-namespace references in Gateway API - (with the exception of cross-namespace Gateway-route attachment) require - a ReferenceGrant. \n Support: Core" - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the desired state of ReferenceGrant. - properties: - from: - description: "From describes the trusted namespaces and kinds that - can reference the resources described in \"To\". Each entry in this - list must be considered to be an additional place that references - can be valid from, or to put this another way, entries must be combined - using OR. \n Support: Core" - items: - description: ReferenceGrantFrom describes trusted namespaces and - kinds. - properties: - group: - description: "Group is the group of the referent. When empty, - the Kubernetes core API group is inferred. \n Support: Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - description: "Kind is the kind of the referent. Although implementations - may support additional resources, the following Route types - are part of the \"Core\" support level for this field: \n - * HTTPRoute * TCPRoute * TLSRoute * UDPRoute" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - namespace: - description: "Namespace is the namespace of the referent. \n - Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - required: - - group - - kind - - namespace - type: object - maxItems: 16 - minItems: 1 - type: array - to: - description: "To describes the resources that may be referenced by - the resources described in \"From\". Each entry in this list must - be considered to be an additional place that references can be valid - to, or to put this another way, entries must be combined using OR. - \n Support: Core" - items: - description: ReferenceGrantTo describes what Kinds are allowed as - targets of the references. - properties: - group: - description: "Group is the group of the referent. When empty, - the Kubernetes core API group is inferred. \n Support: Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - description: "Kind is the kind of the referent. Although implementations - may support additional resources, the following types are - part of the \"Core\" support level for this field: \n * Service" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: Name is the name of the referent. When unspecified, - this policy refers to all resources of the specified Group - and Kind in the local namespace. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - type: object - maxItems: 16 - minItems: 1 - type: array - required: - - from - - to - type: object - type: object - served: true - storage: true - subresources: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/standard/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/standard/gateway.networking.k8s.io_tcproutes.yaml deleted file mode 100644 index a95c104db1..0000000000 --- a/config/crd/standard/gateway.networking.k8s.io_tcproutes.yaml +++ /dev/null @@ -1,438 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891 - gateway.networking.k8s.io/bundle-version: v0.5.0-dev - gateway.networking.k8s.io/channel: standard - creationTimestamp: null - name: tcproutes.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: TCPRoute - listKind: TCPRouteList - plural: tcproutes - singular: tcproute - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: TCPRoute provides a way to route TCP requests. When combined - with a Gateway listener, it can be used to forward connections on the port - specified by the listener to a set of backends specified by the TCPRoute. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the desired state of TCPRoute. - properties: - parentRefs: - description: "ParentRefs references the resources (usually Gateways) - that a Route wants to be attached to. Note that the referenced parent - resource needs to allow this for the attachment to be complete. - For Gateways, that means the Gateway needs to allow attachment from - Routes of this kind and namespace. \n The only kind of parent resource - with \"Core\" support is Gateway. This API may be extended in the - future to support additional kinds of parent resources such as one - of the route kinds. \n It is invalid to reference an identical parent - more than once. It is valid to reference multiple distinct sections - within the same parent resource, such as 2 Listeners within a Gateway. - \n It is possible to separately reference multiple distinct objects - that may be collapsed by an implementation. For example, some implementations - may choose to merge compatible Gateway Listeners together. If that - is the case, the list of routes attached to those resources should - also be merged." - items: - description: "ParentReference identifies an API object (usually - a Gateway) that can be considered a parent of this resource (usually - a route). The only kind of parent resource with \"Core\" support - is Gateway. This API may be extended in the future to support - additional kinds of parent resources, such as HTTPRoute. \n The - API object must be valid in the cluster; the Group and Kind must - be registered in the cluster for this reference to be valid." - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: Core - (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. When - unspecified (or empty string), this refers to the local namespace - of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within the - target resource. In the following resources, SectionName is - interpreted as the following: \n * Gateway: Listener Name. - When both Port (experimental) and SectionName are specified, - the name and port of the selected listener must match both - specified values. \n Implementations MAY choose to support - attaching Routes to other resources. If that is the case, - they MUST clearly document how SectionName is interpreted. - \n When unspecified (empty string), this will reference the - entire resource. For the purpose of status, an attachment - is considered successful if at least one section in the parent - resource accepts it. For example, Gateway listeners can restrict - which Routes can attach to them by Route kind, namespace, - or hostname. If 1 of 2 Gateway listeners accept attachment - from the referencing Route, the Route MUST be considered successfully - attached. If no Gateway listeners accept attachment from this - Route, the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - maxItems: 32 - type: array - rules: - description: Rules are a list of TCP matchers and actions. - items: - description: TCPRouteRule is the configuration for a given rule. - properties: - backendRefs: - description: "BackendRefs defines the backend(s) where matching - requests should be sent. If unspecified or invalid (refers - to a non-existent resource or a Service with no endpoints), - the underlying implementation MUST actively reject connection - attempts to this backend. Connection rejections must respect - weight; if an invalid backend is requested to have 80% of - connections, then 80% of connections must be rejected instead. - \n Support: Core for Kubernetes Service Support: Custom for - any other resource \n Support for weight: Extended" - items: - description: "BackendRef defines how a Route should forward - a request to a Kubernetes resource. \n Note that when a - namespace is specified, a ReferenceGrant object is required - in the referent namespace to allow that namespace's owner - to accept the reference. See the ReferenceGrant documentation - for details." - properties: - group: - default: "" - description: Group is the group of the referent. For example, - "networking.k8s.io". When unspecified (empty string), - core API group is inferred. - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Service - description: Kind is kind of the referent. For example - "HTTPRoute" or "Service". Defaults to "Service" when - not specified. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the backend. - When unspecified, the local namespace is inferred. \n - Note that when a namespace is specified, a ReferenceGrant - object is required in the referent namespace to allow - that namespace's owner to accept the reference. See - the ReferenceGrant documentation for details. \n Support: - Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - port: - description: Port specifies the destination port number - to use for this resource. Port is required when the - referent is a Kubernetes Service. For other resources, - destination port might be derived from the referent - resource or this field. - format: int32 - maximum: 65535 - minimum: 1 - type: integer - weight: - default: 1 - description: "Weight specifies the proportion of requests - forwarded to the referenced backend. This is computed - as weight/(sum of all weights in this BackendRefs list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support for this field varies based - on the context where used." - format: int32 - maximum: 1000000 - minimum: 0 - type: integer - required: - - name - type: object - maxItems: 16 - minItems: 1 - type: array - type: object - maxItems: 16 - minItems: 1 - type: array - required: - - rules - type: object - status: - description: Status defines the current state of TCPRoute. - properties: - parents: - description: "Parents is a list of parent resources (usually Gateways) - that are associated with the route, and the status of the route - with respect to each parent. When this route attaches to a parent, - the controller that manages the parent must add an entry to this - list when the controller first sees the route and should update - the entry as appropriate when the route or gateway is modified. - \n Note that parent references that cannot be resolved by an implementation - of this API will not be added to this list. Implementations of this - API can only populate Route status for the Gateways/parent resources - they are responsible for. \n A maximum of 32 Gateways will be represented - in this list. An empty list means the route has not been attached - to any Gateway." - items: - description: RouteParentStatus describes the status of a route with - respect to an associated Parent. - properties: - conditions: - description: "Conditions describes the status of the route with - respect to the Gateway. Note that the route's availability - is also subject to the Gateway's own status conditions and - listener status. \n If the Route's ParentRef specifies an - existing Gateway that supports Routes of this kind AND that - Gateway's controller has sufficient access, then that Gateway's - controller MUST set the \"Accepted\" condition on the Route, - to indicate whether the route has been accepted or rejected - by the Gateway, and why. \n A Route MUST be considered \"Accepted\" - if at least one of the Route's rules is implemented by the - Gateway. \n There are a number of cases where the \"Accepted\" - condition may not be set due to lack of controller visibility, - that includes when: \n * The Route refers to a non-existent - parent. * The Route is of a type that the controller does - not support. * The Route is in a namespace the the controller - does not have access to." - items: - description: "Condition contains details for one aspect of - the current state of this API Resource. --- This struct - is intended for direct use as an array at the field path - .status.conditions. For example, type FooStatus struct{ - \ // Represents the observations of a foo's current state. - \ // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type - \ // +patchStrategy=merge // +listType=map // - +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` - \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should - be when the underlying condition changed. If that is - not known, then using the time when the API field changed - is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, - if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the - current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier - indicating the reason for the condition's last transition. - Producers of specific condition types may define expected - values and meanings for this field, and whether the - values are considered a guaranteed API. The value should - be a CamelCase string. This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, - Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across - resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability - to deconflict is important. The regex it matches is - (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - maxItems: 8 - minItems: 1 - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - controllerName: - description: "ControllerName is a domain/path string that indicates - the name of the controller that wrote this status. This corresponds - with the controllerName field on GatewayClass. \n Example: - \"example.net/gateway-controller\". \n The format of this - field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid - Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - \n Controllers MUST populate this field when writing status. - Controllers should ensure that entries to status populated - with their ControllerName are cleaned up when they are no - longer necessary." - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ - type: string - parentRef: - description: ParentRef corresponds with a ParentRef in the spec - that this RouteParentStatus struct describes the status of. - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: - Core (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. - When unspecified (or empty string), this refers to the - local namespace of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within - the target resource. In the following resources, SectionName - is interpreted as the following: \n * Gateway: Listener - Name. When both Port (experimental) and SectionName are - specified, the name and port of the selected listener - must match both specified values. \n Implementations MAY - choose to support attaching Routes to other resources. - If that is the case, they MUST clearly document how SectionName - is interpreted. \n When unspecified (empty string), this - will reference the entire resource. For the purpose of - status, an attachment is considered successful if at least - one section in the parent resource accepts it. For example, - Gateway listeners can restrict which Routes can attach - to them by Route kind, namespace, or hostname. If 1 of - 2 Gateway listeners accept attachment from the referencing - Route, the Route MUST be considered successfully attached. - If no Gateway listeners accept attachment from this Route, - the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - required: - - controllerName - - parentRef - type: object - maxItems: 32 - type: array - required: - - parents - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/standard/gateway.networking.k8s.io_tlsroutes.yaml b/config/crd/standard/gateway.networking.k8s.io_tlsroutes.yaml deleted file mode 100644 index c762986c96..0000000000 --- a/config/crd/standard/gateway.networking.k8s.io_tlsroutes.yaml +++ /dev/null @@ -1,487 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891 - gateway.networking.k8s.io/bundle-version: v0.5.0-dev - gateway.networking.k8s.io/channel: standard - creationTimestamp: null - name: tlsroutes.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: TLSRoute - listKind: TLSRouteList - plural: tlsroutes - singular: tlsroute - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: "The TLSRoute resource is similar to TCPRoute, but can be configured - to match against TLS-specific metadata. This allows more flexibility in - matching streams for a given TLS listener. \n If you need to forward traffic - to a single target for a TLS listener, you could choose to use a TCPRoute - with a TLS listener." - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the desired state of TLSRoute. - properties: - hostnames: - description: "Hostnames defines a set of SNI names that should match - against the SNI attribute of TLS ClientHello message in TLS handshake. - This matches the RFC 1123 definition of a hostname with 2 notable - exceptions: \n 1. IPs are not allowed in SNI names per RFC 6066. - 2. A hostname may be prefixed with a wildcard label (`*.`). The - wildcard label must appear by itself as the first label. \n If - a hostname is specified by both the Listener and TLSRoute, there - must be at least one intersecting hostname for the TLSRoute to be - attached to the Listener. For example: \n * A Listener with `test.example.com` - as the hostname matches TLSRoutes that have either not specified - any hostnames, or have specified at least one of `test.example.com` - or `*.example.com`. * A Listener with `*.example.com` as the hostname - matches TLSRoutes that have either not specified any hostnames - or have specified at least one hostname that matches the Listener - hostname. For example, `test.example.com` and `*.example.com` - would both match. On the other hand, `example.com` and `test.example.net` - would not match. \n If both the Listener and TLSRoute have specified - hostnames, any TLSRoute hostnames that do not match the Listener - hostname MUST be ignored. For example, if a Listener specified `*.example.com`, - and the TLSRoute specified `test.example.com` and `test.example.net`, - `test.example.net` must not be considered for a match. \n If both - the Listener and TLSRoute have specified hostnames, and none match - with the criteria above, then the TLSRoute is not accepted. The - implementation must raise an 'Accepted' Condition with a status - of `False` in the corresponding RouteParentStatus. \n Support: Core" - items: - description: "Hostname is the fully qualified domain name of a network - host. This matches the RFC 1123 definition of a hostname with - 2 notable exceptions: \n 1. IPs are not allowed. 2. A hostname - may be prefixed with a wildcard label (`*.`). The wildcard label - must appear by itself as the first label. \n Hostname can be \"precise\" - which is a domain name without the terminating dot of a network - host (e.g. \"foo.example.com\") or \"wildcard\", which is a domain - name prefixed with a single wildcard label (e.g. `*.example.com`). - \n Note that as per RFC1035 and RFC1123, a *label* must consist - of lower case alphanumeric characters or '-', and must start and - end with an alphanumeric character. No other punctuation is allowed." - maxLength: 253 - minLength: 1 - pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - maxItems: 16 - type: array - parentRefs: - description: "ParentRefs references the resources (usually Gateways) - that a Route wants to be attached to. Note that the referenced parent - resource needs to allow this for the attachment to be complete. - For Gateways, that means the Gateway needs to allow attachment from - Routes of this kind and namespace. \n The only kind of parent resource - with \"Core\" support is Gateway. This API may be extended in the - future to support additional kinds of parent resources such as one - of the route kinds. \n It is invalid to reference an identical parent - more than once. It is valid to reference multiple distinct sections - within the same parent resource, such as 2 Listeners within a Gateway. - \n It is possible to separately reference multiple distinct objects - that may be collapsed by an implementation. For example, some implementations - may choose to merge compatible Gateway Listeners together. If that - is the case, the list of routes attached to those resources should - also be merged." - items: - description: "ParentReference identifies an API object (usually - a Gateway) that can be considered a parent of this resource (usually - a route). The only kind of parent resource with \"Core\" support - is Gateway. This API may be extended in the future to support - additional kinds of parent resources, such as HTTPRoute. \n The - API object must be valid in the cluster; the Group and Kind must - be registered in the cluster for this reference to be valid." - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: Core - (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. When - unspecified (or empty string), this refers to the local namespace - of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within the - target resource. In the following resources, SectionName is - interpreted as the following: \n * Gateway: Listener Name. - When both Port (experimental) and SectionName are specified, - the name and port of the selected listener must match both - specified values. \n Implementations MAY choose to support - attaching Routes to other resources. If that is the case, - they MUST clearly document how SectionName is interpreted. - \n When unspecified (empty string), this will reference the - entire resource. For the purpose of status, an attachment - is considered successful if at least one section in the parent - resource accepts it. For example, Gateway listeners can restrict - which Routes can attach to them by Route kind, namespace, - or hostname. If 1 of 2 Gateway listeners accept attachment - from the referencing Route, the Route MUST be considered successfully - attached. If no Gateway listeners accept attachment from this - Route, the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - maxItems: 32 - type: array - rules: - description: Rules are a list of TLS matchers and actions. - items: - description: TLSRouteRule is the configuration for a given rule. - properties: - backendRefs: - description: "BackendRefs defines the backend(s) where matching - requests should be sent. If unspecified or invalid (refers - to a non-existent resource or a Service with no endpoints), - the rule performs no forwarding; if no filters are specified - that would result in a response being sent, the underlying - implementation must actively reject request attempts to this - backend, by rejecting the connection or returning a 404 status - code. Request rejections must respect weight; if an invalid - backend is requested to have 80% of requests, then 80% of - requests must be rejected instead. \n Support: Core for Kubernetes - Service Support: Custom for any other resource \n Support - for weight: Extended" - items: - description: "BackendRef defines how a Route should forward - a request to a Kubernetes resource. \n Note that when a - namespace is specified, a ReferenceGrant object is required - in the referent namespace to allow that namespace's owner - to accept the reference. See the ReferenceGrant documentation - for details." - properties: - group: - default: "" - description: Group is the group of the referent. For example, - "networking.k8s.io". When unspecified (empty string), - core API group is inferred. - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Service - description: Kind is kind of the referent. For example - "HTTPRoute" or "Service". Defaults to "Service" when - not specified. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the backend. - When unspecified, the local namespace is inferred. \n - Note that when a namespace is specified, a ReferenceGrant - object is required in the referent namespace to allow - that namespace's owner to accept the reference. See - the ReferenceGrant documentation for details. \n Support: - Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - port: - description: Port specifies the destination port number - to use for this resource. Port is required when the - referent is a Kubernetes Service. For other resources, - destination port might be derived from the referent - resource or this field. - format: int32 - maximum: 65535 - minimum: 1 - type: integer - weight: - default: 1 - description: "Weight specifies the proportion of requests - forwarded to the referenced backend. This is computed - as weight/(sum of all weights in this BackendRefs list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support for this field varies based - on the context where used." - format: int32 - maximum: 1000000 - minimum: 0 - type: integer - required: - - name - type: object - maxItems: 16 - minItems: 1 - type: array - type: object - maxItems: 16 - minItems: 1 - type: array - required: - - rules - type: object - status: - description: Status defines the current state of TLSRoute. - properties: - parents: - description: "Parents is a list of parent resources (usually Gateways) - that are associated with the route, and the status of the route - with respect to each parent. When this route attaches to a parent, - the controller that manages the parent must add an entry to this - list when the controller first sees the route and should update - the entry as appropriate when the route or gateway is modified. - \n Note that parent references that cannot be resolved by an implementation - of this API will not be added to this list. Implementations of this - API can only populate Route status for the Gateways/parent resources - they are responsible for. \n A maximum of 32 Gateways will be represented - in this list. An empty list means the route has not been attached - to any Gateway." - items: - description: RouteParentStatus describes the status of a route with - respect to an associated Parent. - properties: - conditions: - description: "Conditions describes the status of the route with - respect to the Gateway. Note that the route's availability - is also subject to the Gateway's own status conditions and - listener status. \n If the Route's ParentRef specifies an - existing Gateway that supports Routes of this kind AND that - Gateway's controller has sufficient access, then that Gateway's - controller MUST set the \"Accepted\" condition on the Route, - to indicate whether the route has been accepted or rejected - by the Gateway, and why. \n A Route MUST be considered \"Accepted\" - if at least one of the Route's rules is implemented by the - Gateway. \n There are a number of cases where the \"Accepted\" - condition may not be set due to lack of controller visibility, - that includes when: \n * The Route refers to a non-existent - parent. * The Route is of a type that the controller does - not support. * The Route is in a namespace the the controller - does not have access to." - items: - description: "Condition contains details for one aspect of - the current state of this API Resource. --- This struct - is intended for direct use as an array at the field path - .status.conditions. For example, type FooStatus struct{ - \ // Represents the observations of a foo's current state. - \ // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type - \ // +patchStrategy=merge // +listType=map // - +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` - \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should - be when the underlying condition changed. If that is - not known, then using the time when the API field changed - is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, - if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the - current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier - indicating the reason for the condition's last transition. - Producers of specific condition types may define expected - values and meanings for this field, and whether the - values are considered a guaranteed API. The value should - be a CamelCase string. This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, - Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across - resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability - to deconflict is important. The regex it matches is - (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - maxItems: 8 - minItems: 1 - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - controllerName: - description: "ControllerName is a domain/path string that indicates - the name of the controller that wrote this status. This corresponds - with the controllerName field on GatewayClass. \n Example: - \"example.net/gateway-controller\". \n The format of this - field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid - Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - \n Controllers MUST populate this field when writing status. - Controllers should ensure that entries to status populated - with their ControllerName are cleaned up when they are no - longer necessary." - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ - type: string - parentRef: - description: ParentRef corresponds with a ParentRef in the spec - that this RouteParentStatus struct describes the status of. - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: - Core (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. - When unspecified (or empty string), this refers to the - local namespace of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within - the target resource. In the following resources, SectionName - is interpreted as the following: \n * Gateway: Listener - Name. When both Port (experimental) and SectionName are - specified, the name and port of the selected listener - must match both specified values. \n Implementations MAY - choose to support attaching Routes to other resources. - If that is the case, they MUST clearly document how SectionName - is interpreted. \n When unspecified (empty string), this - will reference the entire resource. For the purpose of - status, an attachment is considered successful if at least - one section in the parent resource accepts it. For example, - Gateway listeners can restrict which Routes can attach - to them by Route kind, namespace, or hostname. If 1 of - 2 Gateway listeners accept attachment from the referencing - Route, the Route MUST be considered successfully attached. - If no Gateway listeners accept attachment from this Route, - the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - required: - - controllerName - - parentRef - type: object - maxItems: 32 - type: array - required: - - parents - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/standard/gateway.networking.k8s.io_udproutes.yaml b/config/crd/standard/gateway.networking.k8s.io_udproutes.yaml deleted file mode 100644 index ae4d63dce2..0000000000 --- a/config/crd/standard/gateway.networking.k8s.io_udproutes.yaml +++ /dev/null @@ -1,438 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891 - gateway.networking.k8s.io/bundle-version: v0.5.0-dev - gateway.networking.k8s.io/channel: standard - creationTimestamp: null - name: udproutes.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: UDPRoute - listKind: UDPRouteList - plural: udproutes - singular: udproute - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: UDPRoute provides a way to route UDP traffic. When combined with - a Gateway listener, it can be used to forward traffic on the port specified - by the listener to a set of backends specified by the UDPRoute. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the desired state of UDPRoute. - properties: - parentRefs: - description: "ParentRefs references the resources (usually Gateways) - that a Route wants to be attached to. Note that the referenced parent - resource needs to allow this for the attachment to be complete. - For Gateways, that means the Gateway needs to allow attachment from - Routes of this kind and namespace. \n The only kind of parent resource - with \"Core\" support is Gateway. This API may be extended in the - future to support additional kinds of parent resources such as one - of the route kinds. \n It is invalid to reference an identical parent - more than once. It is valid to reference multiple distinct sections - within the same parent resource, such as 2 Listeners within a Gateway. - \n It is possible to separately reference multiple distinct objects - that may be collapsed by an implementation. For example, some implementations - may choose to merge compatible Gateway Listeners together. If that - is the case, the list of routes attached to those resources should - also be merged." - items: - description: "ParentReference identifies an API object (usually - a Gateway) that can be considered a parent of this resource (usually - a route). The only kind of parent resource with \"Core\" support - is Gateway. This API may be extended in the future to support - additional kinds of parent resources, such as HTTPRoute. \n The - API object must be valid in the cluster; the Group and Kind must - be registered in the cluster for this reference to be valid." - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: Core - (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. When - unspecified (or empty string), this refers to the local namespace - of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within the - target resource. In the following resources, SectionName is - interpreted as the following: \n * Gateway: Listener Name. - When both Port (experimental) and SectionName are specified, - the name and port of the selected listener must match both - specified values. \n Implementations MAY choose to support - attaching Routes to other resources. If that is the case, - they MUST clearly document how SectionName is interpreted. - \n When unspecified (empty string), this will reference the - entire resource. For the purpose of status, an attachment - is considered successful if at least one section in the parent - resource accepts it. For example, Gateway listeners can restrict - which Routes can attach to them by Route kind, namespace, - or hostname. If 1 of 2 Gateway listeners accept attachment - from the referencing Route, the Route MUST be considered successfully - attached. If no Gateway listeners accept attachment from this - Route, the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - maxItems: 32 - type: array - rules: - description: Rules are a list of UDP matchers and actions. - items: - description: UDPRouteRule is the configuration for a given rule. - properties: - backendRefs: - description: "BackendRefs defines the backend(s) where matching - requests should be sent. If unspecified or invalid (refers - to a non-existent resource or a Service with no endpoints), - the underlying implementation MUST actively reject connection - attempts to this backend. Packet drops must respect weight; - if an invalid backend is requested to have 80% of the packets, - then 80% of packets must be dropped instead. \n Support: Core - for Kubernetes Service Support: Custom for any other resource - \n Support for weight: Extended" - items: - description: "BackendRef defines how a Route should forward - a request to a Kubernetes resource. \n Note that when a - namespace is specified, a ReferenceGrant object is required - in the referent namespace to allow that namespace's owner - to accept the reference. See the ReferenceGrant documentation - for details." - properties: - group: - default: "" - description: Group is the group of the referent. For example, - "networking.k8s.io". When unspecified (empty string), - core API group is inferred. - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Service - description: Kind is kind of the referent. For example - "HTTPRoute" or "Service". Defaults to "Service" when - not specified. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the backend. - When unspecified, the local namespace is inferred. \n - Note that when a namespace is specified, a ReferenceGrant - object is required in the referent namespace to allow - that namespace's owner to accept the reference. See - the ReferenceGrant documentation for details. \n Support: - Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - port: - description: Port specifies the destination port number - to use for this resource. Port is required when the - referent is a Kubernetes Service. For other resources, - destination port might be derived from the referent - resource or this field. - format: int32 - maximum: 65535 - minimum: 1 - type: integer - weight: - default: 1 - description: "Weight specifies the proportion of requests - forwarded to the referenced backend. This is computed - as weight/(sum of all weights in this BackendRefs list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support for this field varies based - on the context where used." - format: int32 - maximum: 1000000 - minimum: 0 - type: integer - required: - - name - type: object - maxItems: 16 - minItems: 1 - type: array - type: object - maxItems: 16 - minItems: 1 - type: array - required: - - rules - type: object - status: - description: Status defines the current state of UDPRoute. - properties: - parents: - description: "Parents is a list of parent resources (usually Gateways) - that are associated with the route, and the status of the route - with respect to each parent. When this route attaches to a parent, - the controller that manages the parent must add an entry to this - list when the controller first sees the route and should update - the entry as appropriate when the route or gateway is modified. - \n Note that parent references that cannot be resolved by an implementation - of this API will not be added to this list. Implementations of this - API can only populate Route status for the Gateways/parent resources - they are responsible for. \n A maximum of 32 Gateways will be represented - in this list. An empty list means the route has not been attached - to any Gateway." - items: - description: RouteParentStatus describes the status of a route with - respect to an associated Parent. - properties: - conditions: - description: "Conditions describes the status of the route with - respect to the Gateway. Note that the route's availability - is also subject to the Gateway's own status conditions and - listener status. \n If the Route's ParentRef specifies an - existing Gateway that supports Routes of this kind AND that - Gateway's controller has sufficient access, then that Gateway's - controller MUST set the \"Accepted\" condition on the Route, - to indicate whether the route has been accepted or rejected - by the Gateway, and why. \n A Route MUST be considered \"Accepted\" - if at least one of the Route's rules is implemented by the - Gateway. \n There are a number of cases where the \"Accepted\" - condition may not be set due to lack of controller visibility, - that includes when: \n * The Route refers to a non-existent - parent. * The Route is of a type that the controller does - not support. * The Route is in a namespace the the controller - does not have access to." - items: - description: "Condition contains details for one aspect of - the current state of this API Resource. --- This struct - is intended for direct use as an array at the field path - .status.conditions. For example, type FooStatus struct{ - \ // Represents the observations of a foo's current state. - \ // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type - \ // +patchStrategy=merge // +listType=map // - +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` - \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should - be when the underlying condition changed. If that is - not known, then using the time when the API field changed - is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, - if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the - current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier - indicating the reason for the condition's last transition. - Producers of specific condition types may define expected - values and meanings for this field, and whether the - values are considered a guaranteed API. The value should - be a CamelCase string. This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, - Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across - resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability - to deconflict is important. The regex it matches is - (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - maxItems: 8 - minItems: 1 - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - controllerName: - description: "ControllerName is a domain/path string that indicates - the name of the controller that wrote this status. This corresponds - with the controllerName field on GatewayClass. \n Example: - \"example.net/gateway-controller\". \n The format of this - field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid - Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - \n Controllers MUST populate this field when writing status. - Controllers should ensure that entries to status populated - with their ControllerName are cleaned up when they are no - longer necessary." - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$ - type: string - parentRef: - description: ParentRef corresponds with a ParentRef in the spec - that this RouteParentStatus struct describes the status of. - properties: - group: - default: gateway.networking.k8s.io - description: "Group is the group of the referent. \n Support: - Core" - maxLength: 253 - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - kind: - default: Gateway - description: "Kind is kind of the referent. \n Support: - Core (Gateway) Support: Custom (Other Resources)" - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: "Name is the name of the referent. \n Support: - Core" - maxLength: 253 - minLength: 1 - type: string - namespace: - description: "Namespace is the namespace of the referent. - When unspecified (or empty string), this refers to the - local namespace of the Route. \n Support: Core" - maxLength: 63 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - sectionName: - description: "SectionName is the name of a section within - the target resource. In the following resources, SectionName - is interpreted as the following: \n * Gateway: Listener - Name. When both Port (experimental) and SectionName are - specified, the name and port of the selected listener - must match both specified values. \n Implementations MAY - choose to support attaching Routes to other resources. - If that is the case, they MUST clearly document how SectionName - is interpreted. \n When unspecified (empty string), this - will reference the entire resource. For the purpose of - status, an attachment is considered successful if at least - one section in the parent resource accepts it. For example, - Gateway listeners can restrict which Routes can attach - to them by Route kind, namespace, or hostname. If 1 of - 2 Gateway listeners accept attachment from the referencing - Route, the Route MUST be considered successfully attached. - If no Gateway listeners accept attachment from this Route, - the Route MUST be considered detached from the Gateway. - \n Support: Core" - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - type: object - required: - - controllerName - - parentRef - type: object - maxItems: 32 - type: array - required: - - parents - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/examples/v1alpha2/basic-tcp.yaml b/examples/experimental/v1alpha2/basic-tcp.yaml similarity index 100% rename from examples/v1alpha2/basic-tcp.yaml rename to examples/experimental/v1alpha2/basic-tcp.yaml diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml b/examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-full.yaml similarity index 100% rename from examples/experimental/http-redirect-rewrite/httproute-redirect-full.yaml rename to examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-full.yaml diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml b/examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-https.yaml similarity index 100% rename from examples/experimental/http-redirect-rewrite/httproute-redirect-https.yaml rename to examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-https.yaml diff --git a/examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml b/examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-prefix.yaml similarity index 100% rename from examples/experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml rename to examples/experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-prefix.yaml diff --git a/examples/experimental/http-redirect-rewrite/httproute-rewrite-path.yaml b/examples/experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite-path.yaml similarity index 100% rename from examples/experimental/http-redirect-rewrite/httproute-rewrite-path.yaml rename to examples/experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite-path.yaml diff --git a/examples/experimental/http-redirect-rewrite/httproute-rewrite.yaml b/examples/experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite.yaml similarity index 100% rename from examples/experimental/http-redirect-rewrite/httproute-rewrite.yaml rename to examples/experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite.yaml diff --git a/examples/v1alpha2/reference-grant.yaml b/examples/experimental/v1alpha2/reference-grant.yaml similarity index 100% rename from examples/v1alpha2/reference-grant.yaml rename to examples/experimental/v1alpha2/reference-grant.yaml diff --git a/examples/v1alpha2/tls-cert-cross-namespace.yaml b/examples/experimental/v1alpha2/tls-cert-cross-namespace.yaml similarity index 100% rename from examples/v1alpha2/tls-cert-cross-namespace.yaml rename to examples/experimental/v1alpha2/tls-cert-cross-namespace.yaml diff --git a/examples/v1alpha1/backendpolicy.yaml b/examples/v1alpha1/backendpolicy.yaml deleted file mode 100644 index 9f757be8b6..0000000000 --- a/examples/v1alpha1/backendpolicy.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: BackendPolicy -metadata: - name: my-app -spec: - backendRefs: - - name: my-service - group: core - kind: Service - tls: - certificateAuthorityRef: - name: my-app-ca - group: core - kind: Secret - options: {} diff --git a/examples/v1alpha1/basic-http.yaml b/examples/v1alpha1/basic-http.yaml deleted file mode 100644 index 15c4132a44..0000000000 --- a/examples/v1alpha1/basic-http.yaml +++ /dev/null @@ -1,62 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/api-types/httproute.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: acme-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: my-gateway -spec: - gatewayClassName: acme-lb - listeners: # Use GatewayClass defaults for listener definition. - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - app: foo - namespaces: - from: "Same" ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-app-1 - labels: - app: foo -spec: - hostnames: - - "foo.com" - rules: - - matches: - - path: - type: Prefix - value: /bar - forwardTo: - - serviceName: my-service1 - port: 8080 - - matches: - - headers: - type: Exact - values: - magic: foo - queryParams: - type: Exact - values: - great: example - path: - type: Prefix - value: /some/thing - forwardTo: - - serviceName: my-service2 - port: 8080 diff --git a/examples/v1alpha1/basic-tcp.yaml b/examples/v1alpha1/basic-tcp.yaml deleted file mode 100644 index 18cc2c2795..0000000000 --- a/examples/v1alpha1/basic-tcp.yaml +++ /dev/null @@ -1,59 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/tcp.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: acme-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: my-tcp-gateway -spec: - gatewayClassName: acme-lb - listeners: - - protocol: TCP - port: 8080 - routes: - kind: TCPRoute - selector: - matchLabels: - "app": "foo" - - protocol: TCP - port: 8090 - routes: - kind: TCPRoute - selector: - matchLabels: - "app": "bar" ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: TCPRoute -metadata: - name: tcp-app-1 - labels: - app: foo -spec: - rules: - - forwardTo: - - serviceName: my-foo-service - port: 6000 ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: TCPRoute -metadata: - name: tcp-app-2 - namespace: default - labels: - app: bar -spec: - rules: - - forwardTo: - - serviceName: my-bar-service - port: 6000 diff --git a/examples/v1alpha1/basic-udp.yaml b/examples/v1alpha1/basic-udp.yaml deleted file mode 100644 index 13fff497eb..0000000000 --- a/examples/v1alpha1/basic-udp.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: acme-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: my-gateway -spec: - gatewayClassName: acme-lb - listeners: # Use GatewayClass defaults for listener definition. - - protocol: UDP - port: 8080 - routes: - kind: UDPRoute - selector: - matchLabels: - "app": "foo" - namespaces: - from: "All" ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: UDPRoute -metadata: - name: udp-app-1 - labels: - app: foo -spec: - rules: - - forwardTo: - - serviceName: my-service - port: 5000 diff --git a/examples/v1alpha1/cross-namespace-routing/example-namespaces.yaml b/examples/v1alpha1/cross-namespace-routing/example-namespaces.yaml deleted file mode 100644 index 8b1ae5a1be..0000000000 --- a/examples/v1alpha1/cross-namespace-routing/example-namespaces.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: infra-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: site-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: store-ns diff --git a/examples/v1alpha1/cross-namespace-routing/gateway.yaml b/examples/v1alpha1/cross-namespace-routing/gateway.yaml deleted file mode 100644 index e8a7a9ff66..0000000000 --- a/examples/v1alpha1/cross-namespace-routing/gateway.yaml +++ /dev/null @@ -1,17 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/multiple-ns.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: shared-gateway - namespace: infra-ns -spec: - gatewayClassName: acme-lb - listeners: - - hostname: "foo.example.com" - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - namespaces: - from: "All" diff --git a/examples/v1alpha1/cross-namespace-routing/site-route.yaml b/examples/v1alpha1/cross-namespace-routing/site-route.yaml deleted file mode 100644 index d914581a3e..0000000000 --- a/examples/v1alpha1/cross-namespace-routing/site-route.yaml +++ /dev/null @@ -1,40 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/multiple-ns.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: home - namespace: site-ns -spec: - gateways: - allow: FromList - gatewayRefs: - - name: shared-gateway - namespace: infra - rules: - - forwardTo: - - serviceName: home - port: 8080 ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: login - namespace: site-ns -spec: - gateways: - allow: FromList - gatewayRefs: - - name: shared-gateway - namespace: infra - rules: - - matches: - - path: - value: /login - forwardTo: - - serviceName: login-v1 - port: 8080 - weight: 90 - - serviceName: login-v2 - port: 8080 - weight: 10 diff --git a/examples/v1alpha1/cross-namespace-routing/store-route.yaml b/examples/v1alpha1/cross-namespace-routing/store-route.yaml deleted file mode 100644 index db63744a91..0000000000 --- a/examples/v1alpha1/cross-namespace-routing/store-route.yaml +++ /dev/null @@ -1,20 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/multiple-ns.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: store - namespace: store-ns -spec: - gateways: - allow: FromList - gatewayRefs: - - name: shared-gateway - namespace: infra - rules: - - matches: - - path: - value: /store - forwardTo: - - serviceName: store - port: 8080 diff --git a/examples/v1alpha1/default-match-http.yaml b/examples/v1alpha1/default-match-http.yaml deleted file mode 100644 index 669ba97430..0000000000 --- a/examples/v1alpha1/default-match-http.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: default-match-example -spec: - controller: acme.io/gateway-controller - ---- - -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: default-match-gw -spec: - gatewayClassName: default-match-example - listeners: - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - app: default-match - namespaces: - from: "All" - ---- - -# This HTTPRoute demonstrates patch match defaulting. If no path match is -# specified, CRD defaults adds a default prefix match on the path "/". This -# matches every HTTP request and ensures that route rules always have at -# least one valid match. -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: default-match-route - labels: - app: default-match -spec: - hostnames: - - default-match.com - rules: - - matches: - - headers: - type: Exact - values: - magic: default-match - forwardTo: - - port: 8080 - backendRef: - name: my-custom-resource - group: acme.io - kind: CustomBackend - - matches: - - path: - type: Exact - value: /example/exact - forwardTo: - - serviceName: my-service-2 - port: 8080 diff --git a/examples/v1alpha1/http-filter.yaml b/examples/v1alpha1/http-filter.yaml deleted file mode 100644 index e42981a2b6..0000000000 --- a/examples/v1alpha1/http-filter.yaml +++ /dev/null @@ -1,53 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/api-types/httproute.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: filter-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: my-filter-gateway -spec: - gatewayClassName: filter-lb - listeners: - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - app: filter - namespaces: - from: "All" ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-filter-1 - labels: - app: filter -spec: - hostnames: - - my.filter.com - rules: - - matches: - - path: - type: Prefix - value: / - filters: - - type: RequestHeaderModifier - requestHeaderModifier: - add: - my-header: foo - forwardTo: - - serviceName: my-filter-svc1 - weight: 1 - port: 80 diff --git a/examples/v1alpha1/http-routing/bar-httproute.yaml b/examples/v1alpha1/http-routing/bar-httproute.yaml deleted file mode 100644 index 00e90d4633..0000000000 --- a/examples/v1alpha1/http-routing/bar-httproute.yaml +++ /dev/null @@ -1,23 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/http-routing.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: bar-route - labels: - gateway: prod-web-gw -spec: - hostnames: - - "bar.example.com" - rules: - - matches: - - headers: - type: Exact - values: - env: canary - forwardTo: - - serviceName: bar-svc-canary - port: 8080 - - forwardTo: - - serviceName: bar-svc - port: 8080 diff --git a/examples/v1alpha1/http-routing/foo-httproute.yaml b/examples/v1alpha1/http-routing/foo-httproute.yaml deleted file mode 100644 index de98a7b72b..0000000000 --- a/examples/v1alpha1/http-routing/foo-httproute.yaml +++ /dev/null @@ -1,19 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/http-routing.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: foo-route - labels: - gateway: prod-web-gw -spec: - hostnames: - - "foo.example.com" - rules: - - matches: - - path: - type: Prefix - value: /login - forwardTo: - - serviceName: foo-svc - port: 8080 diff --git a/examples/v1alpha1/http-routing/gateway.yaml b/examples/v1alpha1/http-routing/gateway.yaml deleted file mode 100644 index 37d34d7909..0000000000 --- a/examples/v1alpha1/http-routing/gateway.yaml +++ /dev/null @@ -1,16 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/http-routing.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: prod-web -spec: - gatewayClassName: acme-lb - listeners: - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - gateway: prod-web-gw diff --git a/examples/v1alpha1/http-trafficsplit.yaml b/examples/v1alpha1/http-trafficsplit.yaml deleted file mode 100644 index 36d2ceeed0..0000000000 --- a/examples/v1alpha1/http-trafficsplit.yaml +++ /dev/null @@ -1,52 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/api-types/httproute.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: trafficsplit-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: my-trafficsplit-gateway -spec: - gatewayClassName: trafficsplit-lb - listeners: # Use GatewayClass defaults for listener definition. - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - app: split - namespaces: - from: "Selector" - selector: {} ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-trafficsplit-1 - labels: - app: split -spec: - hostnames: - - "my.trafficsplit.com" - rules: - - matches: - - path: - type: Exact - value: /bar - forwardTo: - - serviceName: my-trafficsplit-svc1 - port: 8080 - weight: 50 - - serviceName: my-trafficsplit-svc2 - port: 8080 - weight: 50 diff --git a/examples/v1alpha1/multiple-tcp.yaml b/examples/v1alpha1/multiple-tcp.yaml deleted file mode 100644 index 1f5c557444..0000000000 --- a/examples/v1alpha1/multiple-tcp.yaml +++ /dev/null @@ -1,48 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: gateway -spec: - gatewayClassName: default-class - addresses: - - type: NamedAddress - value: auto-assign - listeners: - # Forward port 22 to a SSH honeypot app. - - port: 22 - protocol: TCP - routes: - kind: TCPRoute - selector: - matchLabels: - app: sshd-honeypot - namespaces: - from: "All" - # Forward port 2222 to a real SSH server. - - port: 2222 - protocol: TCP - routes: - kind: TCPRoute - selector: - matchLabels: - app: sshd-legitimate - namespaces: - from: "All" - # Forward the SNI named service to the real SSH server ever TLS, assuming - # that there is an actual client for such a beast. - - hostname: ssh.example.com - port: 443 - protocol: TLS - tls: - options: {} - certificateRef: - name: ssh-server - kind: Secret - group: core - routes: - kind: TCPRoute - selector: - matchLabels: - app: sshd-legitimate - namespaces: - from: "All" diff --git a/examples/v1alpha1/routes-in-multiple-namespaces.yaml b/examples/v1alpha1/routes-in-multiple-namespaces.yaml deleted file mode 100644 index 3016d46785..0000000000 --- a/examples/v1alpha1/routes-in-multiple-namespaces.yaml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: GatewayClass -metadata: - name: acme-lb -spec: - controller: acme.io/gateway-controller - parametersRef: - name: acme-lb - group: acme.io - kind: Parameters ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: multi-ns-gateway -spec: - gatewayClassName: acme-lb - listeners: # Use GatewayClass defaults for listener definition. - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - product: baz - namespaces: - from: "All" ---- -apiVersion: v1 -kind: Namespace -metadata: - name: gateway-api-example-ns1 ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-app-1 - namespace: gateway-api-example-ns1 - labels: - product: baz -spec: - gateways: - allow: All - hostnames: - - "foo.com" - rules: - - matches: - - path: - type: Prefix - value: /bar - forwardTo: - - serviceName: my-foo-service1 - port: 8080 - - matches: - - headers: - type: Exact - values: - magic: foo - path: - type: Prefix - value: /some/thing - forwardTo: - - serviceName: my-foo-service2 - port: 8080 ---- -apiVersion: v1 -kind: Namespace -metadata: - name: gateway-api-example-ns2 ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-app-2 - namespace: gateway-api-example-ns2 - labels: - product: baz -spec: - gateways: - allow: FromList - gatewayRefs: - - name: multi-ns-gateway - namespace: default - hostnames: - - "bar.com" - rules: - - matches: - - path: - type: Prefix - value: / - forwardTo: - - serviceName: my-bar-service1 - port: 8080 diff --git a/examples/v1alpha1/simple-gateway/gateway.yaml b/examples/v1alpha1/simple-gateway/gateway.yaml deleted file mode 100644 index b2bfbec8c2..0000000000 --- a/examples/v1alpha1/simple-gateway/gateway.yaml +++ /dev/null @@ -1,17 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/traffic-splitting.md -#$ - site-src/v1alpha1/guides/simple-gateway.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: prod-web -spec: - gatewayClassName: acme-lb - listeners: - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - selector: - matchLabels: - gateway: prod-web-gw diff --git a/examples/v1alpha1/simple-gateway/httproute.yaml b/examples/v1alpha1/simple-gateway/httproute.yaml deleted file mode 100644 index 96c94ce5f6..0000000000 --- a/examples/v1alpha1/simple-gateway/httproute.yaml +++ /dev/null @@ -1,13 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/simple-gateway.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: foo - labels: - gateway: prod-web-gw -spec: - rules: - - forwardTo: - - serviceName: foo-svc - port: 8080 \ No newline at end of file diff --git a/examples/v1alpha1/single-http.yaml b/examples/v1alpha1/single-http.yaml deleted file mode 100644 index e2fbbea712..0000000000 --- a/examples/v1alpha1/single-http.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: gateway -spec: - gatewayClassName: default-class - addresses: - - type: NamedAddress - value: auto-assign - listeners: - - hostname: httpbin.example.com - port: 80 - protocol: HTTP - routes: - kind: HTTPRoute - selector: - matchLabels: - app: httpbin - namespaces: - from: "All" diff --git a/examples/v1alpha1/tls-basic.yaml b/examples/v1alpha1/tls-basic.yaml deleted file mode 100644 index 892eec3622..0000000000 --- a/examples/v1alpha1/tls-basic.yaml +++ /dev/null @@ -1,34 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/tls.md -#$ - site-src/v1alpha1/api-types/httproute.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: tls-basic -spec: - gatewayClassName: acme-lb - listeners: - - protocol: HTTPS - port: 443 - hostname: foo.example.com - tls: - certificateRef: - kind: Secret - group: core - name: foo-example-com-cert - routeOverride: - certificate: Deny - routes: - kind: HTTPRoute - - protocol: HTTPS - port: 443 - hostname: bar.example.com - tls: - certificateRef: - kind: Secret - group: core - name: bar-example-com-cert - routeOverride: - certificate: Deny - routes: - kind: HTTPRoute diff --git a/examples/v1alpha1/tls-cert-in-route.yaml b/examples/v1alpha1/tls-cert-in-route.yaml deleted file mode 100644 index ca670e5c50..0000000000 --- a/examples/v1alpha1/tls-cert-in-route.yaml +++ /dev/null @@ -1,67 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/tls.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: cert-in-route-gateway -spec: - gatewayClassName: acme-lb - listeners: - - protocol: HTTP - port: 80 - routes: - kind: HTTPRoute - - protocol: HTTPS - port: 443 - tls: - mode: Terminate - certificateRef: - kind: Secret - group: core - name: default-cert - routeOverride: - certificate: Allow - routes: - kind: HTTPRoute ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-app-1 -spec: - hostnames: - - "foo.example.com" - tls: - certificateRef: - kind: Secret - group: core - name: foo-example-com-cert - rules: - - matches: - - path: - type: Prefix - value: / - forwardTo: - - serviceName: my-service - port: 8080 ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-app-2 -spec: - hostnames: - - "bar.example.com" - tls: - certificateRef: - kind: Secret - group: core - name: bar-example-com-cert - rules: - - matches: - - path: - type: Prefix - value: / - forwardTo: - - serviceName: my-service - port: 8080 diff --git a/examples/v1alpha1/traffic-splitting/simple-split.yaml b/examples/v1alpha1/traffic-splitting/simple-split.yaml deleted file mode 100644 index 1d14a35ebc..0000000000 --- a/examples/v1alpha1/traffic-splitting/simple-split.yaml +++ /dev/null @@ -1,15 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/traffic-splitting.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: simple-split -spec: - rules: - - forwardTo: - - serviceName: foo-v1 - port: 8080 - weight: 90 - - serviceName: foo-v2 - port: 8080 - weight: 10 diff --git a/examples/v1alpha1/traffic-splitting/traffic-split-1.yaml b/examples/v1alpha1/traffic-splitting/traffic-split-1.yaml deleted file mode 100644 index 36f50960c3..0000000000 --- a/examples/v1alpha1/traffic-splitting/traffic-split-1.yaml +++ /dev/null @@ -1,23 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/traffic-splitting.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: foo-route - labels: - gateway: prod-web-gw -spec: - hostnames: - - foo.example.com - rules: - - forwardTo: - - serviceName: foo-v1 - port: 8080 - - matches: - - headers: - type: Exact - values: - traffic: test - forwardTo: - - serviceName: foo-v2 - port: 8080 diff --git a/examples/v1alpha1/upstream-tls.yaml b/examples/v1alpha1/upstream-tls.yaml deleted file mode 100644 index 3a7a8b1eab..0000000000 --- a/examples/v1alpha1/upstream-tls.yaml +++ /dev/null @@ -1,49 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/tls.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: BackendPolicy -metadata: - name: my-app - annotations: - networking.x-k8s.io/app-protocol: https -spec: - backendRefs: - - name: my-service - group: core - kind: Service - port: 443 - tls: - certificateAuthorityRef: - name: my-cluster-ca - group: core - kind: Secret - options: {} ---- -apiVersion: v1 -kind: Service -metadata: - name: my-service -spec: - ports: - - name: http - port: 80 - - name: https - port: 443 - selector: - app: my-service ---- -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: my-service-route -spec: - hostnames: - - "foo.com" - rules: - - matches: - - path: - type: Prefix - value: / - forwardTo: - - serviceName: my-service - port: 443 diff --git a/examples/v1alpha1/wildcard-http.yaml b/examples/v1alpha1/wildcard-http.yaml deleted file mode 100644 index b86e52dc98..0000000000 --- a/examples/v1alpha1/wildcard-http.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: gateway -spec: - gatewayClassName: default-class - addresses: - - type: NamedAddress - value: auto-assign - listeners: - - hostname: "*.example.com" - port: 80 - protocol: HTTP - routes: - kind: HTTPRoute - selector: - matchLabels: - # This label selects httpbin.example.com and - # conformance.example.com routes. - app: httpbin-or-conformance - namespaces: - from: "All" diff --git a/examples/v1alpha1/wildcard-https.yaml b/examples/v1alpha1/wildcard-https.yaml deleted file mode 100644 index e3e7b3169f..0000000000 --- a/examples/v1alpha1/wildcard-https.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: gateway -spec: - gatewayClassName: default-class - addresses: - - type: NamedAddress - value: auto-assign - listeners: - - hostname: "*.example.com" - port: 443 - protocol: HTTPS - tls: - options: {} - certificateRef: - name: example-wildcard - kind: Secret - group: core - routes: - kind: HTTPRoute - selector: - matchLabels: - # This label selects httpbin.example.com and - # conformance.example.com routes. - app: httpbin-or-conformance - namespaces: - from: "All" diff --git a/examples/v1alpha1/wildcard-tls-gateway.yaml b/examples/v1alpha1/wildcard-tls-gateway.yaml deleted file mode 100644 index bcc8f32f51..0000000000 --- a/examples/v1alpha1/wildcard-tls-gateway.yaml +++ /dev/null @@ -1,33 +0,0 @@ -#$ Used in: -#$ - site-src/v1alpha1/guides/tls.md -apiVersion: networking.x-k8s.io/v1alpha1 -kind: Gateway -metadata: - name: wildcard-tls-gateway -spec: - gatewayClassName: acme-lb - listeners: - - protocol: HTTPS - port: 443 - hostname: foo.example.com - tls: - certificateRef: - kind: Secret - group: core - name: foo-example-com-cert - routeOverride: - certificate: Deny - routes: - kind: HTTPRoute - - protocol: HTTPS - port: 443 - hostname: "*.example.com" - tls: - certificateRef: - kind: Secret - group: core - name: wildcard-example-com-cert - routeOverride: - certificate: Deny - routes: - kind: HTTPRoute diff --git a/examples/v1beta1/0-namespaces.yaml b/examples/v1beta1/0-namespaces.yaml new file mode 100644 index 0000000000..9bc699f869 --- /dev/null +++ b/examples/v1beta1/0-namespaces.yaml @@ -0,0 +1,11 @@ +# These namespaces can be used for examples without recreating them each time. +--- +apiVersion: v1 +kind: Namespace +metadata: + name: gateway-api-example-ns1 +--- +apiVersion: v1 +kind: Namespace +metadata: + name: gateway-api-example-ns2 diff --git a/examples/v1beta1/basic-http.yaml b/examples/v1beta1/basic-http.yaml new file mode 100644 index 0000000000..96758c22c9 --- /dev/null +++ b/examples/v1beta1/basic-http.yaml @@ -0,0 +1,57 @@ +#$ Used in: +#$ - site-src/v1beta1/api-types/httproute.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: GatewayClass +metadata: + name: acme-lb +spec: + controllerName: acme.io/gateway-controller + parametersRef: + name: acme-lb + group: acme.io + kind: Parameters +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: my-gateway +spec: + gatewayClassName: acme-lb + listeners: # Use GatewayClass defaults for listener definition. + - name: http + protocol: HTTP + port: 80 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-app-1 +spec: + parentRefs: + - name: my-gateway + hostnames: + - "foo.com" + rules: + - matches: + - path: + type: PathPrefix + value: /bar + backendRefs: + - name: my-service1 + port: 8080 + - matches: + - headers: + - type: Exact + name: magic + value: foo + queryParams: + - type: Exact + name: great + value: example + path: + type: PathPrefix + value: /some/thing + method: GET + backendRefs: + - name: my-service2 + port: 8080 diff --git a/examples/v1beta1/cross-namespace-routing/0-namespaces.yaml b/examples/v1beta1/cross-namespace-routing/0-namespaces.yaml new file mode 100644 index 0000000000..7a4535aaa0 --- /dev/null +++ b/examples/v1beta1/cross-namespace-routing/0-namespaces.yaml @@ -0,0 +1,27 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/multiple-ns.md +apiVersion: v1 +kind: Namespace +metadata: + name: infra-ns + labels: + shared-gateway-access: "true" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: site-ns + labels: + shared-gateway-access: "true" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: store-ns + labels: + shared-gateway-access: "true" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: no-external-access diff --git a/examples/v1beta1/cross-namespace-routing/gateway.yaml b/examples/v1beta1/cross-namespace-routing/gateway.yaml new file mode 100644 index 0000000000..f810233e9f --- /dev/null +++ b/examples/v1beta1/cross-namespace-routing/gateway.yaml @@ -0,0 +1,23 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/multiple-ns.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: shared-gateway + namespace: infra-ns +spec: + gatewayClassName: shared-gateway-class + listeners: + - name: https + hostname: "foo.example.com" + protocol: HTTPS + port: 443 + allowedRoutes: + namespaces: + from: Selector + selector: + matchLabels: + shared-gateway-access: "true" + tls: + certificateRefs: + - name: foo-example-com diff --git a/examples/v1beta1/cross-namespace-routing/site-route.yaml b/examples/v1beta1/cross-namespace-routing/site-route.yaml new file mode 100644 index 0000000000..a9b9021da4 --- /dev/null +++ b/examples/v1beta1/cross-namespace-routing/site-route.yaml @@ -0,0 +1,36 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/multiple-ns.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: home + namespace: site-ns +spec: + parentRefs: + - name: shared-gateway + namespace: infra-ns + rules: + - backendRefs: + - name: home + port: 8080 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: login + namespace: site-ns +spec: + parentRefs: + - name: shared-gateway + namespace: infra-ns + rules: + - matches: + - path: + value: /login + backendRefs: + - name: login-v1 + port: 8080 + weight: 90 + - name: login-v2 + port: 8080 + weight: 10 diff --git a/examples/v1beta1/cross-namespace-routing/store-route.yaml b/examples/v1beta1/cross-namespace-routing/store-route.yaml new file mode 100644 index 0000000000..781d1173ad --- /dev/null +++ b/examples/v1beta1/cross-namespace-routing/store-route.yaml @@ -0,0 +1,18 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/multiple-ns.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: store + namespace: store-ns +spec: + parentRefs: + - name: shared-gateway + namespace: infra-ns + rules: + - matches: + - path: + value: /store + backendRefs: + - name: store + port: 8080 diff --git a/examples/v1beta1/default-match-http.yaml b/examples/v1beta1/default-match-http.yaml new file mode 100644 index 0000000000..88f27f750d --- /dev/null +++ b/examples/v1beta1/default-match-http.yaml @@ -0,0 +1,51 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: GatewayClass +metadata: + name: default-match-example +spec: + controllerName: acme.io/gateway-controller +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: default-match-gw +spec: + gatewayClassName: default-match-example + listeners: + - name: http + protocol: HTTP + port: 80 +--- +# This HTTPRoute demonstrates patch match defaulting. If no path match is +# specified, CRD defaults adds a default PathPrefix match on the path "/". This +# matches every HTTP request and ensures that route rules always have at +# least one valid match. +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: default-match-route + labels: + app: default-match +spec: + parentRefs: + - name: default-match-gw + hostnames: + - default-match.com + rules: + - matches: + - headers: + - type: Exact + name: magic + value: default-match + backendRefs: + - group: acme.io + kind: CustomBackend + name: my-custom-resource + port: 8080 + - matches: + - path: + type: Exact + value: /example/exact + backendRefs: + - name: my-service-2 + port: 8080 diff --git a/examples/v1beta1/http-filter.yaml b/examples/v1beta1/http-filter.yaml new file mode 100644 index 0000000000..31ac75fc71 --- /dev/null +++ b/examples/v1beta1/http-filter.yaml @@ -0,0 +1,20 @@ +#$ Used in: +#$ - site-src/v1beta1/api-types/httproute.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-filter-1 +spec: + hostnames: + - my.filter.com + rules: + - filters: + - type: RequestHeaderModifier + requestHeaderModifier: + add: + - name: my-header + value: foo + backendRefs: + - name: my-filter-svc1 + weight: 1 + port: 80 diff --git a/examples/v1beta1/http-redirect.yaml b/examples/v1beta1/http-redirect.yaml new file mode 100644 index 0000000000..a875530443 --- /dev/null +++ b/examples/v1beta1/http-redirect.yaml @@ -0,0 +1,68 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: GatewayClass +metadata: + name: filter-lb +spec: + controllerName: acme.io/gateway-controller + parametersRef: + name: acme-lb + group: acme.io + kind: Parameters +--- +apiVersion: v1 +kind: Namespace +metadata: + name: gateway-api-example-ns1 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: my-filter-gateway + namespace: gateway-api-example-ns1 +spec: + gatewayClassName: filter-lb + listeners: + - name: http + protocol: HTTP + port: 80 + - name: https + protocol: HTTPS + port: 443 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-filter-1 + namespace: gateway-api-example-ns1 +spec: + parentRefs: + - name: my-filter-gateway + sectionName: http + hostnames: + - my-filter.example.com + rules: + - filters: + - type: RequestRedirect + requestRedirect: + scheme: https +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: http-filter-2 + namespace: gateway-api-example-ns1 +spec: + parentRefs: + - name: my-filter-gateway + sectionName: https + hostnames: + - my-filter.example.com + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: my-filter-svc1 + weight: 1 + port: 80 diff --git a/examples/v1beta1/http-route-attachment/gateway-namespaces.yaml b/examples/v1beta1/http-route-attachment/gateway-namespaces.yaml new file mode 100644 index 0000000000..9e23ac65fc --- /dev/null +++ b/examples/v1beta1/http-route-attachment/gateway-namespaces.yaml @@ -0,0 +1,21 @@ +#$ Used in: +#$ - site-src/concepts/api-overview.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: prod-gateway + namespace: gateway-api-example-ns1 +spec: + gatewayClassName: foo-lb + listeners: + - name: prod-web + port: 80 + protocol: HTTP + allowedRoutes: + kinds: + - kind: HTTPRoute + namespaces: + from: Selector + selector: + matchLabels: + expose-apps: "true" diff --git a/examples/v1beta1/http-route-attachment/gateway-strict.yaml b/examples/v1beta1/http-route-attachment/gateway-strict.yaml new file mode 100644 index 0000000000..7d5f55b0b0 --- /dev/null +++ b/examples/v1beta1/http-route-attachment/gateway-strict.yaml @@ -0,0 +1,23 @@ +#$ Used in: +#$ - site-src/concepts/api-overview.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: foo-gateway + namespace: gateway-api-example-ns1 +spec: + gatewayClassName: foo-lb + listeners: + - name: prod-web + port: 80 + protocol: HTTP + allowedRoutes: + kinds: + - kind: HTTPRoute + namespaces: + from: Selector + selector: + matchLabels: + # This label is added automatically as of K8s 1.22 + # to all namespaces + kubernetes.io/metadata.name: gateway-api-example-ns2 diff --git a/examples/v1beta1/http-route-attachment/httproute.yaml b/examples/v1beta1/http-route-attachment/httproute.yaml new file mode 100644 index 0000000000..a8425bfca1 --- /dev/null +++ b/examples/v1beta1/http-route-attachment/httproute.yaml @@ -0,0 +1,16 @@ +#$ Used in: +#$ - site-src/concepts/api-overview.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: my-route + namespace: gateway-api-example-ns2 +spec: + parentRefs: + - kind: Gateway + name: foo-gateway + namespace: gateway-api-example-ns1 + rules: + - backendRefs: + - name: foo-svc + port: 8080 diff --git a/examples/v1beta1/http-routing/bar-httproute.yaml b/examples/v1beta1/http-routing/bar-httproute.yaml new file mode 100644 index 0000000000..179c366032 --- /dev/null +++ b/examples/v1beta1/http-routing/bar-httproute.yaml @@ -0,0 +1,23 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/http-routing.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: bar-route +spec: + parentRefs: + - name: example-gateway + hostnames: + - "bar.example.com" + rules: + - matches: + - headers: + - type: Exact + name: env + value: canary + backendRefs: + - name: bar-svc-canary + port: 8080 + - backendRefs: + - name: bar-svc + port: 8080 diff --git a/examples/v1beta1/http-routing/foo-httproute.yaml b/examples/v1beta1/http-routing/foo-httproute.yaml new file mode 100644 index 0000000000..254cbaba41 --- /dev/null +++ b/examples/v1beta1/http-routing/foo-httproute.yaml @@ -0,0 +1,19 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/http-routing.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: foo-route +spec: + parentRefs: + - name: example-gateway + hostnames: + - "foo.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: foo-svc + port: 8080 diff --git a/examples/v1beta1/http-routing/gateway.yaml b/examples/v1beta1/http-routing/gateway.yaml new file mode 100644 index 0000000000..dab9c04c0c --- /dev/null +++ b/examples/v1beta1/http-routing/gateway.yaml @@ -0,0 +1,26 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/http-routing.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: example-gateway +spec: + gatewayClassName: example-gateway-class + listeners: + - name: http + protocol: HTTP + port: 80 +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: example-route +spec: + parentRefs: + - name: example-gateway + hostnames: + - "example.com" + rules: + - backendRefs: + - name: example-svc + port: 80 diff --git a/examples/v1beta1/simple-gateway/gateway.yaml b/examples/v1beta1/simple-gateway/gateway.yaml new file mode 100644 index 0000000000..8127cb636b --- /dev/null +++ b/examples/v1beta1/simple-gateway/gateway.yaml @@ -0,0 +1,16 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/traffic-splitting.md +#$ - site-src/v1beta1/guides/simple-gateway.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: prod-web +spec: + gatewayClassName: acme-lb + listeners: + - protocol: HTTP + port: 80 + name: prod-web-gw + allowedRoutes: + namespaces: + from: Same diff --git a/examples/v1beta1/simple-gateway/httproute.yaml b/examples/v1beta1/simple-gateway/httproute.yaml new file mode 100644 index 0000000000..e16eb8a398 --- /dev/null +++ b/examples/v1beta1/simple-gateway/httproute.yaml @@ -0,0 +1,14 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/simple-gateway.md +#$ - site-src/blog/2021/introducing-v1beta1.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: foo +spec: + parentRefs: + - name: prod-web + rules: + - backendRefs: + - name: foo-svc + port: 8080 diff --git a/examples/v1beta1/tls-basic.yaml b/examples/v1beta1/tls-basic.yaml new file mode 100644 index 0000000000..ddcafe76b4 --- /dev/null +++ b/examples/v1beta1/tls-basic.yaml @@ -0,0 +1,27 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/tls.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: tls-basic +spec: + gatewayClassName: acme-lb + listeners: + - name: foo-https + protocol: HTTPS + port: 443 + hostname: foo.example.com + tls: + certificateRefs: + - kind: Secret + group: "" + name: foo-example-com-cert + - name: bar-https + protocol: HTTPS + port: 443 + hostname: bar.example.com + tls: + certificateRefs: + - kind: Secret + group: "" + name: bar-example-com-cert diff --git a/examples/v1beta1/traffic-splitting/simple-split.yaml b/examples/v1beta1/traffic-splitting/simple-split.yaml new file mode 100644 index 0000000000..967570c753 --- /dev/null +++ b/examples/v1beta1/traffic-splitting/simple-split.yaml @@ -0,0 +1,15 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/traffic-splitting.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: simple-split +spec: + rules: + - backendRefs: + - name: foo-v1 + port: 8080 + weight: 90 + - name: foo-v2 + port: 8080 + weight: 10 diff --git a/examples/v1beta1/traffic-splitting/traffic-split-1.yaml b/examples/v1beta1/traffic-splitting/traffic-split-1.yaml new file mode 100644 index 0000000000..79725172e9 --- /dev/null +++ b/examples/v1beta1/traffic-splitting/traffic-split-1.yaml @@ -0,0 +1,22 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/traffic-splitting.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: foo-route + labels: + gateway: prod-web-gw +spec: + hostnames: + - foo.example.com + rules: + - backendRefs: + - name: foo-v1 + port: 8080 + - matches: + - headers: + - name: traffic + value: test + backendRefs: + - name: foo-v2 + port: 8080 diff --git a/examples/v1alpha1/traffic-splitting/traffic-split-2.yaml b/examples/v1beta1/traffic-splitting/traffic-split-2.yaml similarity index 51% rename from examples/v1alpha1/traffic-splitting/traffic-split-2.yaml rename to examples/v1beta1/traffic-splitting/traffic-split-2.yaml index 8b3957600c..7d48483986 100644 --- a/examples/v1alpha1/traffic-splitting/traffic-split-2.yaml +++ b/examples/v1beta1/traffic-splitting/traffic-split-2.yaml @@ -1,6 +1,7 @@ #$ Used in: -#$ - site-src/v1alpha1/guides/traffic-splitting.md -apiVersion: networking.x-k8s.io/v1alpha1 +#$ - site-src/v1beta1/guides/traffic-splitting.md +#$ - site-src/v1beta1/api-types/httproute.md +apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: name: foo-route @@ -10,10 +11,10 @@ spec: hostnames: - foo.example.com rules: - - forwardTo: - - serviceName: foo-v1 + - backendRefs: + - name: foo-v1 port: 8080 weight: 90 - - serviceName: foo-v2 + - name: foo-v2 port: 8080 weight: 10 diff --git a/examples/v1alpha1/traffic-splitting/traffic-split-3.yaml b/examples/v1beta1/traffic-splitting/traffic-split-3.yaml similarity index 56% rename from examples/v1alpha1/traffic-splitting/traffic-split-3.yaml rename to examples/v1beta1/traffic-splitting/traffic-split-3.yaml index d35060a851..ca42f79ac5 100644 --- a/examples/v1alpha1/traffic-splitting/traffic-split-3.yaml +++ b/examples/v1beta1/traffic-splitting/traffic-split-3.yaml @@ -1,6 +1,6 @@ #$ Used in: -#$ - site-src/v1alpha1/guides/traffic-splitting.md -apiVersion: networking.x-k8s.io/v1alpha1 +#$ - site-src/v1beta1/guides/traffic-splitting.md +apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: name: foo-route @@ -10,10 +10,10 @@ spec: hostnames: - foo.example.com rules: - - forwardTo: - - serviceName: foo-v1 + - backendRefs: + - name: foo-v1 port: 8080 weight: 0 - - serviceName: foo-v2 + - name: foo-v2 port: 8080 weight: 1 diff --git a/examples/v1beta1/wildcard-tls-gateway.yaml b/examples/v1beta1/wildcard-tls-gateway.yaml new file mode 100644 index 0000000000..a871f8d7af --- /dev/null +++ b/examples/v1beta1/wildcard-tls-gateway.yaml @@ -0,0 +1,27 @@ +#$ Used in: +#$ - site-src/v1beta1/guides/tls.md +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: Gateway +metadata: + name: wildcard-tls-gateway +spec: + gatewayClassName: acme-lb + listeners: + - name: foo-https + protocol: HTTPS + port: 443 + hostname: foo.example.com + tls: + certificateRefs: + - kind: Secret + group: "" + name: foo-example-com-cert + - name: wildcard-https + protocol: HTTPS + port: 443 + hostname: "*.example.com" + tls: + certificateRefs: + - kind: Secret + group: "" + name: wildcard-example-com-cert diff --git a/hack/make-docs.sh b/hack/make-docs.sh index 5de67044f3..686c316ed0 100755 --- a/hack/make-docs.sh +++ b/hack/make-docs.sh @@ -34,10 +34,6 @@ esac mkdir -p site # Generate docs with mkdocs mkdocs build -# Generate v1alpha1 API docs -./hack/api-docs/generate.sh v1alpha1 site/v1alpha1-spec.html -# Add them to spec page originally generated by mkdocs -run::sed -e '/REPLACE_WITH_GENERATED_CONTENT/{r site/v1alpha1-spec.html' -e 'd;}' site/v1alpha1/references/spec/index.html # Generate v1alpha2 API docs ./hack/api-docs/generate.sh v1alpha2 site/v1alpha2-spec.html # Add them to spec page originally generated by mkdocs diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index fe6d8dda93..4dd7b14bdd 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -33,7 +33,6 @@ mkdir -p "$GOPATH/src/sigs.k8s.io" ln -s "${SCRIPT_ROOT}" "$GOPATH/src/sigs.k8s.io/gateway-api" readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/client -readonly FQ_APIS=sigs.k8s.io/gateway-api/apis/v1alpha2 readonly APIS_PKG=sigs.k8s.io/gateway-api readonly CLIENTSET_NAME=versioned readonly CLIENTSET_PKG_NAME=clientset @@ -48,30 +47,30 @@ readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boi echo "Generating CRDs" go run ./pkg/generator -for VERSION in v1alpha2 +echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" +go run k8s.io/code-generator/cmd/client-gen \ + --clientset-name "${CLIENTSET_NAME}" \ + --input-base "" \ + --input "${APIS_PKG}/apis/v1alpha2,${APIS_PKG}/apis/v1beta1" \ + --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ + ${COMMON_FLAGS} + +echo "Generating listers at ${OUTPUT_PKG}/listers" +go run k8s.io/code-generator/cmd/lister-gen \ + --input-dirs "${APIS_PKG}/apis/v1alpha2,${APIS_PKG}/apis/v1beta1" \ + --output-package "${OUTPUT_PKG}/listers" \ + ${COMMON_FLAGS} + +echo "Generating informers at ${OUTPUT_PKG}/informers" +go run k8s.io/code-generator/cmd/informer-gen \ + --input-dirs "${APIS_PKG}/apis/v1alpha2,${APIS_PKG}/apis/v1beta1" \ + --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ + --listers-package "${OUTPUT_PKG}/listers" \ + --output-package "${OUTPUT_PKG}/informers" \ + ${COMMON_FLAGS} + +for VERSION in v1alpha2 v1beta1 do - echo "Generating ${VERSION} clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" - go run k8s.io/code-generator/cmd/client-gen \ - --clientset-name "${CLIENTSET_NAME}" \ - --input-base "" \ - --input "${APIS_PKG}/apis/${VERSION}" \ - --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ - ${COMMON_FLAGS} - - echo "Generating ${VERSION} listers at ${OUTPUT_PKG}/listers" - go run k8s.io/code-generator/cmd/lister-gen \ - --input-dirs "${APIS_PKG}/apis/${VERSION}" \ - --output-package "${OUTPUT_PKG}/listers" \ - ${COMMON_FLAGS} - - echo "Generating ${VERSION} informers at ${OUTPUT_PKG}/informers" - go run k8s.io/code-generator/cmd/informer-gen \ - --input-dirs "${APIS_PKG}/apis/${VERSION}" \ - --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ - --listers-package "${OUTPUT_PKG}/listers" \ - --output-package "${OUTPUT_PKG}/informers" \ - ${COMMON_FLAGS} - echo "Generating ${VERSION} register at ${APIS_PKG}/apis/${VERSION}" go run k8s.io/code-generator/cmd/register-gen \ --input-dirs "${APIS_PKG}/apis/${VERSION}" \ diff --git a/mkdocs.yml b/mkdocs.yml index 7f0ef0a23f..211d7f8f85 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,38 +43,22 @@ nav: - Implementations: implementations.md - FAQ: faq.md - Guides: - - v1alpha2: - - Getting started: v1alpha2/guides/getting-started.md - - Simple Gateway: v1alpha2/guides/simple-gateway.md - - HTTP routing: v1alpha2/guides/http-routing.md - - HTTP redirects and rewrites: v1alpha2/guides/http-redirect-rewrite.md - - HTTP traffic splitting: v1alpha2/guides/traffic-splitting.md - - Cross-Namespace routing: v1alpha2/guides/multiple-ns.md - - TLS: v1alpha2/guides/tls.md - - TCP routing: v1alpha2/guides/tcp.md - - v1alpha1: - - Getting started: v1alpha1/guides/getting-started.md - - Simple Gateway: v1alpha1/guides/simple-gateway.md - - HTTP routing: v1alpha1/guides/http-routing.md - - HTTP traffic splitting: v1alpha1/guides/traffic-splitting.md - - Cross-Namespace routing: v1alpha1/guides/multiple-ns.md - - TLS: v1alpha1/guides/tls.md - - TCP routing: v1alpha1/guides/tcp.md + - Getting started: v1alpha2/guides/getting-started.md + - Simple Gateway: v1alpha2/guides/simple-gateway.md + - HTTP routing: v1alpha2/guides/http-routing.md + - HTTP redirects and rewrites: v1alpha2/guides/http-redirect-rewrite.md + - HTTP traffic splitting: v1alpha2/guides/traffic-splitting.md + - Cross-Namespace routing: v1alpha2/guides/multiple-ns.md + - TLS: v1alpha2/guides/tls.md + - TCP routing: v1alpha2/guides/tcp.md - Reference: - - v1alpha2: - - API Types: - GatewayClass: v1alpha2/api-types/gatewayclass.md - Gateway: v1alpha2/api-types/gateway.md - HTTPRoute: v1alpha2/api-types/httproute.md - ReferenceGrant: v1alpha2/api-types/referencegrant.md - - API specification: v1alpha2/references/spec.md - - Policy Attachment: v1alpha2/references/policy-attachment.md - - v1alpha1: - - API Types: - GatewayClass: v1alpha1/api-types/gatewayclass.md - Gateway: v1alpha1/api-types/gateway.md - HTTPRoute: v1alpha1/api-types/httproute.md - - API specification: v1alpha1/references/spec.md + - API Types: + GatewayClass: v1alpha2/api-types/gatewayclass.md + Gateway: v1alpha2/api-types/gateway.md + HTTPRoute: v1alpha2/api-types/httproute.md + ReferenceGrant: v1alpha2/api-types/referencegrant.md + - API specification: v1alpha2/references/spec.md + - Policy Attachment: v1alpha2/references/policy-attachment.md - Enhancement Proposals: - Overview: contributing/gep.md - ... | geps/gep-*.md diff --git a/pkg/admission/server.go b/pkg/admission/server.go index 7f74e6ef77..be0e022737 100644 --- a/pkg/admission/server.go +++ b/pkg/admission/server.go @@ -31,6 +31,8 @@ import ( v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" v1a2Validation "sigs.k8s.io/gateway-api/apis/v1alpha2/validation" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + v1b1Validation "sigs.k8s.io/gateway-api/apis/v1beta1/validation" ) var ( @@ -54,6 +56,21 @@ var ( Version: v1alpha2.SchemeGroupVersion.Version, Resource: "gatewayclasses", } + v1b1HTTPRouteGVR = meta.GroupVersionResource{ + Group: v1beta1.SchemeGroupVersion.Group, + Version: v1beta1.SchemeGroupVersion.Version, + Resource: "httproutes", + } + v1b1GatewayGVR = meta.GroupVersionResource{ + Group: v1beta1.SchemeGroupVersion.Group, + Version: v1beta1.SchemeGroupVersion.Version, + Resource: "gateways", + } + v1b1GatewayClassGVR = meta.GroupVersionResource{ + Group: v1beta1.SchemeGroupVersion.Group, + Version: v1beta1.SchemeGroupVersion.Version, + Resource: "gatewayclasses", + } ) func log500(w http.ResponseWriter, err error) { @@ -154,6 +171,14 @@ func handleValidation(request admission.AdmissionRequest) (*admission.AdmissionR } fieldErr = v1a2Validation.ValidateHTTPRoute(&hRoute) + case v1b1HTTPRouteGVR: + var hRoute v1beta1.HTTPRoute + _, _, err := deserializer.Decode(request.Object.Raw, nil, &hRoute) + if err != nil { + return nil, err + } + + fieldErr = v1b1Validation.ValidateHTTPRoute(&hRoute) case v1a2GatewayGVR: var gateway v1alpha2.Gateway _, _, err := deserializer.Decode(request.Object.Raw, nil, &gateway) @@ -161,6 +186,13 @@ func handleValidation(request admission.AdmissionRequest) (*admission.AdmissionR return nil, err } fieldErr = v1a2Validation.ValidateGateway(&gateway) + case v1b1GatewayGVR: + var gateway v1beta1.Gateway + _, _, err := deserializer.Decode(request.Object.Raw, nil, &gateway) + if err != nil { + return nil, err + } + fieldErr = v1b1Validation.ValidateGateway(&gateway) case v1a2GatewayClassGVR: // runs only for updates if request.Operation != admission.Update { @@ -177,6 +209,22 @@ func handleValidation(request admission.AdmissionRequest) (*admission.AdmissionR return nil, err } fieldErr = v1a2Validation.ValidateGatewayClassUpdate(&gatewayClassOld, &gatewayClass) + case v1b1GatewayClassGVR: + // runs only for updates + if request.Operation != admission.Update { + break + } + var gatewayClass v1beta1.GatewayClass + _, _, err := deserializer.Decode(request.Object.Raw, nil, &gatewayClass) + if err != nil { + return nil, err + } + var gatewayClassOld v1beta1.GatewayClass + _, _, err = deserializer.Decode(request.OldObject.Raw, nil, &gatewayClassOld) + if err != nil { + return nil, err + } + fieldErr = v1b1Validation.ValidateGatewayClassUpdate(&gatewayClassOld, &gatewayClass) default: return nil, fmt.Errorf("unknown resource '%v'", request.Resource.Resource) } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index a28480532d..4c627a16bb 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -25,11 +25,13 @@ import ( rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2" + gatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" ) type Interface interface { Discovery() discovery.DiscoveryInterface GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface + GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -37,6 +39,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient gatewayV1alpha2 *gatewayv1alpha2.GatewayV1alpha2Client + gatewayV1beta1 *gatewayv1beta1.GatewayV1beta1Client } // GatewayV1alpha2 retrieves the GatewayV1alpha2Client @@ -44,6 +47,11 @@ func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { return c.gatewayV1alpha2 } +// GatewayV1beta1 retrieves the GatewayV1beta1Client +func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { + return c.gatewayV1beta1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -69,6 +77,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.gatewayV1beta1, err = gatewayv1beta1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -82,6 +94,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.gatewayV1alpha2 = gatewayv1alpha2.NewForConfigOrDie(c) + cs.gatewayV1beta1 = gatewayv1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -91,6 +104,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.gatewayV1alpha2 = gatewayv1alpha2.New(c) + cs.gatewayV1beta1 = gatewayv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index dcc655df9e..62bd300060 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -27,6 +27,8 @@ import ( clientset "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2" fakegatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake" + gatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" + fakegatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake" ) // NewSimpleClientset returns a clientset that will respond with the provided objects. @@ -83,3 +85,8 @@ var ( func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { return &fakegatewayv1alpha2.FakeGatewayV1alpha2{Fake: &c.Fake} } + +// GatewayV1beta1 retrieves the GatewayV1beta1Client +func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { + return &fakegatewayv1beta1.FakeGatewayV1beta1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 6514add16b..8a39b3ade9 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -25,6 +25,7 @@ import ( serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) var scheme = runtime.NewScheme() @@ -32,6 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ gatewayv1alpha2.AddToScheme, + gatewayv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 913daac0b3..dfa04acdaa 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -25,6 +25,7 @@ import ( serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) var Scheme = runtime.NewScheme() @@ -32,6 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ gatewayv1alpha2.AddToScheme, + gatewayv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/apis_client.go new file mode 100644 index 0000000000..8212f4a894 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/apis_client.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + rest "k8s.io/client-go/rest" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +type GatewayV1beta1Interface interface { + RESTClient() rest.Interface + GatewaysGetter + GatewayClassesGetter + HTTPRoutesGetter +} + +// GatewayV1beta1Client is used to interact with features provided by the gateway.networking.k8s.io group. +type GatewayV1beta1Client struct { + restClient rest.Interface +} + +func (c *GatewayV1beta1Client) Gateways(namespace string) GatewayInterface { + return newGateways(c, namespace) +} + +func (c *GatewayV1beta1Client) GatewayClasses() GatewayClassInterface { + return newGatewayClasses(c) +} + +func (c *GatewayV1beta1Client) HTTPRoutes(namespace string) HTTPRouteInterface { + return newHTTPRoutes(c, namespace) +} + +// NewForConfig creates a new GatewayV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*GatewayV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &GatewayV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new GatewayV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *GatewayV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new GatewayV1beta1Client for the given RESTClient. +func New(c rest.Interface) *GatewayV1beta1Client { + return &GatewayV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *GatewayV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/apis/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/doc.go similarity index 70% rename from apis/v1alpha1/doc.go rename to pkg/client/clientset/versioned/typed/apis/v1beta1/doc.go index 57286c062d..771101956f 100644 --- a/apis/v1alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Kubernetes Authors. +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the networking.x-k8s.io -// API group. -// +kubebuilder:object:generate=true -// +groupName=networking.x-k8s.io -package v1alpha1 +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/doc.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/doc.go new file mode 100644 index 0000000000..16f4439906 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_apis_client.go new file mode 100644 index 0000000000..3760228b97 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_apis_client.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" +) + +type FakeGatewayV1beta1 struct { + *testing.Fake +} + +func (c *FakeGatewayV1beta1) Gateways(namespace string) v1beta1.GatewayInterface { + return &FakeGateways{c, namespace} +} + +func (c *FakeGatewayV1beta1) GatewayClasses() v1beta1.GatewayClassInterface { + return &FakeGatewayClasses{c} +} + +func (c *FakeGatewayV1beta1) HTTPRoutes(namespace string) v1beta1.HTTPRouteInterface { + return &FakeHTTPRoutes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeGatewayV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go new file mode 100644 index 0000000000..b2d223a9bf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go @@ -0,0 +1,142 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// FakeGateways implements GatewayInterface +type FakeGateways struct { + Fake *FakeGatewayV1beta1 + ns string +} + +var gatewaysResource = schema.GroupVersionResource{Group: "gateway.networking.k8s.io", Version: "v1beta1", Resource: "gateways"} + +var gatewaysKind = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1beta1", Kind: "Gateway"} + +// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. +func (c *FakeGateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1beta1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Gateway), err +} + +// List takes label and field selectors, and returns the list of Gateways that match those selectors. +func (c *FakeGateways) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1beta1.GatewayList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.GatewayList{ListMeta: obj.(*v1beta1.GatewayList).ListMeta} + for _, item := range obj.(*v1beta1.GatewayList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested gateways. +func (c *FakeGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts)) + +} + +// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *FakeGateways) Create(ctx context.Context, gateway *v1beta1.Gateway, opts v1.CreateOptions) (result *v1beta1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1beta1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Gateway), err +} + +// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *FakeGateways) Update(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1beta1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Gateway), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeGateways) UpdateStatus(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(gatewaysResource, "status", c.ns, gateway), &v1beta1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Gateway), err +} + +// Delete takes name of the gateway and deletes it. Returns an error if one occurs. +func (c *FakeGateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(gatewaysResource, c.ns, name), &v1beta1.Gateway{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta1.GatewayList{}) + return err +} + +// Patch applies the patch and returns the patched gateway. +func (c *FakeGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1beta1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Gateway), err +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go new file mode 100644 index 0000000000..1f453231f2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go @@ -0,0 +1,133 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// FakeGatewayClasses implements GatewayClassInterface +type FakeGatewayClasses struct { + Fake *FakeGatewayV1beta1 +} + +var gatewayclassesResource = schema.GroupVersionResource{Group: "gateway.networking.k8s.io", Version: "v1beta1", Resource: "gatewayclasses"} + +var gatewayclassesKind = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1beta1", Kind: "GatewayClass"} + +// Get takes name of the gatewayClass, and returns the corresponding gatewayClass object, and an error if there is any. +func (c *FakeGatewayClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(gatewayclassesResource, name), &v1beta1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.GatewayClass), err +} + +// List takes label and field selectors, and returns the list of GatewayClasses that match those selectors. +func (c *FakeGatewayClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(gatewayclassesResource, gatewayclassesKind, opts), &v1beta1.GatewayClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.GatewayClassList{ListMeta: obj.(*v1beta1.GatewayClassList).ListMeta} + for _, item := range obj.(*v1beta1.GatewayClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested gatewayClasses. +func (c *FakeGatewayClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(gatewayclassesResource, opts)) +} + +// Create takes the representation of a gatewayClass and creates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *FakeGatewayClasses) Create(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.CreateOptions) (result *v1beta1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(gatewayclassesResource, gatewayClass), &v1beta1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.GatewayClass), err +} + +// Update takes the representation of a gatewayClass and updates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *FakeGatewayClasses) Update(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(gatewayclassesResource, gatewayClass), &v1beta1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.GatewayClass), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeGatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(gatewayclassesResource, "status", gatewayClass), &v1beta1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.GatewayClass), err +} + +// Delete takes name of the gatewayClass and deletes it. Returns an error if one occurs. +func (c *FakeGatewayClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(gatewayclassesResource, name), &v1beta1.GatewayClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGatewayClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(gatewayclassesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta1.GatewayClassList{}) + return err +} + +// Patch applies the patch and returns the patched gatewayClass. +func (c *FakeGatewayClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, name, pt, data, subresources...), &v1beta1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.GatewayClass), err +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go new file mode 100644 index 0000000000..e3d55b9435 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go @@ -0,0 +1,142 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// FakeHTTPRoutes implements HTTPRouteInterface +type FakeHTTPRoutes struct { + Fake *FakeGatewayV1beta1 + ns string +} + +var httproutesResource = schema.GroupVersionResource{Group: "gateway.networking.k8s.io", Version: "v1beta1", Resource: "httproutes"} + +var httproutesKind = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1beta1", Kind: "HTTPRoute"} + +// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. +func (c *FakeHTTPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1beta1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.HTTPRoute), err +} + +// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. +func (c *FakeHTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1beta1.HTTPRouteList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.HTTPRouteList{ListMeta: obj.(*v1beta1.HTTPRouteList).ListMeta} + for _, item := range obj.(*v1beta1.HTTPRouteList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested hTTPRoutes. +func (c *FakeHTTPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(httproutesResource, c.ns, opts)) + +} + +// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *FakeHTTPRoutes) Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.HTTPRoute), err +} + +// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *FakeHTTPRoutes) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.HTTPRoute), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.HTTPRoute), err +} + +// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. +func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(httproutesResource, c.ns, name), &v1beta1.HTTPRoute{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(httproutesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta1.HTTPRouteList{}) + return err +} + +// Patch applies the patch and returns the patched hTTPRoute. +func (c *FakeHTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1beta1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.HTTPRoute), err +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go new file mode 100644 index 0000000000..a9dc052635 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go @@ -0,0 +1,195 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// GatewaysGetter has a method to return a GatewayInterface. +// A group's client should implement this interface. +type GatewaysGetter interface { + Gateways(namespace string) GatewayInterface +} + +// GatewayInterface has methods to work with Gateway resources. +type GatewayInterface interface { + Create(ctx context.Context, gateway *v1beta1.Gateway, opts v1.CreateOptions) (*v1beta1.Gateway, error) + Update(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) + UpdateStatus(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Gateway, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.GatewayList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Gateway, err error) + GatewayExpansion +} + +// gateways implements GatewayInterface +type gateways struct { + client rest.Interface + ns string +} + +// newGateways returns a Gateways +func newGateways(c *GatewayV1beta1Client, namespace string) *gateways { + return &gateways{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. +func (c *gateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Gateway, err error) { + result = &v1beta1.Gateway{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gateways"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Gateways that match those selectors. +func (c *gateways) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.GatewayList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gateways. +func (c *gateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *gateways) Create(ctx context.Context, gateway *v1beta1.Gateway, opts v1.CreateOptions) (result *v1beta1.Gateway, err error) { + result = &v1beta1.Gateway{} + err = c.client.Post(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *gateways) Update(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { + result = &v1beta1.Gateway{} + err = c.client.Put(). + Namespace(c.ns). + Resource("gateways"). + Name(gateway.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *gateways) UpdateStatus(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { + result = &v1beta1.Gateway{} + err = c.client.Put(). + Namespace(c.ns). + Resource("gateways"). + Name(gateway.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the gateway and deletes it. Returns an error if one occurs. +func (c *gateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("gateways"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched gateway. +func (c *gateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Gateway, err error) { + result = &v1beta1.Gateway{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("gateways"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go new file mode 100644 index 0000000000..c475594631 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go @@ -0,0 +1,184 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// GatewayClassesGetter has a method to return a GatewayClassInterface. +// A group's client should implement this interface. +type GatewayClassesGetter interface { + GatewayClasses() GatewayClassInterface +} + +// GatewayClassInterface has methods to work with GatewayClass resources. +type GatewayClassInterface interface { + Create(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.CreateOptions) (*v1beta1.GatewayClass, error) + Update(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) + UpdateStatus(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.GatewayClass, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.GatewayClassList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayClass, err error) + GatewayClassExpansion +} + +// gatewayClasses implements GatewayClassInterface +type gatewayClasses struct { + client rest.Interface +} + +// newGatewayClasses returns a GatewayClasses +func newGatewayClasses(c *GatewayV1beta1Client) *gatewayClasses { + return &gatewayClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the gatewayClass, and returns the corresponding gatewayClass object, and an error if there is any. +func (c *gatewayClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GatewayClass, err error) { + result = &v1beta1.GatewayClass{} + err = c.client.Get(). + Resource("gatewayclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GatewayClasses that match those selectors. +func (c *gatewayClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayClassList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.GatewayClassList{} + err = c.client.Get(). + Resource("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gatewayClasses. +func (c *gatewayClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a gatewayClass and creates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *gatewayClasses) Create(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.CreateOptions) (result *v1beta1.GatewayClass, err error) { + result = &v1beta1.GatewayClass{} + err = c.client.Post(). + Resource("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a gatewayClass and updates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *gatewayClasses) Update(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { + result = &v1beta1.GatewayClass{} + err = c.client.Put(). + Resource("gatewayclasses"). + Name(gatewayClass.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *gatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { + result = &v1beta1.GatewayClass{} + err = c.client.Put(). + Resource("gatewayclasses"). + Name(gatewayClass.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the gatewayClass and deletes it. Returns an error if one occurs. +func (c *gatewayClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("gatewayclasses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gatewayClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("gatewayclasses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched gatewayClass. +func (c *gatewayClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayClass, err error) { + result = &v1beta1.GatewayClass{} + err = c.client.Patch(pt). + Resource("gatewayclasses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/generated_expansion.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/generated_expansion.go new file mode 100644 index 0000000000..98d1619998 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/generated_expansion.go @@ -0,0 +1,25 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +type GatewayExpansion interface{} + +type GatewayClassExpansion interface{} + +type HTTPRouteExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go b/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go new file mode 100644 index 0000000000..219ae7c977 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go @@ -0,0 +1,195 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// HTTPRoutesGetter has a method to return a HTTPRouteInterface. +// A group's client should implement this interface. +type HTTPRoutesGetter interface { + HTTPRoutes(namespace string) HTTPRouteInterface +} + +// HTTPRouteInterface has methods to work with HTTPRoute resources. +type HTTPRouteInterface interface { + Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (*v1beta1.HTTPRoute, error) + Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) + UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.HTTPRoute, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.HTTPRouteList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) + HTTPRouteExpansion +} + +// hTTPRoutes implements HTTPRouteInterface +type hTTPRoutes struct { + client rest.Interface + ns string +} + +// newHTTPRoutes returns a HTTPRoutes +func newHTTPRoutes(c *GatewayV1beta1Client, namespace string) *hTTPRoutes { + return &hTTPRoutes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. +func (c *hTTPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { + result = &v1beta1.HTTPRoute{} + err = c.client.Get(). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. +func (c *hTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.HTTPRouteList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested hTTPRoutes. +func (c *hTTPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *hTTPRoutes) Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { + result = &v1beta1.HTTPRoute{} + err = c.client.Post(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *hTTPRoutes) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + result = &v1beta1.HTTPRoute{} + err = c.client.Put(). + Namespace(c.ns). + Resource("httproutes"). + Name(hTTPRoute.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *hTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + result = &v1beta1.HTTPRoute{} + err = c.client.Put(). + Namespace(c.ns). + Resource("httproutes"). + Name(hTTPRoute.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. +func (c *hTTPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *hTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched hTTPRoute. +func (c *hTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { + result = &v1beta1.HTTPRoute{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/apis/interface.go b/pkg/client/informers/externalversions/apis/interface.go index 48d07c5bc7..7d37107085 100644 --- a/pkg/client/informers/externalversions/apis/interface.go +++ b/pkg/client/informers/externalversions/apis/interface.go @@ -20,6 +20,7 @@ package apis import ( v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2" + v1beta1 "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1beta1" internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1alpha2 provides access to shared informers for resources in V1alpha2. V1alpha2() v1alpha2.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha2() v1alpha2.Interface { return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/apis/v1beta1/gateway.go b/pkg/client/informers/externalversions/apis/v1beta1/gateway.go new file mode 100644 index 0000000000..5da7a413e5 --- /dev/null +++ b/pkg/client/informers/externalversions/apis/v1beta1/gateway.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1beta1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1" +) + +// GatewayInformer provides access to a shared informer and lister for +// Gateways. +type GatewayInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.GatewayLister +} + +type gatewayInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewGatewayInformer constructs a new informer for Gateway type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGatewayInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredGatewayInformer constructs a new informer for Gateway type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().Gateways(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().Gateways(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1beta1.Gateway{}, + resyncPeriod, + indexers, + ) +} + +func (f *gatewayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGatewayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gatewayInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1beta1.Gateway{}, f.defaultInformer) +} + +func (f *gatewayInformer) Lister() v1beta1.GatewayLister { + return v1beta1.NewGatewayLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/apis/v1beta1/gatewayclass.go b/pkg/client/informers/externalversions/apis/v1beta1/gatewayclass.go new file mode 100644 index 0000000000..0f5e1be1a8 --- /dev/null +++ b/pkg/client/informers/externalversions/apis/v1beta1/gatewayclass.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1beta1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1" +) + +// GatewayClassInformer provides access to a shared informer and lister for +// GatewayClasses. +type GatewayClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.GatewayClassLister +} + +type gatewayClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewGatewayClassInformer constructs a new informer for GatewayClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewGatewayClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGatewayClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredGatewayClassInformer constructs a new informer for GatewayClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredGatewayClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().GatewayClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().GatewayClasses().Watch(context.TODO(), options) + }, + }, + &apisv1beta1.GatewayClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *gatewayClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGatewayClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gatewayClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1beta1.GatewayClass{}, f.defaultInformer) +} + +func (f *gatewayClassInformer) Lister() v1beta1.GatewayClassLister { + return v1beta1.NewGatewayClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/apis/v1beta1/httproute.go b/pkg/client/informers/externalversions/apis/v1beta1/httproute.go new file mode 100644 index 0000000000..bcdc7bb73e --- /dev/null +++ b/pkg/client/informers/externalversions/apis/v1beta1/httproute.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1beta1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1" +) + +// HTTPRouteInformer provides access to a shared informer and lister for +// HTTPRoutes. +type HTTPRouteInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.HTTPRouteLister +} + +type hTTPRouteInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHTTPRouteInformer constructs a new informer for HTTPRoute type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHTTPRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHTTPRouteInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHTTPRouteInformer constructs a new informer for HTTPRoute type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHTTPRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().HTTPRoutes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1beta1().HTTPRoutes(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1beta1.HTTPRoute{}, + resyncPeriod, + indexers, + ) +} + +func (f *hTTPRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHTTPRouteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *hTTPRouteInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1beta1.HTTPRoute{}, f.defaultInformer) +} + +func (f *hTTPRouteInformer) Lister() v1beta1.HTTPRouteLister { + return v1beta1.NewHTTPRouteLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/apis/v1beta1/interface.go b/pkg/client/informers/externalversions/apis/v1beta1/interface.go new file mode 100644 index 0000000000..8cfa2828a9 --- /dev/null +++ b/pkg/client/informers/externalversions/apis/v1beta1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Gateways returns a GatewayInformer. + Gateways() GatewayInformer + // GatewayClasses returns a GatewayClassInformer. + GatewayClasses() GatewayClassInformer + // HTTPRoutes returns a HTTPRouteInformer. + HTTPRoutes() HTTPRouteInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Gateways returns a GatewayInformer. +func (v *version) Gateways() GatewayInformer { + return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// GatewayClasses returns a GatewayClassInformer. +func (v *version) GatewayClasses() GatewayClassInformer { + return &gatewayClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// HTTPRoutes returns a HTTPRouteInformer. +func (v *version) HTTPRoutes() HTTPRouteInformer { + return &hTTPRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 6f17f4f85f..c08e1e31c5 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) // GenericInformer is type of SharedIndexInformer which will locate and delegate to other @@ -68,6 +69,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha2.SchemeGroupVersion.WithResource("udproutes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().UDPRoutes().Informer()}, nil + // Group=gateway.networking.k8s.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("gateways"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1beta1().Gateways().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("gatewayclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1beta1().GatewayClasses().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("httproutes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1beta1().HTTPRoutes().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/listers/apis/v1beta1/expansion_generated.go b/pkg/client/listers/apis/v1beta1/expansion_generated.go new file mode 100644 index 0000000000..bb25592a92 --- /dev/null +++ b/pkg/client/listers/apis/v1beta1/expansion_generated.go @@ -0,0 +1,39 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// GatewayListerExpansion allows custom methods to be added to +// GatewayLister. +type GatewayListerExpansion interface{} + +// GatewayNamespaceListerExpansion allows custom methods to be added to +// GatewayNamespaceLister. +type GatewayNamespaceListerExpansion interface{} + +// GatewayClassListerExpansion allows custom methods to be added to +// GatewayClassLister. +type GatewayClassListerExpansion interface{} + +// HTTPRouteListerExpansion allows custom methods to be added to +// HTTPRouteLister. +type HTTPRouteListerExpansion interface{} + +// HTTPRouteNamespaceListerExpansion allows custom methods to be added to +// HTTPRouteNamespaceLister. +type HTTPRouteNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/apis/v1beta1/gateway.go b/pkg/client/listers/apis/v1beta1/gateway.go new file mode 100644 index 0000000000..34a6707cb0 --- /dev/null +++ b/pkg/client/listers/apis/v1beta1/gateway.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// GatewayLister helps list Gateways. +// All objects returned here must be treated as read-only. +type GatewayLister interface { + // List lists all Gateways in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Gateway, err error) + // Gateways returns an object that can list and get Gateways. + Gateways(namespace string) GatewayNamespaceLister + GatewayListerExpansion +} + +// gatewayLister implements the GatewayLister interface. +type gatewayLister struct { + indexer cache.Indexer +} + +// NewGatewayLister returns a new GatewayLister. +func NewGatewayLister(indexer cache.Indexer) GatewayLister { + return &gatewayLister{indexer: indexer} +} + +// List lists all Gateways in the indexer. +func (s *gatewayLister) List(selector labels.Selector) (ret []*v1beta1.Gateway, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Gateway)) + }) + return ret, err +} + +// Gateways returns an object that can list and get Gateways. +func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { + return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// GatewayNamespaceLister helps list and get Gateways. +// All objects returned here must be treated as read-only. +type GatewayNamespaceLister interface { + // List lists all Gateways in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Gateway, err error) + // Get retrieves the Gateway from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Gateway, error) + GatewayNamespaceListerExpansion +} + +// gatewayNamespaceLister implements the GatewayNamespaceLister +// interface. +type gatewayNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Gateways in the indexer for a given namespace. +func (s gatewayNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Gateway, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Gateway)) + }) + return ret, err +} + +// Get retrieves the Gateway from the indexer for a given namespace and name. +func (s gatewayNamespaceLister) Get(name string) (*v1beta1.Gateway, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("gateway"), name) + } + return obj.(*v1beta1.Gateway), nil +} diff --git a/pkg/client/listers/apis/v1beta1/gatewayclass.go b/pkg/client/listers/apis/v1beta1/gatewayclass.go new file mode 100644 index 0000000000..2161270142 --- /dev/null +++ b/pkg/client/listers/apis/v1beta1/gatewayclass.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// GatewayClassLister helps list GatewayClasses. +// All objects returned here must be treated as read-only. +type GatewayClassLister interface { + // List lists all GatewayClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.GatewayClass, err error) + // Get retrieves the GatewayClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.GatewayClass, error) + GatewayClassListerExpansion +} + +// gatewayClassLister implements the GatewayClassLister interface. +type gatewayClassLister struct { + indexer cache.Indexer +} + +// NewGatewayClassLister returns a new GatewayClassLister. +func NewGatewayClassLister(indexer cache.Indexer) GatewayClassLister { + return &gatewayClassLister{indexer: indexer} +} + +// List lists all GatewayClasses in the indexer. +func (s *gatewayClassLister) List(selector labels.Selector) (ret []*v1beta1.GatewayClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.GatewayClass)) + }) + return ret, err +} + +// Get retrieves the GatewayClass from the index for a given name. +func (s *gatewayClassLister) Get(name string) (*v1beta1.GatewayClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("gatewayclass"), name) + } + return obj.(*v1beta1.GatewayClass), nil +} diff --git a/pkg/client/listers/apis/v1beta1/httproute.go b/pkg/client/listers/apis/v1beta1/httproute.go new file mode 100644 index 0000000000..6d27a03358 --- /dev/null +++ b/pkg/client/listers/apis/v1beta1/httproute.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// HTTPRouteLister helps list HTTPRoutes. +// All objects returned here must be treated as read-only. +type HTTPRouteLister interface { + // List lists all HTTPRoutes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) + // HTTPRoutes returns an object that can list and get HTTPRoutes. + HTTPRoutes(namespace string) HTTPRouteNamespaceLister + HTTPRouteListerExpansion +} + +// hTTPRouteLister implements the HTTPRouteLister interface. +type hTTPRouteLister struct { + indexer cache.Indexer +} + +// NewHTTPRouteLister returns a new HTTPRouteLister. +func NewHTTPRouteLister(indexer cache.Indexer) HTTPRouteLister { + return &hTTPRouteLister{indexer: indexer} +} + +// List lists all HTTPRoutes in the indexer. +func (s *hTTPRouteLister) List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.HTTPRoute)) + }) + return ret, err +} + +// HTTPRoutes returns an object that can list and get HTTPRoutes. +func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { + return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HTTPRouteNamespaceLister helps list and get HTTPRoutes. +// All objects returned here must be treated as read-only. +type HTTPRouteNamespaceLister interface { + // List lists all HTTPRoutes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) + // Get retrieves the HTTPRoute from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.HTTPRoute, error) + HTTPRouteNamespaceListerExpansion +} + +// hTTPRouteNamespaceLister implements the HTTPRouteNamespaceLister +// interface. +type hTTPRouteNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HTTPRoutes in the indexer for a given namespace. +func (s hTTPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.HTTPRoute)) + }) + return ret, err +} + +// Get retrieves the HTTPRoute from the indexer for a given namespace and name. +func (s hTTPRouteNamespaceLister) Get(name string) (*v1beta1.HTTPRoute, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("httproute"), name) + } + return obj.(*v1beta1.HTTPRoute), nil +} diff --git a/pkg/generator/main.go b/pkg/generator/main.go index a67bc5a224..dd0de8e344 100644 --- a/pkg/generator/main.go +++ b/pkg/generator/main.go @@ -39,12 +39,21 @@ const ( approvalLink = "https://github.com/kubernetes-sigs/gateway-api/pull/891" ) +var ( + standardKinds = map[string]bool{ + "GatewayClass": true, + "Gateway": true, + "HTTPRoute": true, + } +) + // This generation code is largely copied from // github.com/kubernetes-sigs/controller-tools/blob/ab52f76cc7d167925b2d5942f24bf22e30f49a02/pkg/crd/gen.go func main() { roots, err := loader.LoadRoots( "k8s.io/apimachinery/pkg/runtime/schema", // Needed to parse generated register functions. "sigs.k8s.io/gateway-api/apis/v1alpha2", + "sigs.k8s.io/gateway-api/apis/v1beta1", ) if err != nil { @@ -83,6 +92,9 @@ func main() { channels := []string{"standard", "experimental"} for _, channel := range channels { for groupKind := range kubeKinds { + if channel == "standard" && !standardKinds[groupKind.Kind] { + continue + } log.Printf("generating %s CRD for %v\n", channel, groupKind) parser.NeedCRDFor(groupKind, nil) diff --git a/site-src/blog/2021/introducing-v1alpha2.md b/site-src/blog/2021/introducing-v1alpha2.md index 18245d6b90..7cbe980edd 100644 --- a/site-src/blog/2021/introducing-v1alpha2.md +++ b/site-src/blog/2021/introducing-v1alpha2.md @@ -66,7 +66,7 @@ namespace to forward traffic to Services wherever this ReferenceGrant was installed: ```yaml -{% include 'v1alpha2/reference-grant.yaml' %} +{% include 'experimental/v1alpha2/reference-grant.yaml' %} ``` This is covered in more detail in [GEP 709](https://gateway-api.sigs.k8s.io/geps/gep-709/). diff --git a/site-src/concepts/security-model.md b/site-src/concepts/security-model.md index b2fd7f674e..8e8a8384fb 100644 --- a/site-src/concepts/security-model.md +++ b/site-src/concepts/security-model.md @@ -118,7 +118,7 @@ the "prod" namespace to HTTPRoutes that are deployed in the same namespace as the ReferenceGrant. ```yaml -{% include 'v1alpha2/reference-grant.yaml' %} +{% include 'experimental/v1alpha2/reference-grant.yaml' %} ``` For more information on ReferenceGrant, refer to our [detailed documentation diff --git a/site-src/v1alpha1/api-types/gateway.md b/site-src/v1alpha1/api-types/gateway.md deleted file mode 100644 index 1a8f5ef664..0000000000 --- a/site-src/v1alpha1/api-types/gateway.md +++ /dev/null @@ -1,53 +0,0 @@ -# Gateway - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - - -A `Gateway` is 1:1 with the life cycle of the configuration of infrastructure. -When a user creates a `Gateway`, some load balancing infrastructure is -provisioned or configured (see below for details) by the `GatewayClass` -controller. `Gateway` is the resource that triggers actions in this API. Other -resources in this API are configuration snippets until a Gateway has been -created to link the resources together. - -The `Gateway` spec defines the following: - -* `GatewayClassName`- Defines the name of a `GatewayClass` object used by - this Gateway. -* `Listeners`- Define the hostnames, ports, protocol, termination, TLS - settings and which routes should be associated to a listener. -* `Addresses`- Define the network addresses requested for this gateway. - -If the desired configuration specified in Gateway spec cannot be achieved, the -Gateway will be in an error state with details provided by status conditions. - -### Deployment models - -Depending on the `GatewayClass`, the creation of a `Gateway` could do any of -the following actions: - -* Use cloud APIs to create an LB instance. -* Spawn a new instance of a software LB (in this or another cluster). -* Add a configuration stanza to an already instantiated LB to handle the new - routes. -* Program the SDN to implement the configuration. -* Something else we haven’t thought of yet... - -The API does not specify which one of these actions will be taken. - -### Gateway Status - -`GatewayStatus` is used to surface the status of a `Gateway` relative to the -desired state represented in `spec`. `GatewayStatus` consists of the following: - -- `Addresses`- Lists the IP addresses that have actually been bound to the - Gateway. -- `Listeners`- Provide status for each unique listener port defined in `spec`. -- `Conditions`- Describe the current status conditions of the Gateway. - -Both `Conditions` and `Listeners.conditions` follow the conditions pattern used -elsewhere in Kubernetes. This is a list that includes a type of condition, the -status of the condition and the last time this condition changed. diff --git a/site-src/v1alpha1/api-types/gatewayclass.md b/site-src/v1alpha1/api-types/gatewayclass.md deleted file mode 100644 index 3de67c84da..0000000000 --- a/site-src/v1alpha1/api-types/gatewayclass.md +++ /dev/null @@ -1,145 +0,0 @@ -# GatewayClass - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -[GatewayClass][gatewayclass] is cluster-scoped resource defined by the -infrastructure provider. This resource represents a class of Gateways that can -be instantiated. - -[gatewayclass]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.GatewayClass - -> Note: GatewayClass serves the same function as the -> [`networking.IngressClass` resource][ingress-class-api]. - -```yaml -kind: GatewayClass -metadata: - name: cluster-gateway -spec: - controller: "acme.io/gateway-controller" -``` - -We expect that one or more `GatewayClasses` will be created by the -infrastructure provider for the user. It allows decoupling of which mechanism -(e.g. controller) implements the `Gateways` from the user. For instance, an -infrastructure provider may create two `GatewayClasses` named `internet` and -`private` to reflect `Gateways` that define Internet-facing vs private, internal -applications. - -```yaml -kind: GatewayClass -metadata: - name: internet - ... ---- -kind: GatewayClass -metadata: - name: private - ... -``` - -The user of the classes will not need to know *how* `internet` and `private` are -implemented. Instead, the user will only need to understand the resulting -properties of the class that the `Gateway` was created with. - -### GatewayClass parameters - -Providers of the `Gateway` API may need to pass parameters to their controller -as part of the class definition. This is done using the -`GatewayClass.spec.parametersRef` field: - -```yaml -# GatewayClass for Gateways that define Internet-facing applications. -kind: GatewayClass -metadata: - name: internet -spec: - controller: "acme.io/gateway-controller" - parametersRef: - group: acme.io/v1alpha1 - kind: Config - name: internet-gateway-config ---- -apiVersion: acme.io/v1alpha1 -kind: Config -metadata: - name: internet-gateway-config -spec: - ip-address-pool: internet-vips - ... -``` - -Using a Custom Resource for `GatewayClass.spec.parametersRef` is encouraged -but implementations may resort to using a ConfigMap if needed. - -### GatewayClass status - -`GatewayClasses` MUST be validated by the provider to ensure that the configured -parameters are valid. The validity of the class will be signaled to the user via -`GatewayClass.status`: - -```yaml -kind: GatewayClass -... -status: - conditions: - - type: Admitted - status: False - ... -``` - -A new `GatewayClass` will start with the `Admitted` condition set to -`False`. At this point the controller has not seen the configuration. Once the -controller has processed the configuration, the condition will be set to -`True`: - -```yaml -kind: GatewayClass -... -status: - conditions: - - type: Admitted - status: True - ... -``` - -If there is an error in the `GatewayClass.spec`, the conditions will be -non-empty and contain information about the error. - -```yaml -kind: GatewayClass -... -status: - conditions: - - type: Admitted - status: False - Reason: BadFooBar - Message: "foobar" is an FooBar. -``` - -### GatewayClass controller selection - -The `GatewayClass.spec.controller` field determines the controller implementation -responsible for managing the `GatewayClass`. The format of the field is opaque -and specific to a particular controller. The GatewayClass selected by a given -controller field depends on how various controller(s) in the cluster interpret -this field. - -It is RECOMMENDED that controller authors/deployments make their selection -unique by using a domain / path combination under their administrative control -(e.g. controller managing of all `controller`s starting with `acme.io` is the -owner of the `acme.io` domain) to avoid conflicts. - -Controller versioning can be done by encoding the version of a controller into -the path portion. An example scheme could be (similar to container URIs): - -```text -acme.io/gateway/v1 // Use version 1 -acme.io/gateway/v2 // Use version 2 -acme.io/gateway // Use the default version -``` - -[ingress-class-api]: https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class diff --git a/site-src/v1alpha1/api-types/httproute.md b/site-src/v1alpha1/api-types/httproute.md deleted file mode 100644 index a1d688ebe7..0000000000 --- a/site-src/v1alpha1/api-types/httproute.md +++ /dev/null @@ -1,249 +0,0 @@ -# HTTPRoute - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -[HTTPRoute][httproute] is a Gateway API type for specifying routing behavior -of HTTP requests from a Gateway listener to an API object, i.e. Service. - -## Spec - -The specification of an HTTPRoute consists of: - -- [Gateways][gateways]- Define which Gateways can use this HTTPRoute. -- [Hostnames][hostname] (optional)- Define a list of hostnames to use for - matching the Host header of HTTP requests. -- [TLS][tls-config] (optional)- Defines the TLS certificate to use for - Hostnames defined in this Route. -- [Rules][httprouterule]- Define a list of rules to perform actions against - matching HTTP requests. Each rule consists - of [matches][matches], [filters][filters] (optional), and [forwardTo][forwardto] - (optional) fields. - -The following illustrates an HTTPRoute that sends all traffic to one Service: -![httproute-basic-example](/v1alpha1/images/httproute-basic-example.svg) - -### Gateways - -Gateways define which Gateways can use the HTTPRoute. If unspecified, `gateways` -defaults to `allow: SameNamespace` which allows all Gateways in the HTTPRoute's -namespace. - -The following example allows Gateways from namespace "httproute-ns-example": -```yaml -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: httproute-example - namespace: httproute-ns-example -spec: - gateways: - allow: SameNamespace -``` - -Possible values for `allow` are: - -- `All`: Gateways in any namespace can use this route. -- `FromList`: Only Gateways specified in `gatewayRefs` may use this route. -- `SameNamespace` (default): Only Gateways in the same namespace may use this - route. - -If `allow` results in preventing the selection of an HTTPRoute by a Gateway, an -“Admitted: false” condition must be set on the Gateway for this Route. - -### Hostnames - -Hostnames define a list of hostnames to match against the Host header of the -HTTP request. When a match occurs, the HTTPRoute is selected to perform request -routing based on rules and filters (optional). A hostname is the fully qualified -domain name of a network host, as defined by [RFC 3986][rfc-3986]. Note the -following deviations from the “host” part of the URI as defined in the RFC: - -- IPs are not allowed. -- The : delimiter is not respected because ports are not allowed. - -Incoming requests are matched against hostnames before the HTTPRoute rules are -evaluated. If no hostname is specified, traffic is routed based on HTTPRoute -rules and filters (optional). - -The following example defines hostname "my.example.com" and allows Gateways -from the same namespace as HTTPRoute "httproute-example": -```yaml -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: httproute-example -spec: - gateways: - allow: SameNamespace - hostnames: - - my.example.com -``` - -### TLS - -TLS defines the TLS certificate used for hostnames defined in this HTTPRoute. -This configuration only takes effect if `certificate: Allow` is set for -`routeOverride` in the associated Gateway. For example: -```yaml -{% include 'v1alpha1/tls-basic.yaml' %} -``` - -`CertificateRef` refers to a Kubernetes object that contains a TLS certificate -and private key. This certificate MUST be used for TLS handshakes for the domain -this `tls` is associated with. If an entry in this list omits or specifies the -empty string for both the `group` and `kind`, the resource defaults to “secrets”. - -**Notes:** - -- HTTPRoute selection takes place after the TLS Handshake (ClientHello). Due to -this, a TLS certificate in an HTTPRoute will take precedence even if the request -has the potential to match multiple HTTPRoutes (in case multiple HTTPRoutes -share the same hostname). -- Collisions can happen if multiple HTTPRoutes define a TLS certificate for the -same hostname. In such case, the certificate in the oldest HTTPRoute is selected. - -### Rules - -Rules define semantics for matching an HTTP request based on conditions, -optionally executing additional processing steps, and optionally forwarding -the request to an API object. - -#### Matches - -Matches define conditions used for matching an HTTP request. Each match is -independent, i.e. this rule will be matched if any single match is satisfied. - -Take the following matches configuration as an example: -```yaml -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -... -matches: - - path: - value: "/foo" - headers: - values: - version: "2" - - path: - value: "/v2/foo" -``` - -For a request to match against this rule, it must satisfy EITHER of the -following conditions: - - - A path prefixed with /foo **AND** contains the header "version: 2" - - A path prefix of /v2/foo - -If no matches are specified, the default is a prefix path match on “/”, -which has the effect of matching every HTTP request. - -#### Filters (optional) - -Filters define processing steps that must be completed during the request or -response lifecycle. Filters act as an extension point to express additional -processing that may be performed in Gateway implementations. Some examples -include request or response modification, implementing authentication -strategies, rate-limiting, and traffic shaping. - -The following example adds header "my-header: foo" to HTTP requests with Host -header "my.filter.com". -```yaml -{% include 'v1alpha1/http-filter.yaml' %} -``` - -API conformance is defined based on the filter type. The effects of ordering -multiple behaviors is currently unspecified. This may change in the future -based on feedback during the alpha stage. - -Conformance levels are defined by the filter type: - - - All "core" filters MUST be supported by implementations. - - Implementers are encouraged to support "extended" filters. - - "Custom" filters have no API guarantees across implementations. - -Specifying a core filter multiple times has unspecified or custom conformance. - -#### ForwardTo (optional) - -ForwardTo defines API objects where matching requests should be sent. If -unspecified, the rule performs no forwarding. If unspecified and no filters -are specified that would result in a response being sent, a 503 error code -is returned. - -The following example forwards HTTP requests for prefix `/bar` to service -"my-service1" on port `8080` and HTTP requests for prefix `/some/thing` with -header `magic: foo` to service "my-service2" on port `8080`: -```yaml -{% include 'v1alpha1/basic-http.yaml' %} -``` - -**Note:** Forwarding to a custom resource instead of a service can be -accomplished by specifying `backendRef` instead of `serviceName`. A -`backendRef` follows the standard Kubernetes `group`, `kind` and `name` -schema. - -The following example uses the `weight` field to forward HTTP requests for -prefix `/bar` equally across service "my-trafficsplit-svc1" and service -"my-trafficsplit-svc2", i.e. traffic splitting: -```yaml -{% include 'v1alpha1/http-trafficsplit.yaml' %} -``` - -Reference the [forwardTo][forwardto] API documentation for additional details -of `weight` and other fields. - -## Status - -Status defines the observed state of HTTPRoute. - -### RouteStatus - -RouteStatus defines the observed state that is required across all route types. - -#### Gateways - -Gateways define a list of the Gateways that are associated with the HTTPRoute, -and the status of the HTTPRoute with respect to each of these Gateways. When a -Gateway selects this HTTPRoute, the controller that manages the Gateway should -add an entry to this list when the controller first sees the route and should -update the entry as appropriate when the route is modified. - -The following example indicates HTTPRoute "http-example" has been admitted by -Gateway "gw-example" in namespace "gw-example-ns": -```yaml -apiVersion: networking.x-k8s.io/v1alpha1 -kind: HTTPRoute -metadata: - name: http-example -... -status: - gateways: - - gatewayRef: - name: gw-example - namespace: gw-example-ns - conditions: - - type: Admitted - status: "True" -``` - -A maximum of 100 Gateways can be represented in this list. If this list is full, -there may be additional Gateways using this Route that are not included in the -list. - -## Merging -Multiple HTTPRoutes can be attached to a single Gateway resource. Importantly, -only one Route rule may match each request. For more information on how conflict -resolution applies to merging, refer to the [API specification][httprouterule]. - -[httproute]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRoute -[gateways]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.RouteGateways -[httprouterule]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteRule -[hostname]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.Hostname -[tls-config]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.RouteTLSConfig -[rfc-3986]: https://tools.ietf.org/html/rfc3986 -[matches]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteMatch -[filters]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteFilter -[forwardto]: /v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteForwardTo diff --git a/site-src/v1alpha1/guides/getting-started.md b/site-src/v1alpha1/guides/getting-started.md deleted file mode 100644 index bb939c9303..0000000000 --- a/site-src/v1alpha1/guides/getting-started.md +++ /dev/null @@ -1,58 +0,0 @@ -# Getting started with Gateway APIs - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -**1.** **[Install a Gateway controller](#installing-a-gateway-controller)** - _OR_ **[install the Gateway API CRDs manually](#installing-gateway-api-crds-manually)** - -_THEN_ - -**2.** **Try out one of the available guides:** - -- [Simple Gateway](/v1alpha1/guides/simple-gateway) (a good one to start out with) -- [HTTP routing](/v1alpha1/guides/http-routing) -- [HTTP traffic splitting](/v1alpha1/guides/traffic-splitting) -- [Routing across Namespaces](/v1alpha1/guides/multiple-ns) -- [Configuring TLS](/v1alpha1/guides/tls) -- [TCP routing](/v1alpha1/guides/tcp) - -## Installing a Gateway controller - -There are [multiple projects](/implementations) that support the Gateway -API. By installing a Gateway controller in your Kubernetes cluster, you can -try out the guides above. This will demonstrate that the desired routing -configuration is actually being implemented by your Gateway resources (and the -network infrastructure that your Gateway resources represent). Note that many -of the Gateway controller setups will install and remove the Gateway API CRDs -for you. - -## Installing Gateway API CRDs manually - -The following command will install the Gateway API CRDs. This includes the -GatewayClass, Gateway, HTTPRoute, TCPRoute, and more. Note that a running -Gateway controller in your Kubernetes cluster is required to actually act on -these resources. Installing the CRDs will just allow you to see and apply the -resources, though they won't do anything. - -``` -kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.3.0" \ -| kubectl apply -f - -``` - -After you're done, you can clean up after yourself by uninstalling the -Gateway API CRDs. The following command will remove all GatewayClass, Gateway, -and associated resources in your cluster. If these resources are in-use or -if they were installed by a Gateway controller, then do not uninstall them. -This will uninstall the Gateway API CRDs for the entire cluster. Do not do -this if they might be in-use by someone else as this will break anything using -these resources. - - -``` -kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.3.0" \ -| kubectl delete -f - -``` - diff --git a/site-src/v1alpha1/guides/http-routing.md b/site-src/v1alpha1/guides/http-routing.md deleted file mode 100644 index 2c1f9a2d73..0000000000 --- a/site-src/v1alpha1/guides/http-routing.md +++ /dev/null @@ -1,66 +0,0 @@ -# HTTP routing - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -The [HTTPRoute resource](/v1alpha1/api-types/httproute) allows you to match on HTTP -traffic and direct it to Kubernetes backends. This guide shows how the HTTPRoute -matches traffic on host, header, and path fields and forwards it to different -Kubernetes Services. - -The following diagram describes a required traffic flow across three different -Services: - -- Traffic to `foo.example.com/login` is forwarded to `foo-svc` -- Traffic to `bar.example.com/*` with a `env: canary` header is forwarded -to `bar-svc-canary` -- Traffic to `bar.example.com/*` without the header is forwarded to `bar-svc` - -![HTTP Routing](/v1alpha1/images/http-routing.png) - -The dotted lines show the Gateway resources deployed to configure this routing -behavior. There are two HTTPRoute resources that create routing rules on the -same `prod-web` Gateway. This illustrates how more than one Route can bind to a -Gateway which allows Routes to merge on a Gateway as long as they don't -conflict. For more information on Route merging, refer to the [HTTPRoute -documentation](/v1alpha1/api-types/httproute#merging). - -The following `prod-web` Gateway is defined from the `acme-lb` GatewayClass. -`prod-web` listens for HTTP traffic on port 80 and will bind to all Routes in -the same Namespace that have the matching `gateway: prod-web-gw` label. -Route labels and Gateway label selectors allow Routes and Gateways to be -bound to each other by their respective owners. - -```yaml -{% include 'v1alpha1/http-routing/gateway.yaml' %} -``` - -An HTTPRoute can match against a [single set of -hostnames](https://gateway-api.sigs.k8s.io/v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteSpec). -These hostnames are matched before any other matching within the HTTPRoute takes -place. Since `foo.example.com` and `bar.example.com` are separate hosts with -different routing requirements, each is deployed as its own HTTPRoute - -`foo-route` and `bar-route`. - -The following `foo-route` will match any traffic for `foo.example.com` and apply -its routing rules to forward the traffic to the correct backend. Since there is -only one match specified, only `foo.example.com/login/*` traffic will be -forwarded. Traffic to any other paths that do not begin with `/login` will not -be matched by this Route. - -```yaml -{% include 'v1alpha1/http-routing/foo-httproute.yaml' %} -``` - -Similarly, the `bar-route` HTTPRoute matches traffic for `bar.example.com`. All -traffic for this hostname will be evaluated against the routing rules. The most -specific match will take precedence which means that any traffic with the `env: -canary` header will be forwarded to `bar-svc-canary` and if the header is -missing or not `canary` then it'll be forwarded to `bar-svc`. - -```yaml -{% include 'v1alpha1/http-routing/bar-httproute.yaml' %} -``` - diff --git a/site-src/v1alpha1/guides/multiple-ns.md b/site-src/v1alpha1/guides/multiple-ns.md deleted file mode 100644 index b0bb14c571..0000000000 --- a/site-src/v1alpha1/guides/multiple-ns.md +++ /dev/null @@ -1,163 +0,0 @@ -# Cross-Namespace routing - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -The Gateway API has core support for cross Namespace routing. This is useful -when more than one user or team is sharing the underlying networking infrastructure, -yet control and configuration must be segmented to minimize access and fault -domains. Gateways and Routes can be deployed into different Namespaces and bind -with each other across Namespace boundaries. This allows differing user access -and roles (RBAC) to be applied to separate Namespaces, effectively controlling -who has access to different parts of the cluster-wide routing configuration. The -ability for Routes to bind with Gateways across Namespace boundaries is goverend -by [_Route binding_](#cross-namespace-route-binding), which -is explored in this guide. The guide shows how two independent teams can safely -share the same Gateway from different Namespaces. - -In this guide there are two independent teams, _store_ and _site_, operating -in the same Kubernetes cluster in the `store-ns` and `site-ns` Namespaces. These are -their requirements: - -- The site team has two applications, _home_ and _login_, that are running -behind `foo.example.com`. They want to isolate access and configuration across -their apps as much as possible to minimize access and failure domains. -They use separate HTTPRoutes for each app, to isolate app routing configurations -such as canary rollouts. but share the same load balancer -IP, port, domain, and TLS certificate. -- The store team has a single Service called _store_ that they have deployed -in the `store-ns` Namespace. -- The Foobar Corporation operates behind the `foo.example.com` domain so they -would like to host all applications on the same Gateway resource. This is -controlled by a central infrastructure team, operating in the `infra-ns` Namespace. -- Lastly, the security team controls the certificate for `foo.example.com`. -By managing this certificate through the single shared Gateway they are able -to centrally control security without directly involving application teams. - -The logical relationship between the Gateway API resources looks like this: - -![Cross-Namespace routing](../images/cross-namespace-routing.svg) - -## Cross-namespace Route binding - -[Route binding](/concepts/api-overview/#route-binding) is an important concept -that dictates how Routes and Gateways select each other to apply routing -configuration to a Gateway. It is especially relevant when there are multiple -Gateways and multiple Namespaces in a cluster. Gateway and Route binding is -bidirectional - a binding can only exist if the Gateway owner and Route owner -owner both agree to the relationship. This bi-directional relationship exists -for two reasons: - -- Route owners don't want to overexpose their applications and don't want -their apps to be accessible through paths they are not aware of. -- Gateway owners don't want apps using certain Gateways they should not be -using. An internal application shouldn't be exposed through a public Gateway -for example. - - -As a result, Gateways and Routes have independent control to determine which -resources they permit binding with. It is a handshake between the infra owners -and the application owners that allows them to be independent actors. -Route-owners can specify that they will bind with all Gateways in the cluster, -or only Gateways from a specific Namespace, with a specific label selector, or -an individual Gateway. Similarly, Gateways provide the same level of control. -This allows a cluster to be more self-governed, which requires less central -administration to ensure that Routes are not over-exposed. - -## Resource Deployment - -The infrastructure team deploys the `shared-gateway` Gateway into the `infra-ns` -Namespace. - -```yaml -{% include 'v1alpha1/cross-namespace-routing/gateway.yaml' %} -``` - -A few notes about this Gateway: - -- It is matching for the `foo.example.com` domain. This is configured on the -Gateway so that each HTTPRoute does not also have to configure hostname matching, -since they are all using the same domain. This also allows these HTTPRoute -manifests to be reused across production and dev environments where the dev -environment might be hosted at `foo.dev.corp.example.com`. -- The Gateway is configured for HTTPS and references the `foo-example-com` Secret. -This allows the certificate to be managed centrally for all applications which -are using this Gateway. -- It allows any Route in the cluster to use this Gateway because `namespaces.from = All`. -This is a permissive method of Route selection since the Routes are given -full control to select this Gateway. There are more restrictive forms of Route -selection that allow selection on a per-Namespace basis, detailed -in [Route binding](/concepts/api-overview/#route-binding). The following block -specifies how this Gateway allows HTTPRoutes from all Namespaces in the -cluster to bind to it: - -```yaml - routes: - kind: HTTPRoute - namespaces: - from: "All" -``` - -Meanwhile, the store team deploys their route for the `store` Service in the -`store-ns` Namespace: - -```yaml -{% include 'v1alpha1/cross-namespace-routing/store-route.yaml' %} -``` - -This Route has straightforward routing logic as it just matches for -`/store` traffic which it sends to the `store` Service. The following snippet -of the [`gateways` field](/v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.RouteGateways) -controls which Gateways this Route can bind to: - -```yaml - gateways: - allow: FromList - gatewayRefs: - - name: shared-gateway - namespace: infra -``` - -`gateways.allow` can be configured for Gateways in the same Namespace as the -Route (the default), all Gateways, or a list of specific Gateways. In this -example the store and site teams decide to reference a specific Gateway. This is -the least permissive choice which ensures that other Gateways in the cluster -(perhaps created in the future at some point) will not bind with these Routes. -If cluster administrators have full control over how Gateways are deployed in a -cluster then a more permissive binding option could be configured on Routes. The -less permissive the Gateway selection is, the less that application owners need -to know about which Gateways are deployed. - -The site team now deploys Routes for their applications. They deploy two -HTTPRoutes into the `site-ns` Namespace: - -- The `home` HTTPRoute acts as a default routing rule, matching for all traffic -to `foo.example.com/*` not matched by an existing routing rule and sending it to -the `home` Service. -- The `login` HTTPRoute routes traffic for `foo.example.com/login` to -`service/login-v1` and `service/login-v2`. It uses weights to granularly -control traffic distribution between them. - -Both of these Routes use the same Gateway binding configuration which specifies -`gateway/shared-gateway` in the `infra-ns` Namespace as the only Gateway that these -Routes can bind with. - -```yaml -{% include 'v1alpha1/cross-namespace-routing/site-route.yaml' %} -``` - -After these three Routes are deployed, they will all be bound to the -`shared-gateway` Gateway. The Gateway merges its bound Routes into a single flat -list of routing rules. [Routing -precedence](/v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteRule) -between the flat list of routing rules is determined by most specific match and -conflicts are handled according to [conflict -resolution](/concepts/guidelines#conflicts). This provides predictable and -deterministic merging of routing rules between independent users. - -Thanks to cross-Namespace routing, the Foobar Corporation can distribute -ownership of their infrastructure more evenly, while still retaining centralized -control. This gives them the best of both worlds, all delivered through -declarative and open source APIs. \ No newline at end of file diff --git a/site-src/v1alpha1/guides/simple-gateway.md b/site-src/v1alpha1/guides/simple-gateway.md deleted file mode 100644 index 15551e49dc..0000000000 --- a/site-src/v1alpha1/guides/simple-gateway.md +++ /dev/null @@ -1,46 +0,0 @@ -# Deploying a simple Gateway - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -The simplest possible deployment is a Gateway and Route resource which are -deployed together by the same owner. This represents a similar kind of model -used for Ingress. In this guide, a Gateway and HTTPRoute are deployed which -match all HTTP traffic and directs it to a single Service named `foo-svc`. - -![Simple Gateway](/v1alpha1/images/single-service-gateway.png) - -```yaml -{% include 'v1alpha1/simple-gateway/gateway.yaml' %} -``` - -The Gateway represents the instantation of a logical load balancer. It's -templated from a hypothetical `acme-lb` GatewayClass. The Gateway listens for -HTTP traffic on port 80. This particular GatewayClass automatically assigns an -IP address which will be shown in the `Gateway.status` after it has been -deployed. - -Gateways bind Routes to themselves via label selection (similar to how Services -label select across Pod labels). In this example, the `prod-web` Gateway will -bind any HTTPRoute resources which have the `gateway: prod-web-gw` label. The -label can be any arbitrary label, but using one that identifies the name or -capabilities of the Gateway is useful to Route owners and makes the relationship -more explicit. More complex bi-directional matching and permissions are possible -and explained in other guides. - -The following HTTPRoute defines how traffic from the Gateway listener is routed -to backends. Because there are no host routes or paths specified, this HTTPRoute -will match all HTTP traffic that arrives at port 80 of the load balancer and -send it to the `foo-svc` Pods. - -```yaml -{% include 'v1alpha1/simple-gateway/httproute.yaml' %} -``` - -While Route resources are often used to filter traffic to many different -backends (potentially with different owners), this demonstrates the simplest -possible route with a single Service backend. This example shows how a service -owner can deploy both the Gateway and the HTTPRoute for their usage alone, -giving them more control and autonomy for how the service is exposed. diff --git a/site-src/v1alpha1/guides/tcp.md b/site-src/v1alpha1/guides/tcp.md deleted file mode 100644 index a1a5543c54..0000000000 --- a/site-src/v1alpha1/guides/tcp.md +++ /dev/null @@ -1,31 +0,0 @@ -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -Gateway API is designed to work with multiple protocols. -[TCPRoute](/v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.TCPRoute) is one such route which -allows for managing TCP traffic. - -In this example, we have one Gateway resource and two TCPRoute resources that -distribute the traffic with the following rules: - -- All TCP streams on port 8080 of the Gateway are forwarded to port 6000 of - `my-foo-service` Kubernetes Service. -- All TCP streams on port 8090 of the Gateway are forwarded to port 6000 of - `my-bar-service` Kubernetes Service. - -Please note the following: - -- The `protocol` of listeners on the Gateway is `TCP`. -- Each listener selects exactly one TCPRoute. This is important since the routing - decision is performed based on destination port only. If more metadata is used - for routing decisions, then one may associate multiple TCPRoutes to a single - Gateway listener. Implementations can support such use-cases by adding a custom - resource to specify advanced routing properties and then referencing it in - `spec.rules[].matches[].extensionRef`. Conflicts due to routing colisions should - be resolved as per the [conflict resolution](/concepts/guidelines#conflicts) guidelines. - -``` -{% include 'v1alpha1/basic-tcp.yaml' %} -``` diff --git a/site-src/v1alpha1/guides/tls.md b/site-src/v1alpha1/guides/tls.md deleted file mode 100644 index d0305d3023..0000000000 --- a/site-src/v1alpha1/guides/tls.md +++ /dev/null @@ -1,165 +0,0 @@ -# TLS details - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -Gateway API allow for a variety of ways to configure TLS. This document lays -out various TLS settings and gives general guidelines on how to use them -effectively. - -## Client/Server and TLS - -![overview](/v1alpha1/images/tls-overview.svg) - -For Gateways, there are two connections involved: - -- **downstream**: This is the connection between the client and the Gateway. -- **upstream**: This is the connection between the Gateway and backend resources - specified by routes. These backend resources will usually be Services. - -With Gateway API, TLS configuration of downstream and -upstream connections is managed independently. - -Depending on the Listener Protocol, different TLS modes and Route types are supported. - -Listener Protocol | TLS Mode | Route Type Supported ---- | --- | --- -TLS | Passthrough | TLSRoute -TLS | Terminate | TCPRoute -HTTPS | Terminate | HTTPRoute - -Please note that in case of `Passthrough` TLS mode, no TLS settings take -effect as the TLS session from the client is NOT terminated at the Gateway. -The rest of the document assumes that TLS is being terminated at the Gateway, -which is the default setting. - -## Downstream TLS - -Downstream TLS settings are configured using listeners at the Gateway level. - -### Listeners and TLS - -Listeners expose the TLS setting on a per domain or sub-domain basis. -TLS settings of a listener are applied to all domains that satisfy the -`hostname` criteria. - -In the following example, the Gateway serves the TLS certificate -defined in the `default-cert` Secret resource for all requests. -Although, the example refers to HTTPS protocol, one can also use the same -feature for TLS-only protocol along with TLSRoutes. - -```yaml -listeners: -- protocol: HTTPS # Other possible value is `TLS` - port: 443 - tls: - mode: Terminate # If protocol is `TLS`, `Passthrough` is a possible mode - certificateRef: - kind: Secret - group: core - name: default-cert - routeOverride: - certificate: Deny -``` - -If `hostname.match` is set to `Exact`, then the TLS settings apply to only the -specific hostname that is set in `hostname.name`. - -Specifying `tls.routeOverride.certificate: Deny` is recommended because it -centralizes TLS configuration within the Gateway specification and should -suffice for the majority of use-cases. Please take a look at the examples below -for various alternatives. - -### Routes and TLS - -If `listeners[].tls.routeOverride.certificate` is set to `Allow`, TLS certificates -can be configured on routes that are bound to the Gateway. This feature is -primarily meant for a cluster with a self-service model where Application developers -bring their own TLS certificates. This feature also mirrors the behavior of -TLS as defined in the Ingress v1 resource. One should use this feature only -when the Cluster Operator wishes to delegate TLS configuration to the Application Developer. -With this feature, the certificate defined in the route overrides any certificate defined in -the Gateway. - -When using this feature, please note that the TLS certificate to serve is chosen -before an HTTPRoute is selected. This is because the TLS handshake is completed -before an HTTP request is sent from the client. - -[TLS Certificate in Route](#tls-certificate-in-route) provides an example -of how this feature can be used. - -Also, as mentioned above, the Route Kind (`HTTPRoute`, `TLSRoute`, `TCPRoute`) -is dependent on the protocol on the listener level. Listeners with `HTTPS` or -`HTTP` protocols can use `HTTPRoute` as the TLS Termination is done at the -listener level and thus, only HTTP information is used for routing. - -Listeners with the `TLS` protocol must use `TLSRoute` when the mode is set to `Passthrough` and `TCPRoute` when the mode is `Terminate`. - -Listeners with the TCP protocol must use `TCPRoute` for plain TCP Routing. - -### Examples - -#### TLS in listener - -In this example, the Gateway is configured to serve the `foo.example.com` and -`bar.example.com` domains. The certificate for these domains is specified -in the Gateway. - -``` -{% include 'v1alpha1/tls-basic.yaml' %} -``` - -#### Wildcard TLS listeners - -In this example, the Gateway is configured with a wildcard certificate for -`*.example.com` and a different certificate for `foo.example.com`. -Since a specific match takes priority, the Gateway will serve -`foo-example-com-cert` for requests to `foo.example.com` and -`wildcard-example-com-cert` for all other requests. - -```yaml -{% include 'v1alpha1/wildcard-tls-gateway.yaml' %} -``` - -#### TLS Certificate in Route - -In this example, the Gateway is configured with a default certificate that will be -served for all hostnames. In addition, `tls.routeOverride.certificate` is set to -`Allow`, meaning routes can specify TLS certificates for any domains. Next, -there are two HTTPRoute resources which specify certificates for -`foo.example.com` and `bar.example.com`. - -```yaml -{% include 'v1alpha1/tls-cert-in-route.yaml' %} -``` - -## Upstream TLS - -Upstream TLS configuration applies to the connection between the Gateway -and Service. - -There is only one way to configure upstream TLS: using the `BackendPolicy` -resource. - -Please note that the TLS configuration is related to the Service or backend -resource and not related to a specific route resource. - -### Example - -The following example shows how upstream TLS can be configured. We have -omitted downstream TLS configuration for simplicity. As noted before, it -doesn't matter how downstream TLS is configured for the specific listener or -route. - -```yaml -{% include 'v1alpha1/upstream-tls.yaml' %} -``` - -## Extensions - -Both upstream and downstream TLS configs provide an `options` map to add -additional TLS settings for implementation-specific features. -Some examples of features that could go in here would be TLS version restrictions, -or ciphers to use. diff --git a/site-src/v1alpha1/guides/traffic-splitting.md b/site-src/v1alpha1/guides/traffic-splitting.md deleted file mode 100644 index b2b28c8072..0000000000 --- a/site-src/v1alpha1/guides/traffic-splitting.md +++ /dev/null @@ -1,92 +0,0 @@ -# HTTP traffic splitting - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -The [HTTPRoute resource](/v1alpha1/api-types/httproute) allows you to specify weights to shift -traffic between different backends. This is useful for splitting traffic during -rollouts, canarying changes, or for emergencies. The HTTPRoute -`spec.rules.forwardTo` accepts a list of backends that a route rule will send -traffic to. The relative weights of these backends define the split of traffic -between them. The following YAML snippet shows how two Services are listed as -backends for a single route rule. This route rule will split traffic 90% to -`foo-v1` and 10% to `foo-v2`. - -![Traffic splitting](/v1alpha1/images/simple-split.png) - -```yaml -{% include 'v1alpha1/traffic-splitting/simple-split.yaml' %} -``` - -`weight` indicates a proportional split of traffic (rather than percentage) -and so the sum of all the weights within a single route rule is the -denominator for all of the backends. `weight` is an optional parameter and if -not specified, defaults to 1. If only a single backend is specified for a -route rule it implicitly recieves 100% of the traffic, no matter what (if any) -weight is specified. - -## Guide - -This guide shows the deployment of two versions of a Service. Traffic splitting -is used to manage the gradual splitting of traffic from v1 to v2. - -This example assumes that the following Gateway is deployed: - -```yaml -{% include 'v1alpha1/simple-gateway/gateway.yaml' %} -``` - -## Canary traffic rollout - -At first, there may only be a single version of a Service that serves -production user traffic for `foo.example.com`. The following HTTPRoute has no -`weight` specified for `foo-v1` or `foo-v2` so they will implicitly -recieve 100% of the traffic matched by each of their route rules. A canary -route rule is used (matching the header `traffic=test`) to send synthetic test -traffic before splitting any production user traffic to `foo-v2`. [Routing -precedence](/v1alpha1/references/spec/#networking.x-k8s.io/v1alpha1.HTTPRouteRule) ensures that -all traffic with the matching host and header (the most specific match) will -be sent to `foo-v2`. - -![Traffic splitting](/v1alpha1/images/traffic-splitting-1.png) - - -```yaml -{% include 'v1alpha1/traffic-splitting/traffic-split-1.yaml' %} -``` - -## Blue-green traffic rollout - -After internal testing has validated succesful responses from `foo-v2`, -it's desirable to shift a small percentage of the traffic to the new Service -for gradual and more realistic testing. The HTTPRoute below adds `foo-v2` -as a backend along with weights. The weights add up to a total of 100 so -`foo-v1` recieves 90/100=90% of the traffic and `foo-v2` recieves -10/100=10% of the traffic. - -![Traffic splitting](/v1alpha1/images/traffic-splitting-2.png) - - -```yaml -{% include 'v1alpha1/traffic-splitting/traffic-split-2.yaml' %} -``` - -## Completing the rollout - -Finally, if all signals are positive, it is time to fully shift traffic to -`foo-v2` and complete the rollout. The weight for `foo-v1` is set to -`0` so that it is configured to accept zero traffic. - -![Traffic splitting](/v1alpha1/images/traffic-splitting-3.png) - - -```yaml -{% include 'v1alpha1/traffic-splitting/traffic-split-3.yaml' %} -``` - -At this point 100% of the traffic is being routed to `foo-v2` and the -rollout is complete. If for any reason `foo-v2` experiences errors, the -weights can be updated to quickly shift traffic back to `foo-v1`. Once -the rollout is deemed final, v1 can be fully decommissioned. diff --git a/site-src/v1alpha1/images/api-model.png b/site-src/v1alpha1/images/api-model.png deleted file mode 100644 index 1a01ac5f6c..0000000000 Binary files a/site-src/v1alpha1/images/api-model.png and /dev/null differ diff --git a/site-src/v1alpha1/images/cross-namespace-routing.svg b/site-src/v1alpha1/images/cross-namespace-routing.svg deleted file mode 100644 index 3bc429e3eb..0000000000 --- a/site-src/v1alpha1/images/cross-namespace-routing.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/site-src/v1alpha1/images/gateway-roles.png b/site-src/v1alpha1/images/gateway-roles.png deleted file mode 100644 index 4848bfa20f..0000000000 Binary files a/site-src/v1alpha1/images/gateway-roles.png and /dev/null differ diff --git a/site-src/v1alpha1/images/gateway-route-binding.png b/site-src/v1alpha1/images/gateway-route-binding.png deleted file mode 100644 index a62baf7324..0000000000 Binary files a/site-src/v1alpha1/images/gateway-route-binding.png and /dev/null differ diff --git a/site-src/v1alpha1/images/http-routing.png b/site-src/v1alpha1/images/http-routing.png deleted file mode 100644 index 3b9e417bc6..0000000000 Binary files a/site-src/v1alpha1/images/http-routing.png and /dev/null differ diff --git a/site-src/v1alpha1/images/httproute-basic-example.svg b/site-src/v1alpha1/images/httproute-basic-example.svg deleted file mode 100644 index a02852868b..0000000000 --- a/site-src/v1alpha1/images/httproute-basic-example.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/site-src/v1alpha1/images/policy/hierarchy.png b/site-src/v1alpha1/images/policy/hierarchy.png deleted file mode 100644 index 7b5f64d47d..0000000000 Binary files a/site-src/v1alpha1/images/policy/hierarchy.png and /dev/null differ diff --git a/site-src/v1alpha1/images/policy/ingress-attachment.png b/site-src/v1alpha1/images/policy/ingress-attachment.png deleted file mode 100644 index dbd4035aab..0000000000 Binary files a/site-src/v1alpha1/images/policy/ingress-attachment.png and /dev/null differ diff --git a/site-src/v1alpha1/images/policy/ingress-complex.png b/site-src/v1alpha1/images/policy/ingress-complex.png deleted file mode 100644 index 28d5ab0f82..0000000000 Binary files a/site-src/v1alpha1/images/policy/ingress-complex.png and /dev/null differ diff --git a/site-src/v1alpha1/images/policy/ingress-simple.png b/site-src/v1alpha1/images/policy/ingress-simple.png deleted file mode 100644 index 88f3e0910b..0000000000 Binary files a/site-src/v1alpha1/images/policy/ingress-simple.png and /dev/null differ diff --git a/site-src/v1alpha1/images/policy/mesh-complex.png b/site-src/v1alpha1/images/policy/mesh-complex.png deleted file mode 100644 index c1a12fd36b..0000000000 Binary files a/site-src/v1alpha1/images/policy/mesh-complex.png and /dev/null differ diff --git a/site-src/v1alpha1/images/policy/mesh-simple.png b/site-src/v1alpha1/images/policy/mesh-simple.png deleted file mode 100644 index 5ab39b567a..0000000000 Binary files a/site-src/v1alpha1/images/policy/mesh-simple.png and /dev/null differ diff --git a/site-src/v1alpha1/images/schema-uml.svg b/site-src/v1alpha1/images/schema-uml.svg deleted file mode 100644 index 11e1e29519..0000000000 --- a/site-src/v1alpha1/images/schema-uml.svg +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/site-src/v1alpha1/images/simple-split.png b/site-src/v1alpha1/images/simple-split.png deleted file mode 100644 index dba5ac4963..0000000000 Binary files a/site-src/v1alpha1/images/simple-split.png and /dev/null differ diff --git a/site-src/v1alpha1/images/single-service-gateway.png b/site-src/v1alpha1/images/single-service-gateway.png deleted file mode 100644 index b0095d117c..0000000000 Binary files a/site-src/v1alpha1/images/single-service-gateway.png and /dev/null differ diff --git a/site-src/v1alpha1/images/tls-overview.svg b/site-src/v1alpha1/images/tls-overview.svg deleted file mode 100644 index 8b9e286155..0000000000 --- a/site-src/v1alpha1/images/tls-overview.svg +++ /dev/null @@ -1,3 +0,0 @@ - - -
Gateway
Gateway
Client
Client
Service
Service
Downstream
Downst...
Upstream
Upstre...
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/site-src/v1alpha1/images/traffic-splitting-1.png b/site-src/v1alpha1/images/traffic-splitting-1.png deleted file mode 100644 index 0875d72b5f..0000000000 Binary files a/site-src/v1alpha1/images/traffic-splitting-1.png and /dev/null differ diff --git a/site-src/v1alpha1/images/traffic-splitting-2.png b/site-src/v1alpha1/images/traffic-splitting-2.png deleted file mode 100644 index aefb6ca39e..0000000000 Binary files a/site-src/v1alpha1/images/traffic-splitting-2.png and /dev/null differ diff --git a/site-src/v1alpha1/images/traffic-splitting-3.png b/site-src/v1alpha1/images/traffic-splitting-3.png deleted file mode 100644 index 22501cde1a..0000000000 Binary files a/site-src/v1alpha1/images/traffic-splitting-3.png and /dev/null differ diff --git a/site-src/v1alpha1/references/spec.md b/site-src/v1alpha1/references/spec.md deleted file mode 100644 index ac7043190b..0000000000 --- a/site-src/v1alpha1/references/spec.md +++ /dev/null @@ -1,8 +0,0 @@ -# API Specification - -!!! warning "v1alpha1 has been deprecated" - - Please upgrade to v1alpha2, v1alpha1 will be removed from Gateway API - in an upcoming release. - -REPLACE_WITH_GENERATED_CONTENT diff --git a/site-src/v1alpha2/guides/http-redirect-rewrite.md b/site-src/v1alpha2/guides/http-redirect-rewrite.md index b8fd45a370..335e723654 100644 --- a/site-src/v1alpha2/guides/http-redirect-rewrite.md +++ b/site-src/v1alpha2/guides/http-redirect-rewrite.md @@ -21,7 +21,7 @@ example, to issue a permanent redirect (301) from HTTP to HTTPS, configure `requestRedirect.statusCode=301` and `requestRedirect.scheme="https"`: ```yaml -{% include 'experimental/http-redirect-rewrite/httproute-redirect-https.yaml' %} +{% include 'experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-https.yaml' %} ``` Redirects change configured URL components to match the redirect configuration @@ -44,7 +44,7 @@ prefixes. For example, the HTTPRoute below will issue a 302 redirect to all `redirect.example` requests whose path begins with `/cayenne` to `/paprika`: ```yaml -{% include 'experimental/http-redirect-rewrite/httproute-redirect-full.yaml' %} +{% include 'experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-full.yaml' %} ``` Both requests to @@ -56,7 +56,7 @@ The other path redirect type, `ReplacePrefixMatch`, replaces only the path portion matching `matches.path.value`. Changing the filter in the above to: ```yaml -{% include 'experimental/http-redirect-rewrite/httproute-redirect-prefix.yaml' %} +{% include 'experimental/v1alpha2/http-redirect-rewrite/httproute-redirect-prefix.yaml' %} ``` will result in redirects with `location: @@ -81,7 +81,7 @@ following HTTPRoute will accept a request for rewrite.example`. ```yaml -{% include 'experimental/http-redirect-rewrite/httproute-rewrite.yaml' %} +{% include 'experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite.yaml' %} ``` Path rewrites also make use of HTTP Path Modifiers. The HTTPRoute below @@ -91,5 +91,5 @@ Instead using `type: ReplacePrefixMatch` and `replacePrefixMatch: /fennel` will request `https://elsewhere.example/fennel/smidgen` upstream. ```yaml -{% include 'experimental/http-redirect-rewrite/httproute-rewrite.yaml' %} +{% include 'experimental/v1alpha2/http-redirect-rewrite/httproute-rewrite.yaml' %} ``` diff --git a/site-src/v1alpha2/guides/tcp.md b/site-src/v1alpha2/guides/tcp.md index 858df72b0f..25732d4812 100644 --- a/site-src/v1alpha2/guides/tcp.md +++ b/site-src/v1alpha2/guides/tcp.md @@ -14,7 +14,7 @@ in order to route them to two separate backend `TCPRoutes`, note that the `protocol` set for the `listeners` on the `Gateway` is `TCP`: ``` -{% include 'v1alpha2/basic-tcp.yaml' %} +{% include 'experimental/v1alpha2/basic-tcp.yaml' %} ``` In the above example we separate the traffic for the two separate backend TCP diff --git a/site-src/v1alpha2/guides/tls.md b/site-src/v1alpha2/guides/tls.md index b57deaf421..0daac07a2f 100644 --- a/site-src/v1alpha2/guides/tls.md +++ b/site-src/v1alpha2/guides/tls.md @@ -92,7 +92,7 @@ target namespace. Without that ReferenceGrant, the cross-namespace reference would be invalid. ```yaml -{% include 'v1alpha2/tls-cert-cross-namespace.yaml' %} +{% include 'experimental/v1alpha2/tls-cert-cross-namespace.yaml' %} ``` ## Extensions