From e667c7027f7c3e2600cef75b52afad6ebc8384e3 Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Mon, 26 Sep 2022 17:29:49 +0000 Subject: [PATCH] Remove ReferencePolicy in favor of ReferenceGrant ReferencePolicy was renamed to ReferenceGrant in v0.5.0. The original ReferencePolicy resource was formally deprecated at that point, this removes it entirely. --- apis/v1alpha2/referencepolicy_types.go | 62 ------- apis/v1alpha2/zz_generated.deepcopy.go | 58 ------- apis/v1alpha2/zz_generated.register.go | 2 - ...y.networking.k8s.io_referencepolicies.yaml | 154 ------------------ .../typed/apis/v1alpha2/apis_client.go | 5 - .../apis/v1alpha2/fake/fake_apis_client.go | 4 - .../apis/v1alpha2/generated_expansion.go | 2 - .../apis/v1alpha2/interface.go | 7 - .../informers/externalversions/generic.go | 2 - .../apis/v1alpha2/expansion_generated.go | 8 - 10 files changed, 304 deletions(-) delete mode 100644 apis/v1alpha2/referencepolicy_types.go delete mode 100644 config/crd/experimental/gateway.networking.k8s.io_referencepolicies.yaml diff --git a/apis/v1alpha2/referencepolicy_types.go b/apis/v1alpha2/referencepolicy_types.go deleted file mode 100644 index dc41701a8e..0000000000 --- a/apis/v1alpha2/referencepolicy_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -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 v1alpha2 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -// +genclient -// +kubebuilder:object:root=true -// +kubebuilder:resource:categories=gateway-api,shortName=refpol -// +kubebuilder:deprecatedversion:warning="ReferencePolicy has been renamed to ReferenceGrant. ReferencePolicy will be removed in v0.6.0 in favor of the identical ReferenceGrant resource." -// +kubebuilder:storageversion -// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` - -// ReferencePolicy identifies kinds of resources in other namespaces that are -// trusted to reference the specified kinds of resources in the same namespace -// as the policy. -// -// Note: This resource has been renamed to ReferenceGrant. ReferencePolicy will -// be removed in v0.6.0 in favor of the identical ReferenceGrant resource. -// -// Each ReferencePolicy 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. -// -// All cross-namespace references in Gateway API (with the exception of cross-namespace -// Gateway-route attachment) require a ReferenceGrant. -// -// Support: Core -// -type ReferencePolicy struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of ReferencePolicy. - Spec ReferenceGrantSpec `json:"spec,omitempty"` - - // Note that `Status` sub-resource has been excluded at the - // moment as it was difficult to work out the design. - // `Status` sub-resource may be added in future. -} - -// +kubebuilder:object:root=true -// ReferencePolicyList contains a list of ReferencePolicy. -type ReferencePolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ReferencePolicy `json:"items"` -} diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index a7f5fa9bbe..7b51b95615 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -612,64 +612,6 @@ func (in *ReferenceGrantTo) DeepCopy() *ReferenceGrantTo { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReferencePolicy) DeepCopyInto(out *ReferencePolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferencePolicy. -func (in *ReferencePolicy) DeepCopy() *ReferencePolicy { - if in == nil { - return nil - } - out := new(ReferencePolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ReferencePolicy) 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 *ReferencePolicyList) DeepCopyInto(out *ReferencePolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ReferencePolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferencePolicyList. -func (in *ReferencePolicyList) DeepCopy() *ReferencePolicyList { - if in == nil { - return nil - } - out := new(ReferencePolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ReferencePolicyList) 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 *TCPRoute) DeepCopyInto(out *TCPRoute) { *out = *in diff --git a/apis/v1alpha2/zz_generated.register.go b/apis/v1alpha2/zz_generated.register.go index 9dcde248f0..5bbf46709a 100644 --- a/apis/v1alpha2/zz_generated.register.go +++ b/apis/v1alpha2/zz_generated.register.go @@ -68,8 +68,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &HTTPRouteList{}, &ReferenceGrant{}, &ReferenceGrantList{}, - &ReferencePolicy{}, - &ReferencePolicyList{}, &TCPRoute{}, &TCPRouteList{}, &TLSRoute{}, diff --git a/config/crd/experimental/gateway.networking.k8s.io_referencepolicies.yaml b/config/crd/experimental/gateway.networking.k8s.io_referencepolicies.yaml deleted file mode 100644 index f4fc76d095..0000000000 --- a/config/crd/experimental/gateway.networking.k8s.io_referencepolicies.yaml +++ /dev/null @@ -1,154 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/1086 - gateway.networking.k8s.io/bundle-version: v0.6.0-dev - gateway.networking.k8s.io/channel: experimental - creationTimestamp: null - name: referencepolicies.gateway.networking.k8s.io -spec: - group: gateway.networking.k8s.io - names: - categories: - - gateway-api - kind: ReferencePolicy - listKind: ReferencePolicyList - plural: referencepolicies - shortNames: - - refpol - singular: referencepolicy - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - deprecated: true - deprecationWarning: ReferencePolicy has been renamed to ReferenceGrant. ReferencePolicy - will be removed in v0.6.0 in favor of the identical ReferenceGrant resource. - name: v1alpha2 - schema: - openAPIV3Schema: - description: "ReferencePolicy 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 Note: This resource has been renamed to ReferenceGrant. - ReferencePolicy will be removed in v0.6.0 in favor of the identical ReferenceGrant - resource. \n Each ReferencePolicy 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 ReferencePolicy. - 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 types are - part of the \"Core\" support level for this field. \n When - used to permit a SecretObjectReference: \n * Gateway \n When - used to permit a BackendObjectReference: \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 * Secret - when used to permit a SecretObjectReference * Service when - used to permit a BackendObjectReference" - 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/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go index 8a4bd69b43..165c88af9f 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go @@ -33,7 +33,6 @@ type GatewayV1alpha2Interface interface { GatewayClassesGetter HTTPRoutesGetter ReferenceGrantsGetter - ReferencePoliciesGetter TCPRoutesGetter TLSRoutesGetter UDPRoutesGetter @@ -64,10 +63,6 @@ func (c *GatewayV1alpha2Client) ReferenceGrants(namespace string) ReferenceGrant return newReferenceGrants(c, namespace) } -func (c *GatewayV1alpha2Client) ReferencePolicies(namespace string) ReferencePolicyInterface { - return newReferencePolicies(c, namespace) -} - func (c *GatewayV1alpha2Client) TCPRoutes(namespace string) TCPRouteInterface { return newTCPRoutes(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go index 043ac6f4db..0f5e66d856 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go @@ -48,10 +48,6 @@ func (c *FakeGatewayV1alpha2) ReferenceGrants(namespace string) v1alpha2.Referen return &FakeReferenceGrants{c, namespace} } -func (c *FakeGatewayV1alpha2) ReferencePolicies(namespace string) v1alpha2.ReferencePolicyInterface { - return &FakeReferencePolicies{c, namespace} -} - func (c *FakeGatewayV1alpha2) TCPRoutes(namespace string) v1alpha2.TCPRouteInterface { return &FakeTCPRoutes{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go index fecf4d2219..6de1bd3e14 100644 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go @@ -28,8 +28,6 @@ type HTTPRouteExpansion interface{} type ReferenceGrantExpansion interface{} -type ReferencePolicyExpansion interface{} - type TCPRouteExpansion interface{} type TLSRouteExpansion interface{} diff --git a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go index 34fd1a7ce3..42a9bfad08 100644 --- a/pkg/client/informers/externalversions/apis/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/apis/v1alpha2/interface.go @@ -34,8 +34,6 @@ type Interface interface { HTTPRoutes() HTTPRouteInformer // ReferenceGrants returns a ReferenceGrantInformer. ReferenceGrants() ReferenceGrantInformer - // ReferencePolicies returns a ReferencePolicyInformer. - ReferencePolicies() ReferencePolicyInformer // TCPRoutes returns a TCPRouteInformer. TCPRoutes() TCPRouteInformer // TLSRoutes returns a TLSRouteInformer. @@ -80,11 +78,6 @@ func (v *version) ReferenceGrants() ReferenceGrantInformer { return &referenceGrantInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// ReferencePolicies returns a ReferencePolicyInformer. -func (v *version) ReferencePolicies() ReferencePolicyInformer { - return &referencePolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // TCPRoutes returns a TCPRouteInformer. func (v *version) TCPRoutes() TCPRouteInformer { return &tCPRouteInformer{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 9d7c0c34e3..0a21206e42 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -64,8 +64,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().HTTPRoutes().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("referencegrants"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().ReferenceGrants().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("referencepolicies"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().ReferencePolicies().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("tcproutes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().TCPRoutes().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("tlsroutes"): diff --git a/pkg/client/listers/apis/v1alpha2/expansion_generated.go b/pkg/client/listers/apis/v1alpha2/expansion_generated.go index 2a6573d2af..f41ca73361 100644 --- a/pkg/client/listers/apis/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/apis/v1alpha2/expansion_generated.go @@ -54,14 +54,6 @@ type ReferenceGrantListerExpansion interface{} // ReferenceGrantNamespaceLister. type ReferenceGrantNamespaceListerExpansion interface{} -// ReferencePolicyListerExpansion allows custom methods to be added to -// ReferencePolicyLister. -type ReferencePolicyListerExpansion interface{} - -// ReferencePolicyNamespaceListerExpansion allows custom methods to be added to -// ReferencePolicyNamespaceLister. -type ReferencePolicyNamespaceListerExpansion interface{} - // TCPRouteListerExpansion allows custom methods to be added to // TCPRouteLister. type TCPRouteListerExpansion interface{}