From e6df69b47f9c51c7bf8fd3bc3bc89ab72ea83aea Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Thu, 22 Jul 2021 16:03:58 -0700 Subject: [PATCH] Removing BackendPolicy This is part of the GEP #713 implementation. --- apis/v1alpha2/backendpolicy_types.go | 150 ------------ apis/v1alpha2/httproute_types.go | 10 +- apis/v1alpha2/shared_types.go | 27 +-- apis/v1alpha2/zz_generated.deepcopy.go | 155 ------------ apis/v1alpha2/zz_generated.register.go | 2 - ...way.networking.k8s.io_backendpolicies.yaml | 226 ------------------ .../gateway.networking.k8s.io_httproutes.yaml | 10 +- .../gateway.networking.k8s.io_tcproutes.yaml | 12 +- .../gateway.networking.k8s.io_tlsroutes.yaml | 12 +- .../gateway.networking.k8s.io_udproutes.yaml | 12 +- .../typed/apis/v1alpha2/apis_client.go | 5 - .../typed/apis/v1alpha2/backendpolicy.go | 195 --------------- .../apis/v1alpha2/fake/fake_apis_client.go | 4 - .../apis/v1alpha2/fake/fake_backendpolicy.go | 142 ----------- .../apis/v1alpha2/generated_expansion.go | 2 - .../apis/v1alpha2/backendpolicy.go | 90 ------- .../apis/v1alpha2/interface.go | 7 - .../gateway/externalversions/generic.go | 2 - .../gateway/apis/v1alpha2/backendpolicy.go | 99 -------- .../apis/v1alpha2/expansion_generated.go | 8 - site-src/v1alpha2/concepts/api-overview.md | 14 -- site-src/v1alpha2/faq.md | 6 - site-src/v1alpha2/guides/tls.md | 28 +-- 23 files changed, 14 insertions(+), 1204 deletions(-) delete mode 100644 apis/v1alpha2/backendpolicy_types.go delete mode 100644 config/crd/bases/gateway.networking.k8s.io_backendpolicies.yaml delete mode 100644 pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/backendpolicy.go delete mode 100644 pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_backendpolicy.go delete mode 100644 pkg/client/informers/gateway/externalversions/apis/v1alpha2/backendpolicy.go delete mode 100644 pkg/client/listers/gateway/apis/v1alpha2/backendpolicy.go diff --git a/apis/v1alpha2/backendpolicy_types.go b/apis/v1alpha2/backendpolicy_types.go deleted file mode 100644 index 7f439e64dd..0000000000 --- a/apis/v1alpha2/backendpolicy_types.go +++ /dev/null @@ -1,150 +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 v1alpha2 - -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:storageversion -// +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"` - - // 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/v1alpha2/httproute_types.go b/apis/v1alpha2/httproute_types.go index aa58d50ff2..97e5d43cea 100644 --- a/apis/v1alpha2/httproute_types.go +++ b/apis/v1alpha2/httproute_types.go @@ -743,14 +743,8 @@ type HTTPRouteForwardTo struct { // 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 `gateway.networking.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. + // The protocol to use should be specified with the AppProtocol field on + // Service resources. // // Support: Core // diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 1215300349..2fc3742048 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -32,23 +32,6 @@ const ( 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: - // - // - `gateway.networking.k8s.io/app-protocol: https` - // - `gateway.networking.k8s.io/app-protocol: tls` - AnnotationAppProtocol = "gateway.networking.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 @@ -106,14 +89,8 @@ type RouteForwardTo struct { // 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 `gateway.networking.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. + // The protocol to use should be specified with the AppProtocol field on + // Service resources. // // Support: Core // diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index eb0902b626..80cb515c9b 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -25,161 +25,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendPolicy) DeepCopyInto(out *BackendPolicy) { - *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 - } - 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)) - 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 { - if in == nil { - return nil - } - out := new(BackendPolicyList) - 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) { - *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.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(BackendTLSConfig) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicySpec. -func (in *BackendPolicySpec) DeepCopy() *BackendPolicySpec { - if in == nil { - return nil - } - 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]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendPolicyStatus. -func (in *BackendPolicyStatus) DeepCopy() *BackendPolicyStatus { - if in == nil { - return nil - } - out := new(BackendPolicyStatus) - in.DeepCopyInto(out) - return out -} - -// 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) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendRef. -func (in *BackendRef) DeepCopy() *BackendRef { - if in == nil { - return nil - } - out := new(BackendRef) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendTLSConfig) DeepCopyInto(out *BackendTLSConfig) { - *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 - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSConfig. -func (in *BackendTLSConfig) DeepCopy() *BackendTLSConfig { - if in == nil { - return nil - } - out := new(BackendTLSConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Gateway) DeepCopyInto(out *Gateway) { *out = *in diff --git a/apis/v1alpha2/zz_generated.register.go b/apis/v1alpha2/zz_generated.register.go index b51db2811e..0cd582861d 100644 --- a/apis/v1alpha2/zz_generated.register.go +++ b/apis/v1alpha2/zz_generated.register.go @@ -58,8 +58,6 @@ func init() { // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &BackendPolicy{}, - &BackendPolicyList{}, &Gateway{}, &GatewayClass{}, &GatewayClassList{}, diff --git a/config/crd/bases/gateway.networking.k8s.io_backendpolicies.yaml b/config/crd/bases/gateway.networking.k8s.io_backendpolicies.yaml deleted file mode 100644 index 1988b5fc44..0000000000 --- a/config/crd/bases/gateway.networking.k8s.io_backendpolicies.yaml +++ /dev/null @@ -1,226 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: unapproved - creationTimestamp: null - name: backendpolicies.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: BackendPolicy - listKind: BackendPolicyList - plural: backendpolicies - shortNames: - - bp - singular: backendpolicy - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha2 - schema: - openAPIV3Schema: - description: 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. - 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 BackendPolicy. - properties: - backendRefs: - description: "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. \n - Support: Core" - items: - description: BackendRef identifies an API object within the same - namespace as the BackendPolicy. - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is the kind of the referent. - maxLength: 253 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - type: string - port: - description: Port is the port of the referent. If unspecified, - this policy applies to all ports on the backend. - format: int32 - maximum: 65535 - minimum: 1 - type: integer - required: - - group - - kind - - name - type: object - maxItems: 16 - type: array - tls: - description: "TLS is the TLS configuration for these backends. \n - Support: Extended" - properties: - certificateAuthorityRef: - description: "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. \n CertificateAuthorityRef - can reference a standard Kubernetes resource, i.e. ConfigMap, - or an implementation-specific custom resource. \n 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. \n CertificateAuthorityRef can also reference - a standard Kubernetes resource, i.e. ConfigMap, or an implementation-specific - custom resource. \n Support: Extended" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - minLength: 1 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object - options: - additionalProperties: - type: string - description: "Options are a list of key/value pairs to give extended - options to the provider. \n Support: Implementation-specific" - type: object - type: object - required: - - backendRefs - type: object - status: - description: Status defines the current state of BackendPolicy. - properties: - conditions: - description: Conditions describe the current conditions of the BackendPolicy. - 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: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml index 2afd27de2e..55c77f63b6 100644 --- a/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml @@ -757,15 +757,7 @@ spec: for this route should be updated with a condition that describes the error more specifically. \n 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 `gateway.networking.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. \n Support: Core" + on Service resources. \n Support: Core" maxLength: 253 type: string weight: diff --git a/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml index 6795db7220..d5b3a4ad1f 100644 --- a/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml @@ -148,16 +148,8 @@ spec: with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n 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 `gateway.networking.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. \n Support: Core" + to use should be specified with the AppProtocol field + on Service resources. \n Support: Core" maxLength: 253 type: string weight: diff --git a/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml b/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml index 7c34298f35..d8fd81a1b0 100644 --- a/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml @@ -188,16 +188,8 @@ spec: with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n 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 `gateway.networking.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. \n Support: Core" + to use should be specified with the AppProtocol field + on Service resources. \n Support: Core" maxLength: 253 type: string weight: diff --git a/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml index 2e9981bf71..abae373970 100644 --- a/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml @@ -149,16 +149,8 @@ spec: with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n 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 `gateway.networking.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. \n Support: Core" + to use should be specified with the AppProtocol field + on Service resources. \n Support: Core" maxLength: 253 type: string weight: diff --git a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/apis_client.go b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/apis_client.go index 4b55a8c73f..d124f85192 100644 --- a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/apis_client.go +++ b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/apis_client.go @@ -26,7 +26,6 @@ import ( type GatewayV1alpha2Interface interface { RESTClient() rest.Interface - BackendPoliciesGetter GatewaysGetter GatewayClassesGetter HTTPRoutesGetter @@ -40,10 +39,6 @@ type GatewayV1alpha2Client struct { restClient rest.Interface } -func (c *GatewayV1alpha2Client) BackendPolicies(namespace string) BackendPolicyInterface { - return newBackendPolicies(c, namespace) -} - func (c *GatewayV1alpha2Client) Gateways(namespace string) GatewayInterface { return newGateways(c, namespace) } diff --git a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/backendpolicy.go b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/backendpolicy.go deleted file mode 100644 index c07fa6bcdc..0000000000 --- a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/backendpolicy.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -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 v1alpha2 - -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" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/gateway/versioned/scheme" -) - -// BackendPoliciesGetter has a method to return a BackendPolicyInterface. -// A group's client should implement this interface. -type BackendPoliciesGetter interface { - BackendPolicies(namespace string) BackendPolicyInterface -} - -// BackendPolicyInterface has methods to work with BackendPolicy resources. -type BackendPolicyInterface interface { - Create(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.CreateOptions) (*v1alpha2.BackendPolicy, error) - Update(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendPolicy, error) - UpdateStatus(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendPolicy, 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) (*v1alpha2.BackendPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.BackendPolicyList, 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 *v1alpha2.BackendPolicy, err error) - BackendPolicyExpansion -} - -// backendPolicies implements BackendPolicyInterface -type backendPolicies struct { - client rest.Interface - ns string -} - -// newBackendPolicies returns a BackendPolicies -func newBackendPolicies(c *GatewayV1alpha2Client, namespace string) *backendPolicies { - return &backendPolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the backendPolicy, and returns the corresponding backendPolicy object, and an error if there is any. -func (c *backendPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendPolicy, err error) { - result = &v1alpha2.BackendPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backendpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of BackendPolicies that match those selectors. -func (c *backendPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.BackendPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backendpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested backendPolicies. -func (c *backendPolicies) 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("backendpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a backendPolicy and creates it. Returns the server's representation of the backendPolicy, and an error, if there is any. -func (c *backendPolicies) Create(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendPolicy, err error) { - result = &v1alpha2.BackendPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("backendpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a backendPolicy and updates it. Returns the server's representation of the backendPolicy, and an error, if there is any. -func (c *backendPolicies) Update(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendPolicy, err error) { - result = &v1alpha2.BackendPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backendpolicies"). - Name(backendPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendPolicy). - 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 *backendPolicies) UpdateStatus(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendPolicy, err error) { - result = &v1alpha2.BackendPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backendpolicies"). - Name(backendPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the backendPolicy and deletes it. Returns an error if one occurs. -func (c *backendPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("backendpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *backendPolicies) 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("backendpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched backendPolicy. -func (c *backendPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendPolicy, err error) { - result = &v1alpha2.BackendPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("backendpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go index c53859aeb3..c308ec56eb 100644 --- a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go +++ b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go @@ -28,10 +28,6 @@ type FakeGatewayV1alpha2 struct { *testing.Fake } -func (c *FakeGatewayV1alpha2) BackendPolicies(namespace string) v1alpha2.BackendPolicyInterface { - return &FakeBackendPolicies{c, namespace} -} - func (c *FakeGatewayV1alpha2) Gateways(namespace string) v1alpha2.GatewayInterface { return &FakeGateways{c, namespace} } diff --git a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_backendpolicy.go b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_backendpolicy.go deleted file mode 100644 index 81daa8863b..0000000000 --- a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/fake/fake_backendpolicy.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -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" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" -) - -// FakeBackendPolicies implements BackendPolicyInterface -type FakeBackendPolicies struct { - Fake *FakeGatewayV1alpha2 - ns string -} - -var backendpoliciesResource = schema.GroupVersionResource{Group: "gateway.networking.k8s.io", Version: "v1alpha2", Resource: "backendpolicies"} - -var backendpoliciesKind = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1alpha2", Kind: "BackendPolicy"} - -// Get takes name of the backendPolicy, and returns the corresponding backendPolicy object, and an error if there is any. -func (c *FakeBackendPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(backendpoliciesResource, c.ns, name), &v1alpha2.BackendPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.BackendPolicy), err -} - -// List takes label and field selectors, and returns the list of BackendPolicies that match those selectors. -func (c *FakeBackendPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(backendpoliciesResource, backendpoliciesKind, c.ns, opts), &v1alpha2.BackendPolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.BackendPolicyList{ListMeta: obj.(*v1alpha2.BackendPolicyList).ListMeta} - for _, item := range obj.(*v1alpha2.BackendPolicyList).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 backendPolicies. -func (c *FakeBackendPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(backendpoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a backendPolicy and creates it. Returns the server's representation of the backendPolicy, and an error, if there is any. -func (c *FakeBackendPolicies) Create(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(backendpoliciesResource, c.ns, backendPolicy), &v1alpha2.BackendPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.BackendPolicy), err -} - -// Update takes the representation of a backendPolicy and updates it. Returns the server's representation of the backendPolicy, and an error, if there is any. -func (c *FakeBackendPolicies) Update(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backendpoliciesResource, c.ns, backendPolicy), &v1alpha2.BackendPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.BackendPolicy), 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 *FakeBackendPolicies) UpdateStatus(ctx context.Context, backendPolicy *v1alpha2.BackendPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendPolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backendpoliciesResource, "status", c.ns, backendPolicy), &v1alpha2.BackendPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.BackendPolicy), err -} - -// Delete takes name of the backendPolicy and deletes it. Returns an error if one occurs. -func (c *FakeBackendPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(backendpoliciesResource, c.ns, name), &v1alpha2.BackendPolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeBackendPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backendpoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha2.BackendPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched backendPolicy. -func (c *FakeBackendPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendpoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha2.BackendPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.BackendPolicy), err -} diff --git a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/generated_expansion.go b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/generated_expansion.go index eddf8f9faf..1952cc3bc6 100644 --- a/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/gateway/versioned/typed/apis/v1alpha2/generated_expansion.go @@ -18,8 +18,6 @@ limitations under the License. package v1alpha2 -type BackendPolicyExpansion interface{} - type GatewayExpansion interface{} type GatewayClassExpansion interface{} diff --git a/pkg/client/informers/gateway/externalversions/apis/v1alpha2/backendpolicy.go b/pkg/client/informers/gateway/externalversions/apis/v1alpha2/backendpolicy.go deleted file mode 100644 index 81f0d71af6..0000000000 --- a/pkg/client/informers/gateway/externalversions/apis/v1alpha2/backendpolicy.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -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 v1alpha2 - -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" - apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/gateway/versioned" - internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/gateway/externalversions/internalinterfaces" - v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/listers/gateway/apis/v1alpha2" -) - -// BackendPolicyInformer provides access to a shared informer and lister for -// BackendPolicies. -type BackendPolicyInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.BackendPolicyLister -} - -type backendPolicyInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBackendPolicyInformer constructs a new informer for BackendPolicy 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 NewBackendPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBackendPolicyInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBackendPolicyInformer constructs a new informer for BackendPolicy 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 NewFilteredBackendPolicyInformer(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.GatewayV1alpha2().BackendPolicies(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GatewayV1alpha2().BackendPolicies(namespace).Watch(context.TODO(), options) - }, - }, - &apisv1alpha2.BackendPolicy{}, - resyncPeriod, - indexers, - ) -} - -func (f *backendPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBackendPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *backendPolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisv1alpha2.BackendPolicy{}, f.defaultInformer) -} - -func (f *backendPolicyInformer) Lister() v1alpha2.BackendPolicyLister { - return v1alpha2.NewBackendPolicyLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/gateway/externalversions/apis/v1alpha2/interface.go b/pkg/client/informers/gateway/externalversions/apis/v1alpha2/interface.go index cf4d10bea5..c43fec8654 100644 --- a/pkg/client/informers/gateway/externalversions/apis/v1alpha2/interface.go +++ b/pkg/client/informers/gateway/externalversions/apis/v1alpha2/interface.go @@ -24,8 +24,6 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // BackendPolicies returns a BackendPolicyInformer. - BackendPolicies() BackendPolicyInformer // Gateways returns a GatewayInformer. Gateways() GatewayInformer // GatewayClasses returns a GatewayClassInformer. @@ -51,11 +49,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// BackendPolicies returns a BackendPolicyInformer. -func (v *version) BackendPolicies() BackendPolicyInformer { - return &backendPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // Gateways returns a GatewayInformer. func (v *version) Gateways() GatewayInformer { return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/gateway/externalversions/generic.go b/pkg/client/informers/gateway/externalversions/generic.go index cd34bb84ee..0925ef97eb 100644 --- a/pkg/client/informers/gateway/externalversions/generic.go +++ b/pkg/client/informers/gateway/externalversions/generic.go @@ -53,8 +53,6 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=gateway.networking.k8s.io, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("backendpolicies"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendPolicies().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("gateways"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().Gateways().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("gatewayclasses"): diff --git a/pkg/client/listers/gateway/apis/v1alpha2/backendpolicy.go b/pkg/client/listers/gateway/apis/v1alpha2/backendpolicy.go deleted file mode 100644 index 7a77b7b7da..0000000000 --- a/pkg/client/listers/gateway/apis/v1alpha2/backendpolicy.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -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 v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" -) - -// BackendPolicyLister helps list BackendPolicies. -// All objects returned here must be treated as read-only. -type BackendPolicyLister interface { - // List lists all BackendPolicies in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.BackendPolicy, err error) - // BackendPolicies returns an object that can list and get BackendPolicies. - BackendPolicies(namespace string) BackendPolicyNamespaceLister - BackendPolicyListerExpansion -} - -// backendPolicyLister implements the BackendPolicyLister interface. -type backendPolicyLister struct { - indexer cache.Indexer -} - -// NewBackendPolicyLister returns a new BackendPolicyLister. -func NewBackendPolicyLister(indexer cache.Indexer) BackendPolicyLister { - return &backendPolicyLister{indexer: indexer} -} - -// List lists all BackendPolicies in the indexer. -func (s *backendPolicyLister) List(selector labels.Selector) (ret []*v1alpha2.BackendPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.BackendPolicy)) - }) - return ret, err -} - -// BackendPolicies returns an object that can list and get BackendPolicies. -func (s *backendPolicyLister) BackendPolicies(namespace string) BackendPolicyNamespaceLister { - return backendPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BackendPolicyNamespaceLister helps list and get BackendPolicies. -// All objects returned here must be treated as read-only. -type BackendPolicyNamespaceLister interface { - // List lists all BackendPolicies in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.BackendPolicy, err error) - // Get retrieves the BackendPolicy from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.BackendPolicy, error) - BackendPolicyNamespaceListerExpansion -} - -// backendPolicyNamespaceLister implements the BackendPolicyNamespaceLister -// interface. -type backendPolicyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BackendPolicies in the indexer for a given namespace. -func (s backendPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.BackendPolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.BackendPolicy)) - }) - return ret, err -} - -// Get retrieves the BackendPolicy from the indexer for a given namespace and name. -func (s backendPolicyNamespaceLister) Get(name string) (*v1alpha2.BackendPolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("backendpolicy"), name) - } - return obj.(*v1alpha2.BackendPolicy), nil -} diff --git a/pkg/client/listers/gateway/apis/v1alpha2/expansion_generated.go b/pkg/client/listers/gateway/apis/v1alpha2/expansion_generated.go index 9e66e2df62..4c9bab0f5b 100644 --- a/pkg/client/listers/gateway/apis/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/gateway/apis/v1alpha2/expansion_generated.go @@ -18,14 +18,6 @@ limitations under the License. package v1alpha2 -// BackendPolicyListerExpansion allows custom methods to be added to -// BackendPolicyLister. -type BackendPolicyListerExpansion interface{} - -// BackendPolicyNamespaceListerExpansion allows custom methods to be added to -// BackendPolicyNamespaceLister. -type BackendPolicyNamespaceListerExpansion interface{} - // GatewayListerExpansion allows custom methods to be added to // GatewayLister. type GatewayListerExpansion interface{} diff --git a/site-src/v1alpha2/concepts/api-overview.md b/site-src/v1alpha2/concepts/api-overview.md index 676d059863..8a9f380ae8 100644 --- a/site-src/v1alpha2/concepts/api-overview.md +++ b/site-src/v1alpha2/concepts/api-overview.md @@ -83,20 +83,6 @@ to Kubernetes Services. `HTTPRoute` and `TCPRoute` are currently the only defined Route objects. Additional protocol-specific Route objects may be added in the future. -### BackendPolicy - -BackendPolicy provides a way to configure connections between a Gateway and a -backend. For the purpose of this API, a backend is any resource that a route can -forward traffic to. A common example of a backend is a Service. Configuration at -this level is currently limited to TLS, but will expand in the future to support -more advanced policies such as health checking. - -Some backend configuration may vary depending on the Route that is targeting the -backend. In those cases, configuration fields will be placed on Routes and not -BackendPolicy. For more information on what may be configured with this resource -in the future, refer to the related [GitHub -issue](https://github.com/kubernetes-sigs/gateway-api/issues/196). - ### Route binding When a Route binds to a Gateway it represents configuration that is applied on diff --git a/site-src/v1alpha2/faq.md b/site-src/v1alpha2/faq.md index 8470ed65ef..3604891757 100644 --- a/site-src/v1alpha2/faq.md +++ b/site-src/v1alpha2/faq.md @@ -36,12 +36,6 @@ could cause an implementation to attach a specified access control policy. This is an example of matching the object by name. - Gateway API uses this decorator pattern with the - [`BackendPolicy`](/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.BackendPolicy) - resource, which modifies how a `Gateway` should forward traffic - to a backend target (commonly a Kubernetes `Service`). This is - an example of using explicit object references. - * Use implementation-specific values for string fields. In many places, the fields of Gateway API resources have the type "string". This allows an implementation to support custom values diff --git a/site-src/v1alpha2/guides/tls.md b/site-src/v1alpha2/guides/tls.md index 549296e113..5e1dd68aee 100644 --- a/site-src/v1alpha2/guides/tls.md +++ b/site-src/v1alpha2/guides/tls.md @@ -85,9 +85,9 @@ 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 +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`. @@ -130,28 +130,6 @@ there are two HTTPRoute resources which specify certificates for {% include '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 'upstream-tls.yaml' %} -``` - ## Extensions Both upstream and downstream TLS configs provide an `options` map to add