From 092a109b2b108d1418b3a6fcea1ea217387b6539 Mon Sep 17 00:00:00 2001 From: Sarvesh Rangnekar Date: Wed, 30 Mar 2022 19:39:00 -0700 Subject: [PATCH] Introduce APIs to support multiple ClusterCIDRs (#108290) * Introduce networking/v1alpha1 api, ClusterCIDRConfig type Introduce networking/v1alpha1 api group. Add `ClusterCIDRConfig` type to networking/v1alpha1 api group, this type will enable the NodeIPAM controller to support multiple ClusterCIDRs. * Change ClusterCIDRConfig.NodeSelector type in api * Fix review comments for API * Update ClusterCIDRConfig API Spec Introduce PerNodeHostBits field, remove PerNodeMaskSize Kubernetes-commit: b9792a9daef4d978c5c30b6d10cbcdfa77a9b6ac --- applyconfigurations/internal/internal.go | 51 ++++ applyconfigurations/meta/v1/listmeta.go | 66 +++++ .../networking/v1alpha1/cidrconfig.go | 48 ++++ .../networking/v1alpha1/clustercidrconfig.go | 256 ++++++++++++++++++ .../v1alpha1/clustercidrconfigspec.go | 70 +++++ .../v1alpha1/clustercidrconfigstatus.go | 48 ++++ applyconfigurations/utils.go | 8 + go.mod | 4 +- go.sum | 4 +- informers/generic.go | 5 + informers/networking/interface.go | 8 + .../networking/v1alpha1/clustercidrconfig.go | 89 ++++++ informers/networking/v1alpha1/interface.go | 45 +++ kubernetes/clientset.go | 13 + kubernetes/fake/clientset_generated.go | 7 + kubernetes/fake/register.go | 2 + kubernetes/scheme/register.go | 2 + .../networking/v1alpha1/clustercidrconfig.go | 243 +++++++++++++++++ kubernetes/typed/networking/v1alpha1/doc.go | 20 ++ .../typed/networking/v1alpha1/fake/doc.go | 20 ++ .../v1alpha1/fake/fake_clustercidrconfig.go | 179 ++++++++++++ .../v1alpha1/fake/fake_networking_client.go | 40 +++ .../v1alpha1/generated_expansion.go | 21 ++ .../networking/v1alpha1/networking_client.go | 107 ++++++++ .../networking/v1alpha1/clustercidrconfig.go | 68 +++++ .../v1alpha1/expansion_generated.go | 23 ++ 26 files changed, 1443 insertions(+), 4 deletions(-) create mode 100644 applyconfigurations/meta/v1/listmeta.go create mode 100644 applyconfigurations/networking/v1alpha1/cidrconfig.go create mode 100644 applyconfigurations/networking/v1alpha1/clustercidrconfig.go create mode 100644 applyconfigurations/networking/v1alpha1/clustercidrconfigspec.go create mode 100644 applyconfigurations/networking/v1alpha1/clustercidrconfigstatus.go create mode 100644 informers/networking/v1alpha1/clustercidrconfig.go create mode 100644 informers/networking/v1alpha1/interface.go create mode 100644 kubernetes/typed/networking/v1alpha1/clustercidrconfig.go create mode 100644 kubernetes/typed/networking/v1alpha1/doc.go create mode 100644 kubernetes/typed/networking/v1alpha1/fake/doc.go create mode 100644 kubernetes/typed/networking/v1alpha1/fake/fake_clustercidrconfig.go create mode 100644 kubernetes/typed/networking/v1alpha1/fake/fake_networking_client.go create mode 100644 kubernetes/typed/networking/v1alpha1/generated_expansion.go create mode 100644 kubernetes/typed/networking/v1alpha1/networking_client.go create mode 100644 listers/networking/v1alpha1/clustercidrconfig.go create mode 100644 listers/networking/v1alpha1/expansion_generated.go diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index df8cc0f8..4d6112f3 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -9531,6 +9531,57 @@ var schemaYAML = typed.YAMLObject(`types: - name: number type: scalar: numeric +- name: io.k8s.api.networking.v1alpha1.ClusterCIDRConfig + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.networking.v1alpha1.ClusterCIDRConfigSpec + default: {} + - name: status + type: + namedType: io.k8s.api.networking.v1alpha1.ClusterCIDRConfigStatus + default: {} +- name: io.k8s.api.networking.v1alpha1.ClusterCIDRConfigSpec + map: + fields: + - name: ipv4CIDR + type: + scalar: string + default: "" + - name: ipv6CIDR + type: + scalar: string + default: "" + - name: nodeSelector + type: + namedType: io.k8s.api.core.v1.NodeSelector + - name: perNodeHostBits + type: + scalar: numeric + default: 0 +- name: io.k8s.api.networking.v1alpha1.ClusterCIDRConfigStatus + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable - name: io.k8s.api.networking.v1beta1.HTTPIngressPath map: fields: diff --git a/applyconfigurations/meta/v1/listmeta.go b/applyconfigurations/meta/v1/listmeta.go new file mode 100644 index 00000000..5cadee33 --- /dev/null +++ b/applyconfigurations/meta/v1/listmeta.go @@ -0,0 +1,66 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ListMetaApplyConfiguration represents an declarative configuration of the ListMeta type for use +// with apply. +type ListMetaApplyConfiguration struct { + SelfLink *string `json:"selfLink,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` + Continue *string `json:"continue,omitempty"` + RemainingItemCount *int64 `json:"remainingItemCount,omitempty"` +} + +// ListMetaApplyConfiguration constructs an declarative configuration of the ListMeta type for use with +// apply. +func ListMeta() *ListMetaApplyConfiguration { + return &ListMetaApplyConfiguration{} +} + +// WithSelfLink sets the SelfLink field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SelfLink field is set to the value of the last call. +func (b *ListMetaApplyConfiguration) WithSelfLink(value string) *ListMetaApplyConfiguration { + b.SelfLink = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ListMetaApplyConfiguration) WithResourceVersion(value string) *ListMetaApplyConfiguration { + b.ResourceVersion = &value + return b +} + +// WithContinue sets the Continue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Continue field is set to the value of the last call. +func (b *ListMetaApplyConfiguration) WithContinue(value string) *ListMetaApplyConfiguration { + b.Continue = &value + return b +} + +// WithRemainingItemCount sets the RemainingItemCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RemainingItemCount field is set to the value of the last call. +func (b *ListMetaApplyConfiguration) WithRemainingItemCount(value int64) *ListMetaApplyConfiguration { + b.RemainingItemCount = &value + return b +} diff --git a/applyconfigurations/networking/v1alpha1/cidrconfig.go b/applyconfigurations/networking/v1alpha1/cidrconfig.go new file mode 100644 index 00000000..2f792bb4 --- /dev/null +++ b/applyconfigurations/networking/v1alpha1/cidrconfig.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// CIDRConfigApplyConfiguration represents an declarative configuration of the CIDRConfig type for use +// with apply. +type CIDRConfigApplyConfiguration struct { + CIDR *string `json:"cidr,omitempty"` + PerNodeMaskSize *int32 `json:"perNodeMaskSize,omitempty"` +} + +// CIDRConfigApplyConfiguration constructs an declarative configuration of the CIDRConfig type for use with +// apply. +func CIDRConfig() *CIDRConfigApplyConfiguration { + return &CIDRConfigApplyConfiguration{} +} + +// WithCIDR sets the CIDR field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CIDR field is set to the value of the last call. +func (b *CIDRConfigApplyConfiguration) WithCIDR(value string) *CIDRConfigApplyConfiguration { + b.CIDR = &value + return b +} + +// WithPerNodeMaskSize sets the PerNodeMaskSize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PerNodeMaskSize field is set to the value of the last call. +func (b *CIDRConfigApplyConfiguration) WithPerNodeMaskSize(value int32) *CIDRConfigApplyConfiguration { + b.PerNodeMaskSize = &value + return b +} diff --git a/applyconfigurations/networking/v1alpha1/clustercidrconfig.go b/applyconfigurations/networking/v1alpha1/clustercidrconfig.go new file mode 100644 index 00000000..ce7e4a72 --- /dev/null +++ b/applyconfigurations/networking/v1alpha1/clustercidrconfig.go @@ -0,0 +1,256 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterCIDRConfigApplyConfiguration represents an declarative configuration of the ClusterCIDRConfig type for use +// with apply. +type ClusterCIDRConfigApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ClusterCIDRConfigSpecApplyConfiguration `json:"spec,omitempty"` + Status *networkingv1alpha1.ClusterCIDRConfigStatus `json:"status,omitempty"` +} + +// ClusterCIDRConfig constructs an declarative configuration of the ClusterCIDRConfig type for use with +// apply. +func ClusterCIDRConfig(name string) *ClusterCIDRConfigApplyConfiguration { + b := &ClusterCIDRConfigApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterCIDRConfig") + b.WithAPIVersion("networking.k8s.io/v1alpha1") + return b +} + +// ExtractClusterCIDRConfig extracts the applied configuration owned by fieldManager from +// clusterCIDRConfig. If no managedFields are found in clusterCIDRConfig for fieldManager, a +// ClusterCIDRConfigApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// clusterCIDRConfig must be a unmodified ClusterCIDRConfig API object that was retrieved from the Kubernetes API. +// ExtractClusterCIDRConfig provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractClusterCIDRConfig(clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfig, fieldManager string) (*ClusterCIDRConfigApplyConfiguration, error) { + return extractClusterCIDRConfig(clusterCIDRConfig, fieldManager, "") +} + +// ExtractClusterCIDRConfigStatus is the same as ExtractClusterCIDRConfig except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterCIDRConfigStatus(clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfig, fieldManager string) (*ClusterCIDRConfigApplyConfiguration, error) { + return extractClusterCIDRConfig(clusterCIDRConfig, fieldManager, "status") +} + +func extractClusterCIDRConfig(clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfig, fieldManager string, subresource string) (*ClusterCIDRConfigApplyConfiguration, error) { + b := &ClusterCIDRConfigApplyConfiguration{} + err := managedfields.ExtractInto(clusterCIDRConfig, internal.Parser().Type("io.k8s.api.networking.v1alpha1.ClusterCIDRConfig"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(clusterCIDRConfig.Name) + + b.WithKind("ClusterCIDRConfig") + b.WithAPIVersion("networking.k8s.io/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithKind(value string) *ClusterCIDRConfigApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithAPIVersion(value string) *ClusterCIDRConfigApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithName(value string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithGenerateName(value string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithNamespace(value string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithUID(value types.UID) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithResourceVersion(value string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithGeneration(value int64) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterCIDRConfigApplyConfiguration) WithLabels(entries map[string]string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterCIDRConfigApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterCIDRConfigApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterCIDRConfigApplyConfiguration) WithFinalizers(values ...string) *ClusterCIDRConfigApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterCIDRConfigApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithSpec(value *ClusterCIDRConfigSpecApplyConfiguration) *ClusterCIDRConfigApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ClusterCIDRConfigApplyConfiguration) WithStatus(value networkingv1alpha1.ClusterCIDRConfigStatus) *ClusterCIDRConfigApplyConfiguration { + b.Status = &value + return b +} diff --git a/applyconfigurations/networking/v1alpha1/clustercidrconfigspec.go b/applyconfigurations/networking/v1alpha1/clustercidrconfigspec.go new file mode 100644 index 00000000..8553a918 --- /dev/null +++ b/applyconfigurations/networking/v1alpha1/clustercidrconfigspec.go @@ -0,0 +1,70 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/core/v1" +) + +// ClusterCIDRConfigSpecApplyConfiguration represents an declarative configuration of the ClusterCIDRConfigSpec type for use +// with apply. +type ClusterCIDRConfigSpecApplyConfiguration struct { + NodeSelector *v1.NodeSelectorApplyConfiguration `json:"nodeSelector,omitempty"` + PerNodeHostBits *int32 `json:"perNodeHostBits,omitempty"` + IPv4CIDR *string `json:"ipv4CIDR,omitempty"` + IPv6CIDR *string `json:"ipv6CIDR,omitempty"` +} + +// ClusterCIDRConfigSpecApplyConfiguration constructs an declarative configuration of the ClusterCIDRConfigSpec type for use with +// apply. +func ClusterCIDRConfigSpec() *ClusterCIDRConfigSpecApplyConfiguration { + return &ClusterCIDRConfigSpecApplyConfiguration{} +} + +// WithNodeSelector sets the NodeSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeSelector field is set to the value of the last call. +func (b *ClusterCIDRConfigSpecApplyConfiguration) WithNodeSelector(value *v1.NodeSelectorApplyConfiguration) *ClusterCIDRConfigSpecApplyConfiguration { + b.NodeSelector = value + return b +} + +// WithPerNodeHostBits sets the PerNodeHostBits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PerNodeHostBits field is set to the value of the last call. +func (b *ClusterCIDRConfigSpecApplyConfiguration) WithPerNodeHostBits(value int32) *ClusterCIDRConfigSpecApplyConfiguration { + b.PerNodeHostBits = &value + return b +} + +// WithIPv4CIDR sets the IPv4CIDR field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPv4CIDR field is set to the value of the last call. +func (b *ClusterCIDRConfigSpecApplyConfiguration) WithIPv4CIDR(value string) *ClusterCIDRConfigSpecApplyConfiguration { + b.IPv4CIDR = &value + return b +} + +// WithIPv6CIDR sets the IPv6CIDR field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPv6CIDR field is set to the value of the last call. +func (b *ClusterCIDRConfigSpecApplyConfiguration) WithIPv6CIDR(value string) *ClusterCIDRConfigSpecApplyConfiguration { + b.IPv6CIDR = &value + return b +} diff --git a/applyconfigurations/networking/v1alpha1/clustercidrconfigstatus.go b/applyconfigurations/networking/v1alpha1/clustercidrconfigstatus.go new file mode 100644 index 00000000..4b0cda22 --- /dev/null +++ b/applyconfigurations/networking/v1alpha1/clustercidrconfigstatus.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterCIDRConfigStatusApplyConfiguration represents an declarative configuration of the ClusterCIDRConfigStatus type for use +// with apply. +type ClusterCIDRConfigStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ClusterCIDRConfigStatusApplyConfiguration constructs an declarative configuration of the ClusterCIDRConfigStatus type for use with +// apply. +func ClusterCIDRConfigStatus() *ClusterCIDRConfigStatusApplyConfiguration { + return &ClusterCIDRConfigStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ClusterCIDRConfigStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ClusterCIDRConfigStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index 90f3ae71..c59f58be 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -46,6 +46,7 @@ import ( flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" imagepolicyv1alpha1 "k8s.io/api/imagepolicy/v1alpha1" networkingv1 "k8s.io/api/networking/v1" + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" @@ -91,6 +92,7 @@ import ( applyconfigurationsimagepolicyv1alpha1 "k8s.io/client-go/applyconfigurations/imagepolicy/v1alpha1" applyconfigurationsmetav1 "k8s.io/client-go/applyconfigurations/meta/v1" applyconfigurationsnetworkingv1 "k8s.io/client-go/applyconfigurations/networking/v1" + applyconfigurationsnetworkingv1alpha1 "k8s.io/client-go/applyconfigurations/networking/v1alpha1" applyconfigurationsnetworkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1" applyconfigurationsnodev1 "k8s.io/client-go/applyconfigurations/node/v1" applyconfigurationsnodev1alpha1 "k8s.io/client-go/applyconfigurations/node/v1alpha1" @@ -1200,6 +1202,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case networkingv1.SchemeGroupVersion.WithKind("ServiceBackendPort"): return &applyconfigurationsnetworkingv1.ServiceBackendPortApplyConfiguration{} + // Group=networking.k8s.io, Version=v1alpha1 + case networkingv1alpha1.SchemeGroupVersion.WithKind("ClusterCIDRConfig"): + return &applyconfigurationsnetworkingv1alpha1.ClusterCIDRConfigApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("ClusterCIDRConfigSpec"): + return &applyconfigurationsnetworkingv1alpha1.ClusterCIDRConfigSpecApplyConfiguration{} + // Group=networking.k8s.io, Version=v1beta1 case networkingv1beta1.SchemeGroupVersion.WithKind("HTTPIngressPath"): return &applyconfigurationsnetworkingv1beta1.HTTPIngressPathApplyConfiguration{} diff --git a/go.mod b/go.mod index 5f199e7e..c7cf4499 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 google.golang.org/protobuf v1.27.1 - k8s.io/api v0.0.0-20220330051021-b754a94214be + k8s.io/api v0.0.0-20220331051217-290a349b5385 k8s.io/apimachinery v0.0.0-20220330050810-6550efdb7444 k8s.io/klog/v2 v2.60.1 k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 @@ -44,6 +44,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20220330051021-b754a94214be + k8s.io/api => k8s.io/api v0.0.0-20220331051217-290a349b5385 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220330050810-6550efdb7444 ) diff --git a/go.sum b/go.sum index 2a8ac9fe..815f19ee 100644 --- a/go.sum +++ b/go.sum @@ -628,8 +628,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20220330051021-b754a94214be h1:UnXBdsSVy3e2Y6cyf9rVmzn0wPXyoUuGIZAM43vdTj0= -k8s.io/api v0.0.0-20220330051021-b754a94214be/go.mod h1:gL+2VXubbVTH6gK18uLau2gxoDmu43bdiQmz5TTa3zw= +k8s.io/api v0.0.0-20220331051217-290a349b5385 h1:f+qAtGb6ikFhuwOgV62s33+xw7QCi0hrywLfkBtCVRw= +k8s.io/api v0.0.0-20220331051217-290a349b5385/go.mod h1:69QWTzqWVlGn0rU+x3dmk3WAsUQHmeQwIBWMbK1ZEyE= k8s.io/apimachinery v0.0.0-20220330050810-6550efdb7444 h1:whQmS3GtF822OUer+LPJnMFKn6kPfuJOCM/3xUuATIY= k8s.io/apimachinery v0.0.0-20220330050810-6550efdb7444/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= diff --git a/informers/generic.go b/informers/generic.go index 4c2e53c2..3785f176 100644 --- a/informers/generic.go +++ b/informers/generic.go @@ -47,6 +47,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" networkingv1 "k8s.io/api/networking/v1" + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" @@ -272,6 +273,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil + // Group=networking.k8s.io, Version=v1alpha1 + case networkingv1alpha1.SchemeGroupVersion.WithResource("clustercidrconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().ClusterCIDRConfigs().Informer()}, nil + // Group=networking.k8s.io, Version=v1beta1 case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil diff --git a/informers/networking/interface.go b/informers/networking/interface.go index 4a028d5d..1c775c46 100644 --- a/informers/networking/interface.go +++ b/informers/networking/interface.go @@ -21,6 +21,7 @@ package networking import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" v1 "k8s.io/client-go/informers/networking/v1" + v1alpha1 "k8s.io/client-go/informers/networking/v1alpha1" v1beta1 "k8s.io/client-go/informers/networking/v1beta1" ) @@ -28,6 +29,8 @@ import ( type Interface interface { // V1 provides access to shared informers for resources in V1. V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -48,6 +51,11 @@ func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/informers/networking/v1alpha1/clustercidrconfig.go b/informers/networking/v1alpha1/clustercidrconfig.go new file mode 100644 index 00000000..9e3e774c --- /dev/null +++ b/informers/networking/v1alpha1/clustercidrconfig.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/networking/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterCIDRConfigInformer provides access to a shared informer and lister for +// ClusterCIDRConfigs. +type ClusterCIDRConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterCIDRConfigLister +} + +type clusterCIDRConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterCIDRConfigInformer constructs a new informer for ClusterCIDRConfig 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 NewClusterCIDRConfigInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterCIDRConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterCIDRConfigInformer constructs a new informer for ClusterCIDRConfig 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 NewFilteredClusterCIDRConfigInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().ClusterCIDRConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().ClusterCIDRConfigs().Watch(context.TODO(), options) + }, + }, + &networkingv1alpha1.ClusterCIDRConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterCIDRConfigInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterCIDRConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterCIDRConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1alpha1.ClusterCIDRConfig{}, f.defaultInformer) +} + +func (f *clusterCIDRConfigInformer) Lister() v1alpha1.ClusterCIDRConfigLister { + return v1alpha1.NewClusterCIDRConfigLister(f.Informer().GetIndexer()) +} diff --git a/informers/networking/v1alpha1/interface.go b/informers/networking/v1alpha1/interface.go new file mode 100644 index 00000000..da6eae1d --- /dev/null +++ b/informers/networking/v1alpha1/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 v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterCIDRConfigs returns a ClusterCIDRConfigInformer. + ClusterCIDRConfigs() ClusterCIDRConfigInformer +} + +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} +} + +// ClusterCIDRConfigs returns a ClusterCIDRConfigInformer. +func (v *version) ClusterCIDRConfigs() ClusterCIDRConfigInformer { + return &clusterCIDRConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/kubernetes/clientset.go b/kubernetes/clientset.go index e46c0537..0ea0c3c4 100644 --- a/kubernetes/clientset.go +++ b/kubernetes/clientset.go @@ -53,6 +53,7 @@ import ( flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" + networkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" nodev1 "k8s.io/client-go/kubernetes/typed/node/v1" nodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" @@ -104,6 +105,7 @@ type Interface interface { FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface NetworkingV1() networkingv1.NetworkingV1Interface + NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface NodeV1() nodev1.NodeV1Interface NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface @@ -155,6 +157,7 @@ type Clientset struct { flowcontrolV1beta1 *flowcontrolv1beta1.FlowcontrolV1beta1Client flowcontrolV1beta2 *flowcontrolv1beta2.FlowcontrolV1beta2Client networkingV1 *networkingv1.NetworkingV1Client + networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client nodeV1 *nodev1.NodeV1Client nodeV1alpha1 *nodev1alpha1.NodeV1alpha1Client @@ -322,6 +325,11 @@ func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return c.networkingV1 } +// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client +func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { + return c.networkingV1alpha1 +} + // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return c.networkingV1beta1 @@ -561,6 +569,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.networkingV1alpha1, err = networkingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.networkingV1beta1, err = networkingv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -672,6 +684,7 @@ func New(c rest.Interface) *Clientset { cs.flowcontrolV1beta1 = flowcontrolv1beta1.New(c) cs.flowcontrolV1beta2 = flowcontrolv1beta2.New(c) cs.networkingV1 = networkingv1.New(c) + cs.networkingV1alpha1 = networkingv1alpha1.New(c) cs.networkingV1beta1 = networkingv1beta1.New(c) cs.nodeV1 = nodev1.New(c) cs.nodeV1alpha1 = nodev1alpha1.New(c) diff --git a/kubernetes/fake/clientset_generated.go b/kubernetes/fake/clientset_generated.go index 9ab84ff5..3e468bf9 100644 --- a/kubernetes/fake/clientset_generated.go +++ b/kubernetes/fake/clientset_generated.go @@ -84,6 +84,8 @@ import ( fakeflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake" networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake" + networkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" + fakenetworkingv1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1/fake" networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" fakenetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake" nodev1 "k8s.io/client-go/kubernetes/typed/node/v1" @@ -317,6 +319,11 @@ func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake} } +// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client +func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { + return &fakenetworkingv1alpha1.FakeNetworkingV1alpha1{Fake: &c.Fake} +} + // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake} diff --git a/kubernetes/fake/register.go b/kubernetes/fake/register.go index c3f0a3d5..95c6b74d 100644 --- a/kubernetes/fake/register.go +++ b/kubernetes/fake/register.go @@ -49,6 +49,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" networkingv1 "k8s.io/api/networking/v1" + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" @@ -105,6 +106,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, networkingv1.AddToScheme, + networkingv1alpha1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, nodev1alpha1.AddToScheme, diff --git a/kubernetes/scheme/register.go b/kubernetes/scheme/register.go index b4146615..b4eaeccd 100644 --- a/kubernetes/scheme/register.go +++ b/kubernetes/scheme/register.go @@ -49,6 +49,7 @@ import ( flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" networkingv1 "k8s.io/api/networking/v1" + networkingv1alpha1 "k8s.io/api/networking/v1alpha1" networkingv1beta1 "k8s.io/api/networking/v1beta1" nodev1 "k8s.io/api/node/v1" nodev1alpha1 "k8s.io/api/node/v1alpha1" @@ -105,6 +106,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ flowcontrolv1beta1.AddToScheme, flowcontrolv1beta2.AddToScheme, networkingv1.AddToScheme, + networkingv1alpha1.AddToScheme, networkingv1beta1.AddToScheme, nodev1.AddToScheme, nodev1alpha1.AddToScheme, diff --git a/kubernetes/typed/networking/v1alpha1/clustercidrconfig.go b/kubernetes/typed/networking/v1alpha1/clustercidrconfig.go new file mode 100644 index 00000000..5dea6c42 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/clustercidrconfig.go @@ -0,0 +1,243 @@ +/* +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 v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1alpha1 "k8s.io/api/networking/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + networkingv1alpha1 "k8s.io/client-go/applyconfigurations/networking/v1alpha1" + scheme "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +// ClusterCIDRConfigsGetter has a method to return a ClusterCIDRConfigInterface. +// A group's client should implement this interface. +type ClusterCIDRConfigsGetter interface { + ClusterCIDRConfigs() ClusterCIDRConfigInterface +} + +// ClusterCIDRConfigInterface has methods to work with ClusterCIDRConfig resources. +type ClusterCIDRConfigInterface interface { + Create(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.CreateOptions) (*v1alpha1.ClusterCIDRConfig, error) + Update(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (*v1alpha1.ClusterCIDRConfig, error) + UpdateStatus(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (*v1alpha1.ClusterCIDRConfig, 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) (*v1alpha1.ClusterCIDRConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterCIDRConfigList, 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 *v1alpha1.ClusterCIDRConfig, err error) + Apply(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) + ApplyStatus(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) + ClusterCIDRConfigExpansion +} + +// clusterCIDRConfigs implements ClusterCIDRConfigInterface +type clusterCIDRConfigs struct { + client rest.Interface +} + +// newClusterCIDRConfigs returns a ClusterCIDRConfigs +func newClusterCIDRConfigs(c *NetworkingV1alpha1Client) *clusterCIDRConfigs { + return &clusterCIDRConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterCIDRConfig, and returns the corresponding clusterCIDRConfig object, and an error if there is any. +func (c *clusterCIDRConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Get(). + Resource("clustercidrconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterCIDRConfigs that match those selectors. +func (c *clusterCIDRConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterCIDRConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ClusterCIDRConfigList{} + err = c.client.Get(). + Resource("clustercidrconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterCIDRConfigs. +func (c *clusterCIDRConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clustercidrconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterCIDRConfig and creates it. Returns the server's representation of the clusterCIDRConfig, and an error, if there is any. +func (c *clusterCIDRConfigs) Create(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.CreateOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Post(). + Resource("clustercidrconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterCIDRConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterCIDRConfig and updates it. Returns the server's representation of the clusterCIDRConfig, and an error, if there is any. +func (c *clusterCIDRConfigs) Update(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Put(). + Resource("clustercidrconfigs"). + Name(clusterCIDRConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterCIDRConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *clusterCIDRConfigs) UpdateStatus(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Put(). + Resource("clustercidrconfigs"). + Name(clusterCIDRConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterCIDRConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterCIDRConfig and deletes it. Returns an error if one occurs. +func (c *clusterCIDRConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clustercidrconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterCIDRConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clustercidrconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterCIDRConfig. +func (c *clusterCIDRConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterCIDRConfig, err error) { + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Patch(pt). + Resource("clustercidrconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterCIDRConfig. +func (c *clusterCIDRConfigs) Apply(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + if clusterCIDRConfig == nil { + return nil, fmt.Errorf("clusterCIDRConfig provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(clusterCIDRConfig) + if err != nil { + return nil, err + } + name := clusterCIDRConfig.Name + if name == nil { + return nil, fmt.Errorf("clusterCIDRConfig.Name must be provided to Apply") + } + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Patch(types.ApplyPatchType). + Resource("clustercidrconfigs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *clusterCIDRConfigs) ApplyStatus(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + if clusterCIDRConfig == nil { + return nil, fmt.Errorf("clusterCIDRConfig provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(clusterCIDRConfig) + if err != nil { + return nil, err + } + + name := clusterCIDRConfig.Name + if name == nil { + return nil, fmt.Errorf("clusterCIDRConfig.Name must be provided to Apply") + } + + result = &v1alpha1.ClusterCIDRConfig{} + err = c.client.Patch(types.ApplyPatchType). + Resource("clustercidrconfigs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/networking/v1alpha1/doc.go b/kubernetes/typed/networking/v1alpha1/doc.go new file mode 100644 index 00000000..df51baa4 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/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 v1alpha1 diff --git a/kubernetes/typed/networking/v1alpha1/fake/doc.go b/kubernetes/typed/networking/v1alpha1/fake/doc.go new file mode 100644 index 00000000..16f44399 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/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/kubernetes/typed/networking/v1alpha1/fake/fake_clustercidrconfig.go b/kubernetes/typed/networking/v1alpha1/fake/fake_clustercidrconfig.go new file mode 100644 index 00000000..5efeec7c --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/fake/fake_clustercidrconfig.go @@ -0,0 +1,179 @@ +/* +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" + json "encoding/json" + "fmt" + + v1alpha1 "k8s.io/api/networking/v1alpha1" + 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" + networkingv1alpha1 "k8s.io/client-go/applyconfigurations/networking/v1alpha1" + testing "k8s.io/client-go/testing" +) + +// FakeClusterCIDRConfigs implements ClusterCIDRConfigInterface +type FakeClusterCIDRConfigs struct { + Fake *FakeNetworkingV1alpha1 +} + +var clustercidrconfigsResource = schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1alpha1", Resource: "clustercidrconfigs"} + +var clustercidrconfigsKind = schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1alpha1", Kind: "ClusterCIDRConfig"} + +// Get takes name of the clusterCIDRConfig, and returns the corresponding clusterCIDRConfig object, and an error if there is any. +func (c *FakeClusterCIDRConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clustercidrconfigsResource, name), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// List takes label and field selectors, and returns the list of ClusterCIDRConfigs that match those selectors. +func (c *FakeClusterCIDRConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterCIDRConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clustercidrconfigsResource, clustercidrconfigsKind, opts), &v1alpha1.ClusterCIDRConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterCIDRConfigList{ListMeta: obj.(*v1alpha1.ClusterCIDRConfigList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterCIDRConfigList).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 clusterCIDRConfigs. +func (c *FakeClusterCIDRConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clustercidrconfigsResource, opts)) +} + +// Create takes the representation of a clusterCIDRConfig and creates it. Returns the server's representation of the clusterCIDRConfig, and an error, if there is any. +func (c *FakeClusterCIDRConfigs) Create(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.CreateOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clustercidrconfigsResource, clusterCIDRConfig), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// Update takes the representation of a clusterCIDRConfig and updates it. Returns the server's representation of the clusterCIDRConfig, and an error, if there is any. +func (c *FakeClusterCIDRConfigs) Update(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clustercidrconfigsResource, clusterCIDRConfig), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusterCIDRConfigs) UpdateStatus(ctx context.Context, clusterCIDRConfig *v1alpha1.ClusterCIDRConfig, opts v1.UpdateOptions) (*v1alpha1.ClusterCIDRConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(clustercidrconfigsResource, "status", clusterCIDRConfig), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// Delete takes name of the clusterCIDRConfig and deletes it. Returns an error if one occurs. +func (c *FakeClusterCIDRConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clustercidrconfigsResource, name, opts), &v1alpha1.ClusterCIDRConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterCIDRConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clustercidrconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterCIDRConfigList{}) + return err +} + +// Patch applies the patch and returns the patched clusterCIDRConfig. +func (c *FakeClusterCIDRConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterCIDRConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustercidrconfigsResource, name, pt, data, subresources...), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterCIDRConfig. +func (c *FakeClusterCIDRConfigs) Apply(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + if clusterCIDRConfig == nil { + return nil, fmt.Errorf("clusterCIDRConfig provided to Apply must not be nil") + } + data, err := json.Marshal(clusterCIDRConfig) + if err != nil { + return nil, err + } + name := clusterCIDRConfig.Name + if name == nil { + return nil, fmt.Errorf("clusterCIDRConfig.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustercidrconfigsResource, *name, types.ApplyPatchType, data), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeClusterCIDRConfigs) ApplyStatus(ctx context.Context, clusterCIDRConfig *networkingv1alpha1.ClusterCIDRConfigApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterCIDRConfig, err error) { + if clusterCIDRConfig == nil { + return nil, fmt.Errorf("clusterCIDRConfig provided to Apply must not be nil") + } + data, err := json.Marshal(clusterCIDRConfig) + if err != nil { + return nil, err + } + name := clusterCIDRConfig.Name + if name == nil { + return nil, fmt.Errorf("clusterCIDRConfig.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustercidrconfigsResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.ClusterCIDRConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterCIDRConfig), err +} diff --git a/kubernetes/typed/networking/v1alpha1/fake/fake_networking_client.go b/kubernetes/typed/networking/v1alpha1/fake/fake_networking_client.go new file mode 100644 index 00000000..af0f79a0 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/fake/fake_networking_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 ( + v1alpha1 "k8s.io/client-go/kubernetes/typed/networking/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeNetworkingV1alpha1 struct { + *testing.Fake +} + +func (c *FakeNetworkingV1alpha1) ClusterCIDRConfigs() v1alpha1.ClusterCIDRConfigInterface { + return &FakeClusterCIDRConfigs{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNetworkingV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/kubernetes/typed/networking/v1alpha1/generated_expansion.go b/kubernetes/typed/networking/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..a5941b79 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/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 v1alpha1 + +type ClusterCIDRConfigExpansion interface{} diff --git a/kubernetes/typed/networking/v1alpha1/networking_client.go b/kubernetes/typed/networking/v1alpha1/networking_client.go new file mode 100644 index 00000000..d76ca228 --- /dev/null +++ b/kubernetes/typed/networking/v1alpha1/networking_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 v1alpha1 + +import ( + "net/http" + + v1alpha1 "k8s.io/api/networking/v1alpha1" + "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +type NetworkingV1alpha1Interface interface { + RESTClient() rest.Interface + ClusterCIDRConfigsGetter +} + +// NetworkingV1alpha1Client is used to interact with features provided by the networking.k8s.io group. +type NetworkingV1alpha1Client struct { + restClient rest.Interface +} + +func (c *NetworkingV1alpha1Client) ClusterCIDRConfigs() ClusterCIDRConfigInterface { + return newClusterCIDRConfigs(c) +} + +// NewForConfig creates a new NetworkingV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*NetworkingV1alpha1Client, 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 NetworkingV1alpha1Client 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) (*NetworkingV1alpha1Client, 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 &NetworkingV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new NetworkingV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NetworkingV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *NetworkingV1alpha1Client { + return &NetworkingV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *NetworkingV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/listers/networking/v1alpha1/clustercidrconfig.go b/listers/networking/v1alpha1/clustercidrconfig.go new file mode 100644 index 00000000..c1811f79 --- /dev/null +++ b/listers/networking/v1alpha1/clustercidrconfig.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/networking/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterCIDRConfigLister helps list ClusterCIDRConfigs. +// All objects returned here must be treated as read-only. +type ClusterCIDRConfigLister interface { + // List lists all ClusterCIDRConfigs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterCIDRConfig, err error) + // Get retrieves the ClusterCIDRConfig from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterCIDRConfig, error) + ClusterCIDRConfigListerExpansion +} + +// clusterCIDRConfigLister implements the ClusterCIDRConfigLister interface. +type clusterCIDRConfigLister struct { + indexer cache.Indexer +} + +// NewClusterCIDRConfigLister returns a new ClusterCIDRConfigLister. +func NewClusterCIDRConfigLister(indexer cache.Indexer) ClusterCIDRConfigLister { + return &clusterCIDRConfigLister{indexer: indexer} +} + +// List lists all ClusterCIDRConfigs in the indexer. +func (s *clusterCIDRConfigLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterCIDRConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterCIDRConfig)) + }) + return ret, err +} + +// Get retrieves the ClusterCIDRConfig from the index for a given name. +func (s *clusterCIDRConfigLister) Get(name string) (*v1alpha1.ClusterCIDRConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clustercidrconfig"), name) + } + return obj.(*v1alpha1.ClusterCIDRConfig), nil +} diff --git a/listers/networking/v1alpha1/expansion_generated.go b/listers/networking/v1alpha1/expansion_generated.go new file mode 100644 index 00000000..71399018 --- /dev/null +++ b/listers/networking/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +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 v1alpha1 + +// ClusterCIDRConfigListerExpansion allows custom methods to be added to +// ClusterCIDRConfigLister. +type ClusterCIDRConfigListerExpansion interface{}