diff --git a/charts/linkerd-crds/templates/policy/server.yaml b/charts/linkerd-crds/templates/policy/server.yaml index 1b81d958ea3ca..6f9780cec0dd7 100644 --- a/charts/linkerd-crds/templates/policy/server.yaml +++ b/charts/linkerd-crds/templates/policy/server.yaml @@ -133,6 +133,94 @@ spec: description: The protocol of the server jsonPath: .spec.proxyProtocol - name: v1beta2 + served: true + storage: false + schema: + openAPIV3Schema: + type: object + required: [spec] + properties: + spec: + type: object + required: + - port + oneOf: + - required: [podSelector] + - required: [externalWorkloadSelector] + properties: + podSelector: + type: object + description: >- + Selects pods in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + externalWorkloadSelector: + type: object + description: >- + Selects ExternalWorkloads in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + port: + description: >- + A port name or number. Must exist in a pod spec. + x-kubernetes-int-or-string: true + proxyProtocol: + description: >- + Configures protocol discovery for inbound connections. + + Supersedes the `config.linkerd.io/opaque-ports` annotation. + type: string + default: unknown + additionalPrinterColumns: + - name: Port + type: string + description: The port the server is listening on + jsonPath: .spec.port + - name: Protocol + type: string + description: The protocol of the server + jsonPath: .spec.proxyProtocol + - name: v1beta3 served: true storage: true schema: diff --git a/cli/cmd/testdata/install_crds.golden b/cli/cmd/testdata/install_crds.golden index 79f220f802f10..6a9bb0f5e0e94 100644 --- a/cli/cmd/testdata/install_crds.golden +++ b/cli/cmd/testdata/install_crds.golden @@ -5966,6 +5966,94 @@ spec: description: The protocol of the server jsonPath: .spec.proxyProtocol - name: v1beta2 + served: true + storage: false + schema: + openAPIV3Schema: + type: object + required: [spec] + properties: + spec: + type: object + required: + - port + oneOf: + - required: [podSelector] + - required: [externalWorkloadSelector] + properties: + podSelector: + type: object + description: >- + Selects pods in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + externalWorkloadSelector: + type: object + description: >- + Selects ExternalWorkloads in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + port: + description: >- + A port name or number. Must exist in a pod spec. + x-kubernetes-int-or-string: true + proxyProtocol: + description: >- + Configures protocol discovery for inbound connections. + + Supersedes the `config.linkerd.io/opaque-ports` annotation. + type: string + default: unknown + additionalPrinterColumns: + - name: Port + type: string + description: The port the server is listening on + jsonPath: .spec.port + - name: Protocol + type: string + description: The protocol of the server + jsonPath: .spec.proxyProtocol + - name: v1beta3 served: true storage: true schema: diff --git a/cli/cmd/testdata/install_helm_crds_output.golden b/cli/cmd/testdata/install_helm_crds_output.golden index 815cc363b8645..c1e73494e9d88 100644 --- a/cli/cmd/testdata/install_helm_crds_output.golden +++ b/cli/cmd/testdata/install_helm_crds_output.golden @@ -5978,6 +5978,94 @@ spec: description: The protocol of the server jsonPath: .spec.proxyProtocol - name: v1beta2 + served: true + storage: false + schema: + openAPIV3Schema: + type: object + required: [spec] + properties: + spec: + type: object + required: + - port + oneOf: + - required: [podSelector] + - required: [externalWorkloadSelector] + properties: + podSelector: + type: object + description: >- + Selects pods in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + externalWorkloadSelector: + type: object + description: >- + Selects ExternalWorkloads in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + port: + description: >- + A port name or number. Must exist in a pod spec. + x-kubernetes-int-or-string: true + proxyProtocol: + description: >- + Configures protocol discovery for inbound connections. + + Supersedes the `config.linkerd.io/opaque-ports` annotation. + type: string + default: unknown + additionalPrinterColumns: + - name: Port + type: string + description: The port the server is listening on + jsonPath: .spec.port + - name: Protocol + type: string + description: The protocol of the server + jsonPath: .spec.proxyProtocol + - name: v1beta3 served: true storage: true schema: diff --git a/cli/cmd/testdata/install_helm_crds_output_ha.golden b/cli/cmd/testdata/install_helm_crds_output_ha.golden index 815cc363b8645..c1e73494e9d88 100644 --- a/cli/cmd/testdata/install_helm_crds_output_ha.golden +++ b/cli/cmd/testdata/install_helm_crds_output_ha.golden @@ -5978,6 +5978,94 @@ spec: description: The protocol of the server jsonPath: .spec.proxyProtocol - name: v1beta2 + served: true + storage: false + schema: + openAPIV3Schema: + type: object + required: [spec] + properties: + spec: + type: object + required: + - port + oneOf: + - required: [podSelector] + - required: [externalWorkloadSelector] + properties: + podSelector: + type: object + description: >- + Selects pods in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + externalWorkloadSelector: + type: object + description: >- + Selects ExternalWorkloads in the same namespace. + + The result of matchLabels and matchExpressions are ANDed. + Selects all if empty. + properties: + matchLabels: + type: object + x-kubernetes-preserve-unknown-fields: true + matchExpressions: + type: array + items: + type: object + required: [key, operator] + properties: + key: + type: string + operator: + type: string + enum: [In, NotIn, Exists, DoesNotExist] + values: + type: array + items: + type: string + port: + description: >- + A port name or number. Must exist in a pod spec. + x-kubernetes-int-or-string: true + proxyProtocol: + description: >- + Configures protocol discovery for inbound connections. + + Supersedes the `config.linkerd.io/opaque-ports` annotation. + type: string + default: unknown + additionalPrinterColumns: + - name: Port + type: string + description: The port the server is listening on + jsonPath: .spec.port + - name: Protocol + type: string + description: The protocol of the server + jsonPath: .spec.proxyProtocol + - name: v1beta3 served: true storage: true schema: diff --git a/controller/gen/apis/server/v1beta2/types.go b/controller/gen/apis/server/v1beta2/types.go index fa8c58dbd5af3..f27004fd6674f 100644 --- a/controller/gen/apis/server/v1beta2/types.go +++ b/controller/gen/apis/server/v1beta2/types.go @@ -29,7 +29,6 @@ type Server struct { // ServerSpec specifies a Server resource. type ServerSpec struct { - AccessPolicy string `json:"accessPolicy,omitempty"` PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"` ExternalWorkloadSelector *metav1.LabelSelector `json:"externalWorkloadSelector,omitempty"` Port intstr.IntOrString `json:"port,omitempty"` diff --git a/controller/gen/apis/server/v1beta3/doc.go b/controller/gen/apis/server/v1beta3/doc.go new file mode 100644 index 0000000000000..0eecc56c2e8f5 --- /dev/null +++ b/controller/gen/apis/server/v1beta3/doc.go @@ -0,0 +1,3 @@ +// +k8s:deepcopy-gen=package + +package v1beta3 diff --git a/controller/gen/apis/server/v1beta3/register.go b/controller/gen/apis/server/v1beta3/register.go new file mode 100644 index 0000000000000..82b647289011a --- /dev/null +++ b/controller/gen/apis/server/v1beta3/register.go @@ -0,0 +1,49 @@ +package v1beta3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/linkerd/linkerd2/controller/gen/apis/server" +) + +var ( + // SchemeGroupVersion is the identifier for the API which includes the name + // of the group and the version of the API. + SchemeGroupVersion = schema.GroupVersion{ + Group: server.GroupName, + Version: "v1beta3", + } + + // SchemeBuilder collects functions that add things to a scheme. It's to + // allow code to compile without explicitly referencing generated types. + // You should declare one in each package that will have generated deep + // copy or conversion functions. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + AddToScheme = SchemeBuilder.AddToScheme +) + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified +// GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Server{}, + &ServerList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/controller/gen/apis/server/v1beta3/types.go b/controller/gen/apis/server/v1beta3/types.go new file mode 100644 index 0000000000000..221671b7e70e2 --- /dev/null +++ b/controller/gen/apis/server/v1beta3/types.go @@ -0,0 +1,47 @@ +package v1beta3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +groupName=policy.linkerd.io + +type Server struct { + // TypeMeta is the metadata for the resource, like kind and apiversion + metav1.TypeMeta `json:",inline"` + + // ObjectMeta contains the metadata for the particular object, including + // things like... + // - name + // - namespace + // - self link + // - labels + // - ... etc ... + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the custom resource spec + Spec ServerSpec `json:"spec"` +} + +// ServerSpec specifies a Server resource. +type ServerSpec struct { + AccessPolicy string `json:"accessPolicy,omitempty"` + PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"` + ExternalWorkloadSelector *metav1.LabelSelector `json:"externalWorkloadSelector,omitempty"` + Port intstr.IntOrString `json:"port,omitempty"` + ProxyProtocol string `json:"proxyProtocol,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ServerList is a list of Server resources. +type ServerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Server `json:"items"` +} diff --git a/controller/gen/apis/server/v1beta3/zz_generated.deepcopy.go b/controller/gen/apis/server/v1beta3/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..42df854b3ff45 --- /dev/null +++ b/controller/gen/apis/server/v1beta3/zz_generated.deepcopy.go @@ -0,0 +1,114 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1beta3 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Server) DeepCopyInto(out *Server) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Server. +func (in *Server) DeepCopy() *Server { + if in == nil { + return nil + } + out := new(Server) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Server) 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 *ServerList) DeepCopyInto(out *ServerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Server, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerList. +func (in *ServerList) DeepCopy() *ServerList { + if in == nil { + return nil + } + out := new(ServerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServerList) 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 *ServerSpec) DeepCopyInto(out *ServerSpec) { + *out = *in + if in.PodSelector != nil { + in, out := &in.PodSelector, &out.PodSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.ExternalWorkloadSelector != nil { + in, out := &in.ExternalWorkloadSelector, &out.ExternalWorkloadSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + out.Port = in.Port + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerSpec. +func (in *ServerSpec) DeepCopy() *ServerSpec { + if in == nil { + return nil + } + out := new(ServerSpec) + in.DeepCopyInto(out) + return out +} diff --git a/controller/gen/client/clientset/versioned/clientset.go b/controller/gen/client/clientset/versioned/clientset.go index dad7724bf4a40..3705884643e53 100644 --- a/controller/gen/client/clientset/versioned/clientset.go +++ b/controller/gen/client/clientset/versioned/clientset.go @@ -28,6 +28,7 @@ import ( policyv1beta3 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/policy/v1beta3" serverv1beta1 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta1" serverv1beta2 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta2" + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta3" serverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/serverauthorization/v1beta1" linkerdv1alpha2 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/serviceprofile/v1alpha2" discovery "k8s.io/client-go/discovery" @@ -43,6 +44,7 @@ type Interface interface { PolicyV1beta3() policyv1beta3.PolicyV1beta3Interface ServerV1beta1() serverv1beta1.ServerV1beta1Interface ServerV1beta2() serverv1beta2.ServerV1beta2Interface + ServerV1beta3() serverv1beta3.ServerV1beta3Interface ServerauthorizationV1beta1() serverauthorizationv1beta1.ServerauthorizationV1beta1Interface LinkerdV1alpha2() linkerdv1alpha2.LinkerdV1alpha2Interface } @@ -56,6 +58,7 @@ type Clientset struct { policyV1beta3 *policyv1beta3.PolicyV1beta3Client serverV1beta1 *serverv1beta1.ServerV1beta1Client serverV1beta2 *serverv1beta2.ServerV1beta2Client + serverV1beta3 *serverv1beta3.ServerV1beta3Client serverauthorizationV1beta1 *serverauthorizationv1beta1.ServerauthorizationV1beta1Client linkerdV1alpha2 *linkerdv1alpha2.LinkerdV1alpha2Client } @@ -90,6 +93,11 @@ func (c *Clientset) ServerV1beta2() serverv1beta2.ServerV1beta2Interface { return c.serverV1beta2 } +// ServerV1beta3 retrieves the ServerV1beta3Client +func (c *Clientset) ServerV1beta3() serverv1beta3.ServerV1beta3Interface { + return c.serverV1beta3 +} + // ServerauthorizationV1beta1 retrieves the ServerauthorizationV1beta1Client func (c *Clientset) ServerauthorizationV1beta1() serverauthorizationv1beta1.ServerauthorizationV1beta1Interface { return c.serverauthorizationV1beta1 @@ -168,6 +176,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.serverV1beta3, err = serverv1beta3.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.serverauthorizationV1beta1, err = serverauthorizationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -203,6 +215,7 @@ func New(c rest.Interface) *Clientset { cs.policyV1beta3 = policyv1beta3.New(c) cs.serverV1beta1 = serverv1beta1.New(c) cs.serverV1beta2 = serverv1beta2.New(c) + cs.serverV1beta3 = serverv1beta3.New(c) cs.serverauthorizationV1beta1 = serverauthorizationv1beta1.New(c) cs.linkerdV1alpha2 = linkerdv1alpha2.New(c) diff --git a/controller/gen/client/clientset/versioned/fake/clientset_generated.go b/controller/gen/client/clientset/versioned/fake/clientset_generated.go index 07b93877a34d0..a0c6afd60d3ad 100644 --- a/controller/gen/client/clientset/versioned/fake/clientset_generated.go +++ b/controller/gen/client/clientset/versioned/fake/clientset_generated.go @@ -32,6 +32,8 @@ import ( fakeserverv1beta1 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta1/fake" serverv1beta2 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta2" fakeserverv1beta2 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta2/fake" + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta3" + fakeserverv1beta3 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake" serverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/serverauthorization/v1beta1" fakeserverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/serverauthorization/v1beta1/fake" linkerdv1alpha2 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/serviceprofile/v1alpha2" @@ -123,6 +125,11 @@ func (c *Clientset) ServerV1beta2() serverv1beta2.ServerV1beta2Interface { return &fakeserverv1beta2.FakeServerV1beta2{Fake: &c.Fake} } +// ServerV1beta3 retrieves the ServerV1beta3Client +func (c *Clientset) ServerV1beta3() serverv1beta3.ServerV1beta3Interface { + return &fakeserverv1beta3.FakeServerV1beta3{Fake: &c.Fake} +} + // ServerauthorizationV1beta1 retrieves the ServerauthorizationV1beta1Client func (c *Clientset) ServerauthorizationV1beta1() serverauthorizationv1beta1.ServerauthorizationV1beta1Interface { return &fakeserverauthorizationv1beta1.FakeServerauthorizationV1beta1{Fake: &c.Fake} diff --git a/controller/gen/client/clientset/versioned/fake/register.go b/controller/gen/client/clientset/versioned/fake/register.go index 8ebba89fbf10b..13a59e01c238f 100644 --- a/controller/gen/client/clientset/versioned/fake/register.go +++ b/controller/gen/client/clientset/versioned/fake/register.go @@ -25,6 +25,7 @@ import ( policyv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/policy/v1beta3" serverv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta1" serverv1beta2 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2" + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" serverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/serverauthorization/v1beta1" linkerdv1alpha2 "github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ policyv1beta3.AddToScheme, serverv1beta1.AddToScheme, serverv1beta2.AddToScheme, + serverv1beta3.AddToScheme, serverauthorizationv1beta1.AddToScheme, linkerdv1alpha2.AddToScheme, } diff --git a/controller/gen/client/clientset/versioned/scheme/register.go b/controller/gen/client/clientset/versioned/scheme/register.go index 0da750f799afb..28c8441d16c5b 100644 --- a/controller/gen/client/clientset/versioned/scheme/register.go +++ b/controller/gen/client/clientset/versioned/scheme/register.go @@ -25,6 +25,7 @@ import ( policyv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/policy/v1beta3" serverv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta1" serverv1beta2 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2" + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" serverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/serverauthorization/v1beta1" linkerdv1alpha2 "github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -44,6 +45,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ policyv1beta3.AddToScheme, serverv1beta1.AddToScheme, serverv1beta2.AddToScheme, + serverv1beta3.AddToScheme, serverauthorizationv1beta1.AddToScheme, linkerdv1alpha2.AddToScheme, } diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/doc.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/doc.go new file mode 100644 index 0000000000000..09b1d25b08584 --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1beta3 diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/doc.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/doc.go new file mode 100644 index 0000000000000..16f44399065ed --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server.go new file mode 100644 index 0000000000000..1c95745f363b8 --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server.go @@ -0,0 +1,129 @@ +/* +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" + + v1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeServers implements ServerInterface +type FakeServers struct { + Fake *FakeServerV1beta3 + ns string +} + +var serversResource = v1beta3.SchemeGroupVersion.WithResource("servers") + +var serversKind = v1beta3.SchemeGroupVersion.WithKind("Server") + +// Get takes name of the server, and returns the corresponding server object, and an error if there is any. +func (c *FakeServers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta3.Server, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(serversResource, c.ns, name), &v1beta3.Server{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta3.Server), err +} + +// List takes label and field selectors, and returns the list of Servers that match those selectors. +func (c *FakeServers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta3.ServerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(serversResource, serversKind, c.ns, opts), &v1beta3.ServerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta3.ServerList{ListMeta: obj.(*v1beta3.ServerList).ListMeta} + for _, item := range obj.(*v1beta3.ServerList).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 servers. +func (c *FakeServers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(serversResource, c.ns, opts)) + +} + +// Create takes the representation of a server and creates it. Returns the server's representation of the server, and an error, if there is any. +func (c *FakeServers) Create(ctx context.Context, server *v1beta3.Server, opts v1.CreateOptions) (result *v1beta3.Server, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(serversResource, c.ns, server), &v1beta3.Server{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta3.Server), err +} + +// Update takes the representation of a server and updates it. Returns the server's representation of the server, and an error, if there is any. +func (c *FakeServers) Update(ctx context.Context, server *v1beta3.Server, opts v1.UpdateOptions) (result *v1beta3.Server, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(serversResource, c.ns, server), &v1beta3.Server{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta3.Server), err +} + +// Delete takes name of the server and deletes it. Returns an error if one occurs. +func (c *FakeServers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(serversResource, c.ns, name, opts), &v1beta3.Server{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeServers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(serversResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1beta3.ServerList{}) + return err +} + +// Patch applies the patch and returns the patched server. +func (c *FakeServers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta3.Server, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(serversResource, c.ns, name, pt, data, subresources...), &v1beta3.Server{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta3.Server), err +} diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server_client.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server_client.go new file mode 100644 index 0000000000000..27b852b2690f0 --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/fake/fake_server_client.go @@ -0,0 +1,40 @@ +/* +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 ( + v1beta3 "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/typed/server/v1beta3" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeServerV1beta3 struct { + *testing.Fake +} + +func (c *FakeServerV1beta3) Servers(namespace string) v1beta3.ServerInterface { + return &FakeServers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeServerV1beta3) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/generated_expansion.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/generated_expansion.go new file mode 100644 index 0000000000000..ec1dcf5912df4 --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/generated_expansion.go @@ -0,0 +1,21 @@ +/* +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 v1beta3 + +type ServerExpansion interface{} diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/server.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/server.go new file mode 100644 index 0000000000000..19d5dee01605b --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/server.go @@ -0,0 +1,178 @@ +/* +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 v1beta3 + +import ( + "context" + "time" + + v1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" + scheme "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/scheme" + 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" +) + +// ServersGetter has a method to return a ServerInterface. +// A group's client should implement this interface. +type ServersGetter interface { + Servers(namespace string) ServerInterface +} + +// ServerInterface has methods to work with Server resources. +type ServerInterface interface { + Create(ctx context.Context, server *v1beta3.Server, opts v1.CreateOptions) (*v1beta3.Server, error) + Update(ctx context.Context, server *v1beta3.Server, opts v1.UpdateOptions) (*v1beta3.Server, 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) (*v1beta3.Server, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta3.ServerList, 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 *v1beta3.Server, err error) + ServerExpansion +} + +// servers implements ServerInterface +type servers struct { + client rest.Interface + ns string +} + +// newServers returns a Servers +func newServers(c *ServerV1beta3Client, namespace string) *servers { + return &servers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the server, and returns the corresponding server object, and an error if there is any. +func (c *servers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta3.Server, err error) { + result = &v1beta3.Server{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Servers that match those selectors. +func (c *servers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta3.ServerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta3.ServerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested servers. +func (c *servers) 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("servers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a server and creates it. Returns the server's representation of the server, and an error, if there is any. +func (c *servers) Create(ctx context.Context, server *v1beta3.Server, opts v1.CreateOptions) (result *v1beta3.Server, err error) { + result = &v1beta3.Server{} + err = c.client.Post(). + Namespace(c.ns). + Resource("servers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(server). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a server and updates it. Returns the server's representation of the server, and an error, if there is any. +func (c *servers) Update(ctx context.Context, server *v1beta3.Server, opts v1.UpdateOptions) (result *v1beta3.Server, err error) { + result = &v1beta3.Server{} + err = c.client.Put(). + Namespace(c.ns). + Resource("servers"). + Name(server.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(server). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the server and deletes it. Returns an error if one occurs. +func (c *servers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *servers) 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("servers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched server. +func (c *servers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta3.Server, err error) { + result = &v1beta3.Server{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("servers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/controller/gen/client/clientset/versioned/typed/server/v1beta3/server_client.go b/controller/gen/client/clientset/versioned/typed/server/v1beta3/server_client.go new file mode 100644 index 0000000000000..4cb4e684e597a --- /dev/null +++ b/controller/gen/client/clientset/versioned/typed/server/v1beta3/server_client.go @@ -0,0 +1,107 @@ +/* +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 v1beta3 + +import ( + "net/http" + + v1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" + "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type ServerV1beta3Interface interface { + RESTClient() rest.Interface + ServersGetter +} + +// ServerV1beta3Client is used to interact with features provided by the server group. +type ServerV1beta3Client struct { + restClient rest.Interface +} + +func (c *ServerV1beta3Client) Servers(namespace string) ServerInterface { + return newServers(c, namespace) +} + +// NewForConfig creates a new ServerV1beta3Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ServerV1beta3Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new ServerV1beta3Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ServerV1beta3Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &ServerV1beta3Client{client}, nil +} + +// NewForConfigOrDie creates a new ServerV1beta3Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ServerV1beta3Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ServerV1beta3Client for the given RESTClient. +func New(c rest.Interface) *ServerV1beta3Client { + return &ServerV1beta3Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta3.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ServerV1beta3Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/controller/gen/client/informers/externalversions/generic.go b/controller/gen/client/informers/externalversions/generic.go index 0a5bff745aeff..d9a60362ba1f3 100644 --- a/controller/gen/client/informers/externalversions/generic.go +++ b/controller/gen/client/informers/externalversions/generic.go @@ -27,6 +27,7 @@ import ( v1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/policy/v1beta3" serverv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta1" v1beta2 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2" + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" serverauthorizationv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/serverauthorization/v1beta1" v1alpha2 "github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -93,6 +94,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1beta2.SchemeGroupVersion.WithResource("servers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Server().V1beta2().Servers().Informer()}, nil + // Group=server, Version=v1beta3 + case serverv1beta3.SchemeGroupVersion.WithResource("servers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Server().V1beta3().Servers().Informer()}, nil + // Group=serverauthorization, Version=v1beta1 case serverauthorizationv1beta1.SchemeGroupVersion.WithResource("serverauthorizations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Serverauthorization().V1beta1().ServerAuthorizations().Informer()}, nil diff --git a/controller/gen/client/informers/externalversions/server/interface.go b/controller/gen/client/informers/externalversions/server/interface.go index 9e78a70b000a7..ccc393e0388f2 100644 --- a/controller/gen/client/informers/externalversions/server/interface.go +++ b/controller/gen/client/informers/externalversions/server/interface.go @@ -22,6 +22,7 @@ import ( internalinterfaces "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/internalinterfaces" v1beta1 "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/server/v1beta1" v1beta2 "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/server/v1beta2" + v1beta3 "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/server/v1beta3" ) // Interface provides access to each of this group's versions. @@ -30,6 +31,8 @@ type Interface interface { V1beta1() v1beta1.Interface // V1beta2 provides access to shared informers for resources in V1beta2. V1beta2() v1beta2.Interface + // V1beta3 provides access to shared informers for resources in V1beta3. + V1beta3() v1beta3.Interface } type group struct { @@ -52,3 +55,8 @@ func (g *group) V1beta1() v1beta1.Interface { func (g *group) V1beta2() v1beta2.Interface { return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1beta3 returns a new v1beta3.Interface. +func (g *group) V1beta3() v1beta3.Interface { + return v1beta3.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/controller/gen/client/informers/externalversions/server/v1beta3/interface.go b/controller/gen/client/informers/externalversions/server/v1beta3/interface.go new file mode 100644 index 0000000000000..042209931703b --- /dev/null +++ b/controller/gen/client/informers/externalversions/server/v1beta3/interface.go @@ -0,0 +1,45 @@ +/* +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 v1beta3 + +import ( + internalinterfaces "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Servers returns a ServerInformer. + Servers() ServerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Servers returns a ServerInformer. +func (v *version) Servers() ServerInformer { + return &serverInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/controller/gen/client/informers/externalversions/server/v1beta3/server.go b/controller/gen/client/informers/externalversions/server/v1beta3/server.go new file mode 100644 index 0000000000000..b722d04eab3ad --- /dev/null +++ b/controller/gen/client/informers/externalversions/server/v1beta3/server.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta3 + +import ( + "context" + time "time" + + serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" + versioned "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned" + internalinterfaces "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/internalinterfaces" + v1beta3 "github.com/linkerd/linkerd2/controller/gen/client/listers/server/v1beta3" + 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" +) + +// ServerInformer provides access to a shared informer and lister for +// Servers. +type ServerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta3.ServerLister +} + +type serverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServerInformer constructs a new informer for Server 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 NewServerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServerInformer constructs a new informer for Server 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 NewFilteredServerInformer(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.ServerV1beta3().Servers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ServerV1beta3().Servers(namespace).Watch(context.TODO(), options) + }, + }, + &serverv1beta3.Server{}, + resyncPeriod, + indexers, + ) +} + +func (f *serverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&serverv1beta3.Server{}, f.defaultInformer) +} + +func (f *serverInformer) Lister() v1beta3.ServerLister { + return v1beta3.NewServerLister(f.Informer().GetIndexer()) +} diff --git a/controller/gen/client/listers/server/v1beta3/expansion_generated.go b/controller/gen/client/listers/server/v1beta3/expansion_generated.go new file mode 100644 index 0000000000000..62873d13ecfe1 --- /dev/null +++ b/controller/gen/client/listers/server/v1beta3/expansion_generated.go @@ -0,0 +1,27 @@ +/* +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 v1beta3 + +// ServerListerExpansion allows custom methods to be added to +// ServerLister. +type ServerListerExpansion interface{} + +// ServerNamespaceListerExpansion allows custom methods to be added to +// ServerNamespaceLister. +type ServerNamespaceListerExpansion interface{} diff --git a/controller/gen/client/listers/server/v1beta3/server.go b/controller/gen/client/listers/server/v1beta3/server.go new file mode 100644 index 0000000000000..a794c4d19e72c --- /dev/null +++ b/controller/gen/client/listers/server/v1beta3/server.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta3 + +import ( + v1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServerLister helps list Servers. +// All objects returned here must be treated as read-only. +type ServerLister interface { + // List lists all Servers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta3.Server, err error) + // Servers returns an object that can list and get Servers. + Servers(namespace string) ServerNamespaceLister + ServerListerExpansion +} + +// serverLister implements the ServerLister interface. +type serverLister struct { + indexer cache.Indexer +} + +// NewServerLister returns a new ServerLister. +func NewServerLister(indexer cache.Indexer) ServerLister { + return &serverLister{indexer: indexer} +} + +// List lists all Servers in the indexer. +func (s *serverLister) List(selector labels.Selector) (ret []*v1beta3.Server, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta3.Server)) + }) + return ret, err +} + +// Servers returns an object that can list and get Servers. +func (s *serverLister) Servers(namespace string) ServerNamespaceLister { + return serverNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServerNamespaceLister helps list and get Servers. +// All objects returned here must be treated as read-only. +type ServerNamespaceLister interface { + // List lists all Servers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta3.Server, err error) + // Get retrieves the Server from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta3.Server, error) + ServerNamespaceListerExpansion +} + +// serverNamespaceLister implements the ServerNamespaceLister +// interface. +type serverNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Servers in the indexer for a given namespace. +func (s serverNamespaceLister) List(selector labels.Selector) (ret []*v1beta3.Server, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta3.Server)) + }) + return ret, err +} + +// Get retrieves the Server from the indexer for a given namespace and name. +func (s serverNamespaceLister) Get(name string) (*v1beta3.Server, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta3.Resource("server"), name) + } + return obj.(*v1beta3.Server), nil +}