From b9f6cb538e257e864d921e71f5f845727cadd6af 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 - .../v1alpha2/fake/fake_referencepolicy.go | 130 ------------- .../apis/v1alpha2/generated_expansion.go | 2 - .../typed/apis/v1alpha2/referencepolicy.go | 178 ------------------ .../apis/v1alpha2/interface.go | 7 - .../apis/v1alpha2/referencepolicy.go | 90 --------- .../informers/externalversions/generic.go | 2 - .../apis/v1alpha2/expansion_generated.go | 8 - .../listers/apis/v1alpha2/referencepolicy.go | 99 ---------- 14 files changed, 801 deletions(-) delete mode 100644 apis/v1alpha2/referencepolicy_types.go delete mode 100644 config/crd/experimental/gateway.networking.k8s.io_referencepolicies.yaml delete mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencepolicy.go delete mode 100644 pkg/client/clientset/versioned/typed/apis/v1alpha2/referencepolicy.go delete mode 100644 pkg/client/informers/externalversions/apis/v1alpha2/referencepolicy.go delete mode 100644 pkg/client/listers/apis/v1alpha2/referencepolicy.go 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/fake/fake_referencepolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencepolicy.go deleted file mode 100644 index 63f19743d3..0000000000 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencepolicy.go +++ /dev/null @@ -1,130 +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" -) - -// FakeReferencePolicies implements ReferencePolicyInterface -type FakeReferencePolicies struct { - Fake *FakeGatewayV1alpha2 - ns string -} - -var referencepoliciesResource = schema.GroupVersionResource{Group: "gateway.networking.k8s.io", Version: "v1alpha2", Resource: "referencepolicies"} - -var referencepoliciesKind = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1alpha2", Kind: "ReferencePolicy"} - -// Get takes name of the referencePolicy, and returns the corresponding referencePolicy object, and an error if there is any. -func (c *FakeReferencePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ReferencePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(referencepoliciesResource, c.ns, name), &v1alpha2.ReferencePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.ReferencePolicy), err -} - -// List takes label and field selectors, and returns the list of ReferencePolicies that match those selectors. -func (c *FakeReferencePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ReferencePolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(referencepoliciesResource, referencepoliciesKind, c.ns, opts), &v1alpha2.ReferencePolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.ReferencePolicyList{ListMeta: obj.(*v1alpha2.ReferencePolicyList).ListMeta} - for _, item := range obj.(*v1alpha2.ReferencePolicyList).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 referencePolicies. -func (c *FakeReferencePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(referencepoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a referencePolicy and creates it. Returns the server's representation of the referencePolicy, and an error, if there is any. -func (c *FakeReferencePolicies) Create(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.CreateOptions) (result *v1alpha2.ReferencePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(referencepoliciesResource, c.ns, referencePolicy), &v1alpha2.ReferencePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.ReferencePolicy), err -} - -// Update takes the representation of a referencePolicy and updates it. Returns the server's representation of the referencePolicy, and an error, if there is any. -func (c *FakeReferencePolicies) Update(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.UpdateOptions) (result *v1alpha2.ReferencePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(referencepoliciesResource, c.ns, referencePolicy), &v1alpha2.ReferencePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.ReferencePolicy), err -} - -// Delete takes name of the referencePolicy and deletes it. Returns an error if one occurs. -func (c *FakeReferencePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(referencepoliciesResource, c.ns, name, opts), &v1alpha2.ReferencePolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeReferencePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(referencepoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha2.ReferencePolicyList{}) - return err -} - -// Patch applies the patch and returns the patched referencePolicy. -func (c *FakeReferencePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ReferencePolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(referencepoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha2.ReferencePolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.ReferencePolicy), err -} 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/clientset/versioned/typed/apis/v1alpha2/referencepolicy.go b/pkg/client/clientset/versioned/typed/apis/v1alpha2/referencepolicy.go deleted file mode 100644 index f3e784c417..0000000000 --- a/pkg/client/clientset/versioned/typed/apis/v1alpha2/referencepolicy.go +++ /dev/null @@ -1,178 +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/versioned/scheme" -) - -// ReferencePoliciesGetter has a method to return a ReferencePolicyInterface. -// A group's client should implement this interface. -type ReferencePoliciesGetter interface { - ReferencePolicies(namespace string) ReferencePolicyInterface -} - -// ReferencePolicyInterface has methods to work with ReferencePolicy resources. -type ReferencePolicyInterface interface { - Create(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.CreateOptions) (*v1alpha2.ReferencePolicy, error) - Update(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.UpdateOptions) (*v1alpha2.ReferencePolicy, 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.ReferencePolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.ReferencePolicyList, 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.ReferencePolicy, err error) - ReferencePolicyExpansion -} - -// referencePolicies implements ReferencePolicyInterface -type referencePolicies struct { - client rest.Interface - ns string -} - -// newReferencePolicies returns a ReferencePolicies -func newReferencePolicies(c *GatewayV1alpha2Client, namespace string) *referencePolicies { - return &referencePolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the referencePolicy, and returns the corresponding referencePolicy object, and an error if there is any. -func (c *referencePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ReferencePolicy, err error) { - result = &v1alpha2.ReferencePolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencepolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ReferencePolicies that match those selectors. -func (c *referencePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ReferencePolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ReferencePolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested referencePolicies. -func (c *referencePolicies) 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("referencepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a referencePolicy and creates it. Returns the server's representation of the referencePolicy, and an error, if there is any. -func (c *referencePolicies) Create(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.CreateOptions) (result *v1alpha2.ReferencePolicy, err error) { - result = &v1alpha2.ReferencePolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("referencepolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referencePolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a referencePolicy and updates it. Returns the server's representation of the referencePolicy, and an error, if there is any. -func (c *referencePolicies) Update(ctx context.Context, referencePolicy *v1alpha2.ReferencePolicy, opts v1.UpdateOptions) (result *v1alpha2.ReferencePolicy, err error) { - result = &v1alpha2.ReferencePolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("referencepolicies"). - Name(referencePolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referencePolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the referencePolicy and deletes it. Returns an error if one occurs. -func (c *referencePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("referencepolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *referencePolicies) 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("referencepolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched referencePolicy. -func (c *referencePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ReferencePolicy, err error) { - result = &v1alpha2.ReferencePolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("referencepolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} 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/apis/v1alpha2/referencepolicy.go b/pkg/client/informers/externalversions/apis/v1alpha2/referencepolicy.go deleted file mode 100644 index 08e1551d2d..0000000000 --- a/pkg/client/informers/externalversions/apis/v1alpha2/referencepolicy.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/versioned" - internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2" -) - -// ReferencePolicyInformer provides access to a shared informer and lister for -// ReferencePolicies. -type ReferencePolicyInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.ReferencePolicyLister -} - -type referencePolicyInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewReferencePolicyInformer constructs a new informer for ReferencePolicy 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 NewReferencePolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredReferencePolicyInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredReferencePolicyInformer constructs a new informer for ReferencePolicy 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 NewFilteredReferencePolicyInformer(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().ReferencePolicies(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GatewayV1alpha2().ReferencePolicies(namespace).Watch(context.TODO(), options) - }, - }, - &apisv1alpha2.ReferencePolicy{}, - resyncPeriod, - indexers, - ) -} - -func (f *referencePolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredReferencePolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *referencePolicyInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisv1alpha2.ReferencePolicy{}, f.defaultInformer) -} - -func (f *referencePolicyInformer) Lister() v1alpha2.ReferencePolicyLister { - return v1alpha2.NewReferencePolicyLister(f.Informer().GetIndexer()) -} 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{} diff --git a/pkg/client/listers/apis/v1alpha2/referencepolicy.go b/pkg/client/listers/apis/v1alpha2/referencepolicy.go deleted file mode 100644 index 5a1f994b9d..0000000000 --- a/pkg/client/listers/apis/v1alpha2/referencepolicy.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" -) - -// ReferencePolicyLister helps list ReferencePolicies. -// All objects returned here must be treated as read-only. -type ReferencePolicyLister interface { - // List lists all ReferencePolicies in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ReferencePolicy, err error) - // ReferencePolicies returns an object that can list and get ReferencePolicies. - ReferencePolicies(namespace string) ReferencePolicyNamespaceLister - ReferencePolicyListerExpansion -} - -// referencePolicyLister implements the ReferencePolicyLister interface. -type referencePolicyLister struct { - indexer cache.Indexer -} - -// NewReferencePolicyLister returns a new ReferencePolicyLister. -func NewReferencePolicyLister(indexer cache.Indexer) ReferencePolicyLister { - return &referencePolicyLister{indexer: indexer} -} - -// List lists all ReferencePolicies in the indexer. -func (s *referencePolicyLister) List(selector labels.Selector) (ret []*v1alpha2.ReferencePolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReferencePolicy)) - }) - return ret, err -} - -// ReferencePolicies returns an object that can list and get ReferencePolicies. -func (s *referencePolicyLister) ReferencePolicies(namespace string) ReferencePolicyNamespaceLister { - return referencePolicyNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ReferencePolicyNamespaceLister helps list and get ReferencePolicies. -// All objects returned here must be treated as read-only. -type ReferencePolicyNamespaceLister interface { - // List lists all ReferencePolicies in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.ReferencePolicy, err error) - // Get retrieves the ReferencePolicy from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.ReferencePolicy, error) - ReferencePolicyNamespaceListerExpansion -} - -// referencePolicyNamespaceLister implements the ReferencePolicyNamespaceLister -// interface. -type referencePolicyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ReferencePolicies in the indexer for a given namespace. -func (s referencePolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ReferencePolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReferencePolicy)) - }) - return ret, err -} - -// Get retrieves the ReferencePolicy from the indexer for a given namespace and name. -func (s referencePolicyNamespaceLister) Get(name string) (*v1alpha2.ReferencePolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("referencepolicy"), name) - } - return obj.(*v1alpha2.ReferencePolicy), nil -}