From 51dba3d11f8717aa283abc0f6af98b32f82446e6 Mon Sep 17 00:00:00 2001 From: Richard Vanderpool <49568690+rvanderp3@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:00:32 -0400 Subject: [PATCH] promote IPAM types to v1beta1 --- Makefile | 9 + ...ipam.cluster.x-k8s.io_ipaddressclaims.yaml | 117 ++++++++ .../ipam.cluster.x-k8s.io_ipaddresses.yaml | 84 ++++++ exp/ipam/api/v1alpha1/conversion.go | 92 ++++++ exp/ipam/api/v1alpha1/conversion_test.go | 39 +++ exp/ipam/api/v1alpha1/doc.go | 1 + exp/ipam/api/v1alpha1/groupversion_info.go | 3 + exp/ipam/api/v1alpha1/ipaddress_types.go | 1 - exp/ipam/api/v1alpha1/ipaddressclaim_types.go | 1 - .../api/v1alpha1/zz_generated.conversion.go | 283 ++++++++++++++++++ .../.import-restrictions | 0 exp/ipam/api/v1beta1/conversion.go | 22 ++ exp/ipam/api/v1beta1/doc.go | 18 ++ exp/ipam/api/v1beta1/groupversion_info.go | 45 +++ exp/ipam/api/v1beta1/ipaddress_types.go | 69 +++++ exp/ipam/api/v1beta1/ipaddressclaim_types.go | 80 +++++ exp/ipam/api/v1beta1/zz_generated.deepcopy.go | 199 ++++++++++++ exp/ipam/internal/webhooks/ipaddress.go | 2 +- exp/ipam/internal/webhooks/ipaddress_test.go | 2 +- exp/ipam/internal/webhooks/ipaddressclaim.go | 2 +- .../internal/webhooks/ipaddressclaim_test.go | 2 +- internal/test/envtest/environment.go | 2 +- main.go | 2 +- 23 files changed, 1067 insertions(+), 8 deletions(-) create mode 100644 exp/ipam/api/v1alpha1/conversion.go create mode 100644 exp/ipam/api/v1alpha1/conversion_test.go create mode 100644 exp/ipam/api/v1alpha1/zz_generated.conversion.go rename exp/ipam/api/{v1alpha1 => v1beta1}/.import-restrictions (100%) create mode 100644 exp/ipam/api/v1beta1/conversion.go create mode 100644 exp/ipam/api/v1beta1/doc.go create mode 100644 exp/ipam/api/v1beta1/groupversion_info.go create mode 100644 exp/ipam/api/v1beta1/ipaddress_types.go create mode 100644 exp/ipam/api/v1beta1/ipaddressclaim_types.go create mode 100644 exp/ipam/api/v1beta1/zz_generated.deepcopy.go diff --git a/Makefile b/Makefile index 8d469911316e..4a52d63c13e9 100644 --- a/Makefile +++ b/Makefile @@ -422,6 +422,7 @@ generate-go-conversions: ## Run all generate-go-conversions-* targets generate-go-conversions-core: ## Run all generate-go-conversions-core-* targets $(MAKE) generate-go-conversions-core-api $(MAKE) generate-go-conversions-core-exp + $(MAKE) generate-go-conversions-core-exp-ipam $(MAKE) generate-go-conversions-core-runtime .PHONY: generate-go-conversions-core-api @@ -443,6 +444,14 @@ generate-go-conversions-core-exp: $(CONVERSION_GEN) ## Generate conversions go c --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt +.PHONY: generate-go-conversions-core-exp-ipam +generate-go-conversions-core-exp-ipam: $(CONVERSION_GEN) ## Generate conversions go code for core exp IPAM + $(MAKE) clean-generated-conversions SRC_DIRS="./$(EXP_DIR)/ipam/api/v1alpha1" + $(CONVERSION_GEN) \ + --input-dirs=./$(EXP_DIR)/ipam/api/v1alpha1 \ + --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ + --go-header-file=./hack/boilerplate/boilerplate.generatego.txt + .PHONY: generate-go-conversions-core-runtime generate-go-conversions-core-runtime: $(CONVERSION_GEN) ## Generate conversions go code for core runtime $(MAKE) clean-generated-conversions SRC_DIRS="./internal/runtime/test/v1alpha1,./internal/runtime/test/v1alpha2" diff --git a/config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml b/config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml index 9b608a3fb45c..986116db364e 100644 --- a/config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml +++ b/config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml @@ -130,6 +130,123 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Name of the pool to allocate an address from + jsonPath: .spec.poolRef.name + name: Pool Name + type: string + - description: Kind of the pool to allocate an address from + jsonPath: .spec.poolRef.kind + name: Pool Kind + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: IPAddressClaim is the Schema for the ipaddressclaim API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: IPAddressClaimSpec is the desired state of an IPAddressClaim. + properties: + poolRef: + description: PoolRef is a reference to the pool from which an IP address + should be created. + properties: + apiGroup: + description: APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in + the core API group. For any other third-party types, APIGroup + is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + required: + - poolRef + type: object + status: + description: IPAddressClaimStatus is the observed status of a IPAddressClaim. + properties: + addressRef: + description: AddressRef is a reference to the address that was created + for this claim. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + conditions: + description: Conditions summarises the current state of the IPAddressClaim + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml b/config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml index a0c8c06ae94c..64f948c38b65 100644 --- a/config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml +++ b/config/crd/bases/ipam.cluster.x-k8s.io_ipaddresses.yaml @@ -98,5 +98,89 @@ spec: type: object type: object served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - description: Address + jsonPath: .spec.address + name: Address + type: string + - description: Name of the pool the address is from + jsonPath: .spec.poolRef.name + name: Pool Name + type: string + - description: Kind of the pool the address is from + jsonPath: .spec.poolRef.kind + name: Pool Kind + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: IPAddress is the Schema for the ipaddress API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: IPAddressSpec is the desired state of an IPAddress. + properties: + address: + description: Address is the IP address. + type: string + claimRef: + description: ClaimRef is a reference to the claim this IPAddress was + created for. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + gateway: + description: Gateway is the network gateway of the network the address + is from. + type: string + poolRef: + description: PoolRef is a reference to the pool that this IPAddress + was created from. + properties: + apiGroup: + description: APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in + the core API group. For any other third-party types, APIGroup + is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + prefix: + description: Prefix is the prefix of the address. + type: integer + required: + - address + - claimRef + - poolRef + - prefix + type: object + type: object + served: true storage: true subresources: {} diff --git a/exp/ipam/api/v1alpha1/conversion.go b/exp/ipam/api/v1alpha1/conversion.go new file mode 100644 index 000000000000..65b29b25d00d --- /dev/null +++ b/exp/ipam/api/v1alpha1/conversion.go @@ -0,0 +1,92 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "sigs.k8s.io/controller-runtime/pkg/conversion" + + ipamv1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" +) + +func (src *IPAddress) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*ipamv1beta1.IPAddress) + + if err := Convert_v1alpha1_IPAddress_To_v1beta1_IPAddress(src, dst, nil); err != nil { + return err + } + + delete(src.Annotations, utilconversion.DataAnnotation) + + return nil +} + +func (dst *IPAddress) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*ipamv1beta1.IPAddress) + + if err := Convert_v1beta1_IPAddress_To_v1alpha1_IPAddress(src, dst, nil); err != nil { + return err + } + + return utilconversion.MarshalData(src, dst) +} + +func (src *IPAddressList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*ipamv1beta1.IPAddressList) + + return Convert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(src, dst, nil) +} + +func (dst *IPAddressList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*ipamv1beta1.IPAddressList) + + return Convert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(src, dst, nil) +} + +func (src *IPAddressClaim) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*ipamv1beta1.IPAddressClaim) + + if err := Convert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(src, dst, nil); err != nil { + return err + } + + delete(src.Annotations, utilconversion.DataAnnotation) + + return nil +} + +func (dst *IPAddressClaim) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*ipamv1beta1.IPAddressClaim) + + if err := Convert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(src, dst, nil); err != nil { + return err + } + + return utilconversion.MarshalData(src, dst) +} + +func (src *IPAddressClaimList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*ipamv1beta1.IPAddressClaimList) + + return Convert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(src, dst, nil) +} + +func (dst *IPAddressClaimList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*ipamv1beta1.IPAddressClaimList) + + return Convert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(src, dst, nil) +} diff --git a/exp/ipam/api/v1alpha1/conversion_test.go b/exp/ipam/api/v1alpha1/conversion_test.go new file mode 100644 index 000000000000..181109b392a0 --- /dev/null +++ b/exp/ipam/api/v1alpha1/conversion_test.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "testing" + + "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" + + ipamv1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" +) + +func TestFuzzyConversion(t *testing.T) { + t.Run("for IPAddress", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Hub: &ipamv1beta1.IPAddress{}, + Spoke: &IPAddress{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{}, + })) + t.Run("for IPAddressClaim", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Hub: &ipamv1beta1.IPAddressClaim{}, + Spoke: &IPAddressClaim{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{}, + })) +} diff --git a/exp/ipam/api/v1alpha1/doc.go b/exp/ipam/api/v1alpha1/doc.go index 7c7deb4b14ae..ce54c843f198 100644 --- a/exp/ipam/api/v1alpha1/doc.go +++ b/exp/ipam/api/v1alpha1/doc.go @@ -15,4 +15,5 @@ limitations under the License. */ // Package v1alpha1 contains API Schema definitions for the exp v1alpha1 IPAM API. +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1 package v1alpha1 diff --git a/exp/ipam/api/v1alpha1/groupversion_info.go b/exp/ipam/api/v1alpha1/groupversion_info.go index 221e7650191b..610dd03741d2 100644 --- a/exp/ipam/api/v1alpha1/groupversion_info.go +++ b/exp/ipam/api/v1alpha1/groupversion_info.go @@ -36,6 +36,9 @@ var ( AddToScheme = schemeBuilder.AddToScheme objectTypes = []runtime.Object{} + + // localSchemeBuilder is used for type conversions. + localSchemeBuilder = schemeBuilder ) func addKnownTypes(scheme *runtime.Scheme) error { diff --git a/exp/ipam/api/v1alpha1/ipaddress_types.go b/exp/ipam/api/v1alpha1/ipaddress_types.go index b40982d96f8c..054d9c77fabc 100644 --- a/exp/ipam/api/v1alpha1/ipaddress_types.go +++ b/exp/ipam/api/v1alpha1/ipaddress_types.go @@ -42,7 +42,6 @@ type IPAddressSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=ipaddresses,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Address",type="string",JSONPath=".spec.address",description="Address" // +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool the address is from" // +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool the address is from" diff --git a/exp/ipam/api/v1alpha1/ipaddressclaim_types.go b/exp/ipam/api/v1alpha1/ipaddressclaim_types.go index 16df8605e800..54334bf5b9b0 100644 --- a/exp/ipam/api/v1alpha1/ipaddressclaim_types.go +++ b/exp/ipam/api/v1alpha1/ipaddressclaim_types.go @@ -43,7 +43,6 @@ type IPAddressClaimStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=ipaddressclaims,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool to allocate an address from" // +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool to allocate an address from" diff --git a/exp/ipam/api/v1alpha1/zz_generated.conversion.go b/exp/ipam/api/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000000..3e397d16b8e2 --- /dev/null +++ b/exp/ipam/api/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,283 @@ +//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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + v1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*IPAddress)(nil), (*v1beta1.IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddress_To_v1beta1_IPAddress(a.(*IPAddress), b.(*v1beta1.IPAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddress)(nil), (*IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddress_To_v1alpha1_IPAddress(a.(*v1beta1.IPAddress), b.(*IPAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressClaim)(nil), (*v1beta1.IPAddressClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(a.(*IPAddressClaim), b.(*v1beta1.IPAddressClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressClaim)(nil), (*IPAddressClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(a.(*v1beta1.IPAddressClaim), b.(*IPAddressClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressClaimList)(nil), (*v1beta1.IPAddressClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(a.(*IPAddressClaimList), b.(*v1beta1.IPAddressClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressClaimList)(nil), (*IPAddressClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(a.(*v1beta1.IPAddressClaimList), b.(*IPAddressClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressClaimSpec)(nil), (*v1beta1.IPAddressClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec(a.(*IPAddressClaimSpec), b.(*v1beta1.IPAddressClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressClaimSpec)(nil), (*IPAddressClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec(a.(*v1beta1.IPAddressClaimSpec), b.(*IPAddressClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressClaimStatus)(nil), (*v1beta1.IPAddressClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus(a.(*IPAddressClaimStatus), b.(*v1beta1.IPAddressClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressClaimStatus)(nil), (*IPAddressClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus(a.(*v1beta1.IPAddressClaimStatus), b.(*IPAddressClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressList)(nil), (*v1beta1.IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(a.(*IPAddressList), b.(*v1beta1.IPAddressList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressList)(nil), (*IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(a.(*v1beta1.IPAddressList), b.(*IPAddressList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPAddressSpec)(nil), (*v1beta1.IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec(a.(*IPAddressSpec), b.(*v1beta1.IPAddressSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressSpec)(nil), (*IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec(a.(*v1beta1.IPAddressSpec), b.(*IPAddressSpec), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_IPAddress_To_v1beta1_IPAddress(in *IPAddress, out *v1beta1.IPAddress, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPAddress_To_v1beta1_IPAddress is an autogenerated conversion function. +func Convert_v1alpha1_IPAddress_To_v1beta1_IPAddress(in *IPAddress, out *v1beta1.IPAddress, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddress_To_v1beta1_IPAddress(in, out, s) +} + +func autoConvert_v1beta1_IPAddress_To_v1alpha1_IPAddress(in *v1beta1.IPAddress, out *IPAddress, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_IPAddress_To_v1alpha1_IPAddress is an autogenerated conversion function. +func Convert_v1beta1_IPAddress_To_v1alpha1_IPAddress(in *v1beta1.IPAddress, out *IPAddress, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddress_To_v1alpha1_IPAddress(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(in *IPAddressClaim, out *v1beta1.IPAddressClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(in *IPAddressClaim, out *v1beta1.IPAddressClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(in, out, s) +} + +func autoConvert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(in *v1beta1.IPAddressClaim, out *IPAddressClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim is an autogenerated conversion function. +func Convert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(in *v1beta1.IPAddressClaim, out *IPAddressClaim, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(in *IPAddressClaimList, out *v1beta1.IPAddressClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta1.IPAddressClaim)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(in *IPAddressClaimList, out *v1beta1.IPAddressClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(in, out, s) +} + +func autoConvert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(in *v1beta1.IPAddressClaimList, out *IPAddressClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]IPAddressClaim)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList is an autogenerated conversion function. +func Convert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(in *v1beta1.IPAddressClaimList, out *IPAddressClaimList, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec(in *IPAddressClaimSpec, out *v1beta1.IPAddressClaimSpec, s conversion.Scope) error { + out.PoolRef = in.PoolRef + return nil +} + +// Convert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec(in *IPAddressClaimSpec, out *v1beta1.IPAddressClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressClaimSpec_To_v1beta1_IPAddressClaimSpec(in, out, s) +} + +func autoConvert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec(in *v1beta1.IPAddressClaimSpec, out *IPAddressClaimSpec, s conversion.Scope) error { + out.PoolRef = in.PoolRef + return nil +} + +// Convert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec is an autogenerated conversion function. +func Convert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec(in *v1beta1.IPAddressClaimSpec, out *IPAddressClaimSpec, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressClaimSpec_To_v1alpha1_IPAddressClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus(in *IPAddressClaimStatus, out *v1beta1.IPAddressClaimStatus, s conversion.Scope) error { + out.AddressRef = in.AddressRef + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus(in *IPAddressClaimStatus, out *v1beta1.IPAddressClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressClaimStatus_To_v1beta1_IPAddressClaimStatus(in, out, s) +} + +func autoConvert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus(in *v1beta1.IPAddressClaimStatus, out *IPAddressClaimStatus, s conversion.Scope) error { + out.AddressRef = in.AddressRef + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus is an autogenerated conversion function. +func Convert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus(in *v1beta1.IPAddressClaimStatus, out *IPAddressClaimStatus, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressClaimStatus_To_v1alpha1_IPAddressClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(in *IPAddressList, out *v1beta1.IPAddressList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta1.IPAddress)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(in *IPAddressList, out *v1beta1.IPAddressList, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(in, out, s) +} + +func autoConvert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(in *v1beta1.IPAddressList, out *IPAddressList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]IPAddress)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList is an autogenerated conversion function. +func Convert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(in *v1beta1.IPAddressList, out *IPAddressList, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(in, out, s) +} + +func autoConvert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec(in *IPAddressSpec, out *v1beta1.IPAddressSpec, s conversion.Scope) error { + out.ClaimRef = in.ClaimRef + out.PoolRef = in.PoolRef + out.Address = in.Address + out.Prefix = in.Prefix + out.Gateway = in.Gateway + return nil +} + +// Convert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec is an autogenerated conversion function. +func Convert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec(in *IPAddressSpec, out *v1beta1.IPAddressSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_IPAddressSpec_To_v1beta1_IPAddressSpec(in, out, s) +} + +func autoConvert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec(in *v1beta1.IPAddressSpec, out *IPAddressSpec, s conversion.Scope) error { + out.ClaimRef = in.ClaimRef + out.PoolRef = in.PoolRef + out.Address = in.Address + out.Prefix = in.Prefix + out.Gateway = in.Gateway + return nil +} + +// Convert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec is an autogenerated conversion function. +func Convert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec(in *v1beta1.IPAddressSpec, out *IPAddressSpec, s conversion.Scope) error { + return autoConvert_v1beta1_IPAddressSpec_To_v1alpha1_IPAddressSpec(in, out, s) +} diff --git a/exp/ipam/api/v1alpha1/.import-restrictions b/exp/ipam/api/v1beta1/.import-restrictions similarity index 100% rename from exp/ipam/api/v1alpha1/.import-restrictions rename to exp/ipam/api/v1beta1/.import-restrictions diff --git a/exp/ipam/api/v1beta1/conversion.go b/exp/ipam/api/v1beta1/conversion.go new file mode 100644 index 000000000000..64f6e9d8d84b --- /dev/null +++ b/exp/ipam/api/v1beta1/conversion.go @@ -0,0 +1,22 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +func (*IPAddress) Hub() {} +func (*IPAddressList) Hub() {} +func (*IPAddressClaim) Hub() {} +func (*IPAddressClaimList) Hub() {} diff --git a/exp/ipam/api/v1beta1/doc.go b/exp/ipam/api/v1beta1/doc.go new file mode 100644 index 000000000000..81c65d7f34d0 --- /dev/null +++ b/exp/ipam/api/v1beta1/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1beta1 contains API Schema definitions for the v1beta1 IPAM API. +package v1beta1 diff --git a/exp/ipam/api/v1beta1/groupversion_info.go b/exp/ipam/api/v1beta1/groupversion_info.go new file mode 100644 index 000000000000..e01b1ad46179 --- /dev/null +++ b/exp/ipam/api/v1beta1/groupversion_info.go @@ -0,0 +1,45 @@ +/* +Copyright 2022 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. +*/ + +// +kubebuilder:object:generate=true +// +groupName=ipam.cluster.x-k8s.io + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // GroupVersion is group version used to register these objects. + GroupVersion = schema.GroupVersion{Group: "ipam.cluster.x-k8s.io", Version: "v1beta1"} + + // schemeBuilder is used to add go types to the GroupVersionKind scheme. + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = schemeBuilder.AddToScheme + + objectTypes = []runtime.Object{} +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, objectTypes...) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/exp/ipam/api/v1beta1/ipaddress_types.go b/exp/ipam/api/v1beta1/ipaddress_types.go new file mode 100644 index 000000000000..c14860cdcc84 --- /dev/null +++ b/exp/ipam/api/v1beta1/ipaddress_types.go @@ -0,0 +1,69 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPAddressSpec is the desired state of an IPAddress. +type IPAddressSpec struct { + // ClaimRef is a reference to the claim this IPAddress was created for. + ClaimRef corev1.LocalObjectReference `json:"claimRef"` + + // PoolRef is a reference to the pool that this IPAddress was created from. + PoolRef corev1.TypedLocalObjectReference `json:"poolRef"` + + // Address is the IP address. + Address string `json:"address"` + + // Prefix is the prefix of the address. + Prefix int `json:"prefix"` + + // Gateway is the network gateway of the network the address is from. + // +optional + Gateway string `json:"gateway,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ipaddresses,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Address",type="string",JSONPath=".spec.address",description="Address" +// +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool the address is from" +// +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool the address is from" + +// IPAddress is the Schema for the ipaddress API. +type IPAddress struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IPAddressSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// IPAddressList is a list of IPAddress. +type IPAddressList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []IPAddress `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &IPAddress{}, &IPAddressList{}) +} diff --git a/exp/ipam/api/v1beta1/ipaddressclaim_types.go b/exp/ipam/api/v1beta1/ipaddressclaim_types.go new file mode 100644 index 000000000000..fd8c7e42447a --- /dev/null +++ b/exp/ipam/api/v1beta1/ipaddressclaim_types.go @@ -0,0 +1,80 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +// IPAddressClaimSpec is the desired state of an IPAddressClaim. +type IPAddressClaimSpec struct { + // PoolRef is a reference to the pool from which an IP address should be created. + PoolRef corev1.TypedLocalObjectReference `json:"poolRef"` +} + +// IPAddressClaimStatus is the observed status of a IPAddressClaim. +type IPAddressClaimStatus struct { + // AddressRef is a reference to the address that was created for this claim. + // +optional + AddressRef corev1.LocalObjectReference `json:"addressRef,omitempty"` + + // Conditions summarises the current state of the IPAddressClaim + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ipaddressclaims,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool to allocate an address from" +// +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool to allocate an address from" + +// IPAddressClaim is the Schema for the ipaddressclaim API. +type IPAddressClaim struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IPAddressClaimSpec `json:"spec,omitempty"` + Status IPAddressClaimStatus `json:"status,omitempty"` +} + +// GetConditions returns the set of conditions for this object. +func (m *IPAddressClaim) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +// SetConditions sets the conditions on this object. +func (m *IPAddressClaim) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// IPAddressClaimList is a list of IPAddressClaims. +type IPAddressClaimList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []IPAddressClaim `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &IPAddressClaim{}, &IPAddressClaimList{}) +} diff --git a/exp/ipam/api/v1beta1/zz_generated.deepcopy.go b/exp/ipam/api/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 000000000000..ef05c5b2fc8d --- /dev/null +++ b/exp/ipam/api/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,199 @@ +//go: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 controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddress) DeepCopyInto(out *IPAddress) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddress. +func (in *IPAddress) DeepCopy() *IPAddress { + if in == nil { + return nil + } + out := new(IPAddress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddress) 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 *IPAddressClaim) DeepCopyInto(out *IPAddressClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressClaim. +func (in *IPAddressClaim) DeepCopy() *IPAddressClaim { + if in == nil { + return nil + } + out := new(IPAddressClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressClaim) 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 *IPAddressClaimList) DeepCopyInto(out *IPAddressClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPAddressClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressClaimList. +func (in *IPAddressClaimList) DeepCopy() *IPAddressClaimList { + if in == nil { + return nil + } + out := new(IPAddressClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressClaimList) 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 *IPAddressClaimSpec) DeepCopyInto(out *IPAddressClaimSpec) { + *out = *in + in.PoolRef.DeepCopyInto(&out.PoolRef) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressClaimSpec. +func (in *IPAddressClaimSpec) DeepCopy() *IPAddressClaimSpec { + if in == nil { + return nil + } + out := new(IPAddressClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressClaimStatus) DeepCopyInto(out *IPAddressClaimStatus) { + *out = *in + out.AddressRef = in.AddressRef + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressClaimStatus. +func (in *IPAddressClaimStatus) DeepCopy() *IPAddressClaimStatus { + if in == nil { + return nil + } + out := new(IPAddressClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressList) DeepCopyInto(out *IPAddressList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPAddress, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressList. +func (in *IPAddressList) DeepCopy() *IPAddressList { + if in == nil { + return nil + } + out := new(IPAddressList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressList) 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 *IPAddressSpec) DeepCopyInto(out *IPAddressSpec) { + *out = *in + out.ClaimRef = in.ClaimRef + in.PoolRef.DeepCopyInto(&out.PoolRef) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressSpec. +func (in *IPAddressSpec) DeepCopy() *IPAddressSpec { + if in == nil { + return nil + } + out := new(IPAddressSpec) + in.DeepCopyInto(out) + return out +} diff --git a/exp/ipam/internal/webhooks/ipaddress.go b/exp/ipam/internal/webhooks/ipaddress.go index ca435b81e379..2f4f5ad87559 100644 --- a/exp/ipam/internal/webhooks/ipaddress.go +++ b/exp/ipam/internal/webhooks/ipaddress.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" ) // SetupWebhookWithManager sets up IPAddress webhooks. diff --git a/exp/ipam/internal/webhooks/ipaddress_test.go b/exp/ipam/internal/webhooks/ipaddress_test.go index aab7a51b8db3..047144f4c049 100644 --- a/exp/ipam/internal/webhooks/ipaddress_test.go +++ b/exp/ipam/internal/webhooks/ipaddress_test.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" ) func TestIPAddressValidateCreate(t *testing.T) { diff --git a/exp/ipam/internal/webhooks/ipaddressclaim.go b/exp/ipam/internal/webhooks/ipaddressclaim.go index b2b8ceddc655..33177dc5ebc7 100644 --- a/exp/ipam/internal/webhooks/ipaddressclaim.go +++ b/exp/ipam/internal/webhooks/ipaddressclaim.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" ) // SetupWebhookWithManager sets up IPAddressClaim webhooks. diff --git a/exp/ipam/internal/webhooks/ipaddressclaim_test.go b/exp/ipam/internal/webhooks/ipaddressclaim_test.go index a4630affe519..69e1ce9648dc 100644 --- a/exp/ipam/internal/webhooks/ipaddressclaim_test.go +++ b/exp/ipam/internal/webhooks/ipaddressclaim_test.go @@ -24,7 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/utils/pointer" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" ) func TestIPAddressClaimValidateCreate(t *testing.T) { diff --git a/internal/test/envtest/environment.go b/internal/test/envtest/environment.go index 678c71cb8c7f..8f27660c6a16 100644 --- a/internal/test/envtest/environment.go +++ b/internal/test/envtest/environment.go @@ -59,7 +59,7 @@ import ( addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1" addonswebhooks "sigs.k8s.io/cluster-api/exp/addons/webhooks" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" expipamwebhooks "sigs.k8s.io/cluster-api/exp/ipam/webhooks" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" expapiwebhooks "sigs.k8s.io/cluster-api/exp/webhooks" diff --git a/main.go b/main.go index e0768440ea3e..3b0d8c3c94a7 100644 --- a/main.go +++ b/main.go @@ -57,7 +57,7 @@ import ( expv1alpha4 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" expcontrollers "sigs.k8s.io/cluster-api/exp/controllers" - ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" + ipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" expipamwebhooks "sigs.k8s.io/cluster-api/exp/ipam/webhooks" runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"