diff --git a/Makefile b/Makefile index 046bbbc2..4582a681 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ help: ## Display this help. ##@ Generate: .PHONY: generate -generate: generate-manifests generate-code generate-mock +generate: generate-manifests generate-conversion generate-code generate-mock .PHONY: generate-manifests generate-manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. @@ -89,6 +89,10 @@ generate-code: controller-gen gowrap ## Generate code containing DeepCopy, DeepC go generate ./... $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: generate-conversion +generate-conversion: conversion-gen + $(CONVERSION_GEN) ./api/v1alpha1 --go-header-file=./hack/boilerplate.go.txt --output-file=zz_generated.conversion.go + .PHONY: generate-mock generate-mock: mockgen ## Generate mocks for the Linode API client. $(MOCKGEN) -source=./clients/clients.go -destination ./mock/client.go -package mock @@ -144,7 +148,7 @@ docs: .PHONY: test test: generate fmt vet envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(CACHE_BIN) -p path)" go test -race -timeout 60s `go list ./... | grep -v ./mock$$` -coverprofile cover.out.tmp - grep -v "zz_generated.deepcopy.go" cover.out.tmp > cover.out + grep -v "zz_generated.*" cover.out.tmp > cover.out rm cover.out.tmp .PHONY: e2etest @@ -297,6 +301,7 @@ CTLPTL ?= $(LOCALBIN)/ctlptl CLUSTERCTL ?= $(LOCALBIN)/clusterctl KUBEBUILDER ?= $(LOCALBIN)/kubebuilder CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen +CONVERSION_GEN ?= $(CACHE_BIN)/conversion-gen TILT ?= $(LOCALBIN)/tilt KIND ?= $(LOCALBIN)/kind CHAINSAW ?= $(LOCALBIN)/chainsaw @@ -323,7 +328,7 @@ MOCKGEN_VERSION ?= v0.4.0 GOWRAP_VERSION ?= latest .PHONY: tools -tools: $(KUSTOMIZE) $(CTLPTL) $(CLUSTERCTL) $(CONTROLLER_GEN) $(TILT) $(KIND) $(CHAINSAW) $(ENVTEST) $(HUSKY) $(NILAWAY) $(GOVULNC) $(MOCKGEN) $(GOWRAP) +tools: $(KUSTOMIZE) $(CTLPTL) $(CLUSTERCTL) $(CONTROLLER_GEN) $(CONVERSION_GEN) $(TILT) $(KIND) $(CHAINSAW) $(ENVTEST) $(HUSKY) $(NILAWAY) $(GOVULNC) $(MOCKGEN) $(GOWRAP) .PHONY: kustomize @@ -353,6 +358,10 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar $(CONTROLLER_GEN): $(LOCALBIN) GOBIN=$(CACHE_BIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) +.PHONY: conversion-gen +conversion-gen: $(CONVERSION_GEN) ## Download conversion-gen locally if necessary. +$(CONVERSION_GEN): $(LOCALBIN) + GOBIN=$(CACHE_BIN) go install k8s.io/code-generator/cmd/conversion-gen@latest .PHONY: tilt tilt: $(TILT) ## Download tilt locally if necessary. diff --git a/PROJECT b/PROJECT index 851e09de..1c96a162 100644 --- a/PROJECT +++ b/PROJECT @@ -119,4 +119,15 @@ resources: conversion: true validation: true webhookVersion: v1 +- api: + crdVersion: v1 + namespaced: true + domain: cluster.x-k8s.io + group: infrastructure + kind: LinodeClusterTemplate + path: github.com/linode/cluster-api-provider-linode/api/v1alpha2 + version: v1alpha2 + webhooks: + conversion: true + webhookVersion: v1 version: "3" diff --git a/api/v1alpha1/conversion.go b/api/v1alpha1/conversion.go new file mode 100644 index 00000000..6d313491 --- /dev/null +++ b/api/v1alpha1/conversion.go @@ -0,0 +1,40 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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 ( + "k8s.io/apimachinery/pkg/conversion" + + infrastructurev1alpha2 "github.com/linode/cluster-api-provider-linode/api/v1alpha2" +) + +func Convert_v1alpha1_NetworkSpec_To_v1alpha2_NetworkSpec(in *NetworkSpec, out *infrastructurev1alpha2.NetworkSpec, s conversion.Scope) error { + out.ApiserverNodeBalancerConfigID = in.NodeBalancerConfigID + out.ApiserverLoadBalancerPort = in.LoadBalancerPort + out.LoadBalancerType = in.LoadBalancerType + out.NodeBalancerID = in.NodeBalancerID + out.AdditionalPorts = make([]infrastructurev1alpha2.LinodeNBPortConfig, 0) + return nil +} + +func Convert_v1alpha2_NetworkSpec_To_v1alpha1_NetworkSpec(in *infrastructurev1alpha2.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { + out.NodeBalancerConfigID = in.ApiserverNodeBalancerConfigID + out.LoadBalancerPort = in.ApiserverLoadBalancerPort + out.LoadBalancerType = in.LoadBalancerType + out.NodeBalancerID = in.NodeBalancerID + return nil +} diff --git a/api/v1alpha1/doc.go b/api/v1alpha1/doc.go new file mode 100644 index 00000000..d7fbbde0 --- /dev/null +++ b/api/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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. +*/ + +// +groupName=infrastructure.cluster.x-k8s.io +// +k8s:conversion-gen=github.com/linode/cluster-api-provider-linode/api/v1alpha2 +package v1alpha1 diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 627ed075..6fa0ea6a 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/api/v1alpha1/linodeclustertemplate_conversion.go b/api/v1alpha1/linodeclustertemplate_conversion.go new file mode 100644 index 00000000..442e9a93 --- /dev/null +++ b/api/v1alpha1/linodeclustertemplate_conversion.go @@ -0,0 +1,83 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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 ( + "errors" + + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" + + infrastructurev1alpha2 "github.com/linode/cluster-api-provider-linode/api/v1alpha2" +) + +// ConvertTo converts this LinodeCluster to the Hub version (v1alpha2). +func (src *LinodeClusterTemplate) ConvertTo(dstRaw conversion.Hub) error { + dst, ok := dstRaw.(*infrastructurev1alpha2.LinodeClusterTemplate) + if !ok { + return errors.New("failed to convert LinodeClusterTemplate version from v1alpha1 to v1alpha2") + } + + if err := Convert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(src, dst, nil); err != nil { + return err + } + + // Manually restore data from annotations + restored := &LinodeClusterTemplate{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts from the Hub version (v1alpha2) to this version. +func (dst *LinodeClusterTemplate) ConvertFrom(srcRaw conversion.Hub) error { + src, ok := srcRaw.(*infrastructurev1alpha2.LinodeClusterTemplate) + if !ok { + return errors.New("failed to convert LinodeClusterTemplate version from v1alpha2 to v1alpha1") + } + + if err := Convert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, dst); err != nil { + return err + } + + return nil +} + +// ConvertTo converts this DOClusterList to the Hub version (v1alpha2). +func (src *LinodeClusterTemplateList) ConvertTo(dstRaw conversion.Hub) error { + dst, ok := dstRaw.(*infrastructurev1alpha2.LinodeClusterTemplateList) + if !ok { + return errors.New("failed to convert LinodeClusterTemplate version from v1alpha1 to v1alpha2") + } + return Convert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList(src, dst, nil) +} + +// ConvertFrom converts from the Hub version (v1alpha2) to this version. +func (dst *LinodeClusterTemplateList) ConvertFrom(srcRaw conversion.Hub) error { + src, ok := srcRaw.(*infrastructurev1alpha2.LinodeClusterTemplateList) + if !ok { + return errors.New("failed to convert LinodeClusterTemplate version from v1alpha2 to v1alpha1") + } + return Convert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList(src, dst, nil) +} diff --git a/api/v1alpha1/linodeclustertemplate_conversion_test.go b/api/v1alpha1/linodeclustertemplate_conversion_test.go new file mode 100644 index 00000000..6864095a --- /dev/null +++ b/api/v1alpha1/linodeclustertemplate_conversion_test.go @@ -0,0 +1,165 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +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 ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + + infrav1alpha2 "github.com/linode/cluster-api-provider-linode/api/v1alpha2" + "github.com/linode/cluster-api-provider-linode/mock" + + . "github.com/linode/cluster-api-provider-linode/mock/mocktest" +) + +func TestLinodeClusterTemplateConvertTo(t *testing.T) { + t.Parallel() + + src := &LinodeClusterTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster", + }, + Spec: LinodeClusterTemplateSpec{ + Template: LinodeClusterTemplateResource{ + Spec: LinodeClusterSpec{ + Network: NetworkSpec{ + LoadBalancerType: "test-type", + LoadBalancerPort: 12345, + NodeBalancerID: ptr.To(1234), + NodeBalancerConfigID: ptr.To(2345), + }, + ControlPlaneEndpoint: clusterv1.APIEndpoint{Host: "1.2.3.4"}, + Region: "test-region", + }, + }, + }, + } + expectedDst := &infrav1alpha2.LinodeClusterTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster", + }, + Spec: infrav1alpha2.LinodeClusterTemplateSpec{ + Template: infrav1alpha2.LinodeClusterTemplateResource{ + Spec: infrav1alpha2.LinodeClusterSpec{ + Network: infrav1alpha2.NetworkSpec{ + LoadBalancerType: "test-type", + ApiserverLoadBalancerPort: 12345, + NodeBalancerID: ptr.To(1234), + ApiserverNodeBalancerConfigID: ptr.To(2345), + AdditionalPorts: []infrav1alpha2.LinodeNBPortConfig{}, + }, + ControlPlaneEndpoint: clusterv1.APIEndpoint{Host: "1.2.3.4"}, + Region: "test-region", + }, + }, + }, + } + dst := &infrav1alpha2.LinodeClusterTemplate{} + + NewSuite(t, mock.MockLinodeClient{}).Run( + OneOf( + Path( + Call("convert v1alpha1 to v1alpha2", func(ctx context.Context, mck Mock) { + err := src.ConvertTo(dst) + if err != nil { + t.Fatalf("ConvertTo failed: %v", err) + } + }), + Result("conversion succeeded", func(ctx context.Context, mck Mock) { + if diff := cmp.Diff(expectedDst, dst); diff != "" { + t.Errorf("ConvertTo() mismatch (-expected +got):\n%s", diff) + } + }), + ), + ), + ) +} + +func TestLinodeClusterTemplateConvertFrom(t *testing.T) { + t.Parallel() + + src := &infrav1alpha2.LinodeClusterTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster", + }, + Spec: infrav1alpha2.LinodeClusterTemplateSpec{ + Template: infrav1alpha2.LinodeClusterTemplateResource{ + Spec: infrav1alpha2.LinodeClusterSpec{ + Network: infrav1alpha2.NetworkSpec{ + LoadBalancerType: "test-type", + ApiserverLoadBalancerPort: 12345, + NodeBalancerID: ptr.To(1234), + ApiserverNodeBalancerConfigID: ptr.To(2345), + AdditionalPorts: []infrav1alpha2.LinodeNBPortConfig{{ + Port: 6443, + NodeBalancerConfigID: ptr.To(12345), + }}, + }, + ControlPlaneEndpoint: clusterv1.APIEndpoint{Host: "1.2.3.4"}, + Region: "test-region", + }, + }, + }, + } + expectedDst := &LinodeClusterTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster", + }, + Spec: LinodeClusterTemplateSpec{ + Template: LinodeClusterTemplateResource{ + Spec: LinodeClusterSpec{ + Network: NetworkSpec{ + LoadBalancerType: "test-type", + LoadBalancerPort: 12345, + NodeBalancerID: ptr.To(1234), + NodeBalancerConfigID: ptr.To(2345), + }, + ControlPlaneEndpoint: clusterv1.APIEndpoint{Host: "1.2.3.4"}, + Region: "test-region", + }, + }, + }, + } + if err := utilconversion.MarshalData(src, expectedDst); err != nil { + t.Fatalf("ConvertFrom failed: %v", err) + } + dst := &LinodeClusterTemplate{} + + NewSuite(t, mock.MockLinodeClient{}).Run( + OneOf( + Path( + Call("convert v1alpha2 to v1alpha1", func(ctx context.Context, mck Mock) { + err := dst.ConvertFrom(src) + if err != nil { + t.Fatalf("ConvertFrom failed: %v", err) + } + }), + Result("conversion succeeded", func(ctx context.Context, mck Mock) { + if diff := cmp.Diff(expectedDst, dst); diff != "" { + t.Errorf("ConvertFrom() mismatch (-expected +got):\n%s", diff) + } + }), + ), + ), + ) +} diff --git a/api/v1alpha1/webhook_helpers.go b/api/v1alpha1/webhook_helpers.go index 058f91ba..561ce5ed 100644 --- a/api/v1alpha1/webhook_helpers.go +++ b/api/v1alpha1/webhook_helpers.go @@ -10,6 +10,7 @@ import ( "github.com/linode/linodego" "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" "github.com/linode/cluster-api-provider-linode/observability/wrappers/linodeclient" @@ -23,14 +24,10 @@ const ( defaultClientTimeout = time.Second * 10 ) -func mkptr[T any](v T) *T { - return &v -} - var ( // defaultLinodeClient is an unauthenticated Linode client defaultLinodeClient = linodeclient.NewLinodeClientWithTracing( - mkptr(linodego.NewClient(&http.Client{Timeout: defaultClientTimeout})), + ptr.To(linodego.NewClient(&http.Client{Timeout: defaultClientTimeout})), ) ) diff --git a/api/v1alpha1/zz_generated.conversion.go b/api/v1alpha1/zz_generated.conversion.go new file mode 100644 index 00000000..6d1185ec --- /dev/null +++ b/api/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,900 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2023 Akamai Technologies, Inc. + +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" + + v1alpha2 "github.com/linode/cluster-api-provider-linode/api/v1alpha2" + linodego "github.com/linode/linodego" + v1 "k8s.io/api/core/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + errors "sigs.k8s.io/cluster-api/errors" +) + +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((*InstanceConfigInterfaceCreateOptions)(nil), (*v1alpha2.InstanceConfigInterfaceCreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceConfigInterfaceCreateOptions_To_v1alpha2_InstanceConfigInterfaceCreateOptions(a.(*InstanceConfigInterfaceCreateOptions), b.(*v1alpha2.InstanceConfigInterfaceCreateOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.InstanceConfigInterfaceCreateOptions)(nil), (*InstanceConfigInterfaceCreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_InstanceConfigInterfaceCreateOptions_To_v1alpha1_InstanceConfigInterfaceCreateOptions(a.(*v1alpha2.InstanceConfigInterfaceCreateOptions), b.(*InstanceConfigInterfaceCreateOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceDisk)(nil), (*v1alpha2.InstanceDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceDisk_To_v1alpha2_InstanceDisk(a.(*InstanceDisk), b.(*v1alpha2.InstanceDisk), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.InstanceDisk)(nil), (*InstanceDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_InstanceDisk_To_v1alpha1_InstanceDisk(a.(*v1alpha2.InstanceDisk), b.(*InstanceDisk), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceMetadataOptions)(nil), (*v1alpha2.InstanceMetadataOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceMetadataOptions_To_v1alpha2_InstanceMetadataOptions(a.(*InstanceMetadataOptions), b.(*v1alpha2.InstanceMetadataOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.InstanceMetadataOptions)(nil), (*InstanceMetadataOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(a.(*v1alpha2.InstanceMetadataOptions), b.(*InstanceMetadataOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeCluster)(nil), (*v1alpha2.LinodeCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster(a.(*LinodeCluster), b.(*v1alpha2.LinodeCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeCluster)(nil), (*LinodeCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster(a.(*v1alpha2.LinodeCluster), b.(*LinodeCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterList)(nil), (*v1alpha2.LinodeClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterList_To_v1alpha2_LinodeClusterList(a.(*LinodeClusterList), b.(*v1alpha2.LinodeClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterList)(nil), (*LinodeClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterList_To_v1alpha1_LinodeClusterList(a.(*v1alpha2.LinodeClusterList), b.(*LinodeClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterSpec)(nil), (*v1alpha2.LinodeClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(a.(*LinodeClusterSpec), b.(*v1alpha2.LinodeClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterSpec)(nil), (*LinodeClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(a.(*v1alpha2.LinodeClusterSpec), b.(*LinodeClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterStatus)(nil), (*v1alpha2.LinodeClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus(a.(*LinodeClusterStatus), b.(*v1alpha2.LinodeClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterStatus)(nil), (*LinodeClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus(a.(*v1alpha2.LinodeClusterStatus), b.(*LinodeClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterTemplate)(nil), (*v1alpha2.LinodeClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(a.(*LinodeClusterTemplate), b.(*v1alpha2.LinodeClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterTemplate)(nil), (*LinodeClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(a.(*v1alpha2.LinodeClusterTemplate), b.(*LinodeClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterTemplateList)(nil), (*v1alpha2.LinodeClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList(a.(*LinodeClusterTemplateList), b.(*v1alpha2.LinodeClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterTemplateList)(nil), (*LinodeClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList(a.(*v1alpha2.LinodeClusterTemplateList), b.(*LinodeClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterTemplateResource)(nil), (*v1alpha2.LinodeClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource(a.(*LinodeClusterTemplateResource), b.(*v1alpha2.LinodeClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterTemplateResource)(nil), (*LinodeClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource(a.(*v1alpha2.LinodeClusterTemplateResource), b.(*LinodeClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeClusterTemplateSpec)(nil), (*v1alpha2.LinodeClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec(a.(*LinodeClusterTemplateSpec), b.(*v1alpha2.LinodeClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeClusterTemplateSpec)(nil), (*LinodeClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec(a.(*v1alpha2.LinodeClusterTemplateSpec), b.(*LinodeClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeMachine)(nil), (*v1alpha2.LinodeMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeMachine_To_v1alpha2_LinodeMachine(a.(*LinodeMachine), b.(*v1alpha2.LinodeMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeMachine)(nil), (*LinodeMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeMachine_To_v1alpha1_LinodeMachine(a.(*v1alpha2.LinodeMachine), b.(*LinodeMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeMachineList)(nil), (*v1alpha2.LinodeMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeMachineList_To_v1alpha2_LinodeMachineList(a.(*LinodeMachineList), b.(*v1alpha2.LinodeMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeMachineList)(nil), (*LinodeMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeMachineList_To_v1alpha1_LinodeMachineList(a.(*v1alpha2.LinodeMachineList), b.(*LinodeMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeMachineSpec)(nil), (*v1alpha2.LinodeMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec(a.(*LinodeMachineSpec), b.(*v1alpha2.LinodeMachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeMachineSpec)(nil), (*LinodeMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec(a.(*v1alpha2.LinodeMachineSpec), b.(*LinodeMachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeMachineStatus)(nil), (*v1alpha2.LinodeMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus(a.(*LinodeMachineStatus), b.(*v1alpha2.LinodeMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeMachineStatus)(nil), (*LinodeMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus(a.(*v1alpha2.LinodeMachineStatus), b.(*LinodeMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeVPC)(nil), (*v1alpha2.LinodeVPC)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeVPC_To_v1alpha2_LinodeVPC(a.(*LinodeVPC), b.(*v1alpha2.LinodeVPC), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeVPC)(nil), (*LinodeVPC)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeVPC_To_v1alpha1_LinodeVPC(a.(*v1alpha2.LinodeVPC), b.(*LinodeVPC), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeVPCList)(nil), (*v1alpha2.LinodeVPCList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeVPCList_To_v1alpha2_LinodeVPCList(a.(*LinodeVPCList), b.(*v1alpha2.LinodeVPCList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeVPCList)(nil), (*LinodeVPCList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeVPCList_To_v1alpha1_LinodeVPCList(a.(*v1alpha2.LinodeVPCList), b.(*LinodeVPCList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeVPCSpec)(nil), (*v1alpha2.LinodeVPCSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec(a.(*LinodeVPCSpec), b.(*v1alpha2.LinodeVPCSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeVPCSpec)(nil), (*LinodeVPCSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec(a.(*v1alpha2.LinodeVPCSpec), b.(*LinodeVPCSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinodeVPCStatus)(nil), (*v1alpha2.LinodeVPCStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus(a.(*LinodeVPCStatus), b.(*v1alpha2.LinodeVPCStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.LinodeVPCStatus)(nil), (*LinodeVPCStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus(a.(*v1alpha2.LinodeVPCStatus), b.(*LinodeVPCStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VPCIPv4)(nil), (*v1alpha2.VPCIPv4)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VPCIPv4_To_v1alpha2_VPCIPv4(a.(*VPCIPv4), b.(*v1alpha2.VPCIPv4), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.VPCIPv4)(nil), (*VPCIPv4)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_VPCIPv4_To_v1alpha1_VPCIPv4(a.(*v1alpha2.VPCIPv4), b.(*VPCIPv4), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VPCSubnetCreateOptions)(nil), (*v1alpha2.VPCSubnetCreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VPCSubnetCreateOptions_To_v1alpha2_VPCSubnetCreateOptions(a.(*VPCSubnetCreateOptions), b.(*v1alpha2.VPCSubnetCreateOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha2.VPCSubnetCreateOptions)(nil), (*VPCSubnetCreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_VPCSubnetCreateOptions_To_v1alpha1_VPCSubnetCreateOptions(a.(*v1alpha2.VPCSubnetCreateOptions), b.(*VPCSubnetCreateOptions), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*NetworkSpec)(nil), (*v1alpha2.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NetworkSpec_To_v1alpha2_NetworkSpec(a.(*NetworkSpec), b.(*v1alpha2.NetworkSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha2.NetworkSpec)(nil), (*NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_NetworkSpec_To_v1alpha1_NetworkSpec(a.(*v1alpha2.NetworkSpec), b.(*NetworkSpec), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_InstanceConfigInterfaceCreateOptions_To_v1alpha2_InstanceConfigInterfaceCreateOptions(in *InstanceConfigInterfaceCreateOptions, out *v1alpha2.InstanceConfigInterfaceCreateOptions, s conversion.Scope) error { + out.IPAMAddress = in.IPAMAddress + out.Label = in.Label + out.Purpose = linodego.ConfigInterfacePurpose(in.Purpose) + out.Primary = in.Primary + out.SubnetID = (*int)(unsafe.Pointer(in.SubnetID)) + out.IPv4 = (*v1alpha2.VPCIPv4)(unsafe.Pointer(in.IPv4)) + out.IPRanges = *(*[]string)(unsafe.Pointer(&in.IPRanges)) + return nil +} + +// Convert_v1alpha1_InstanceConfigInterfaceCreateOptions_To_v1alpha2_InstanceConfigInterfaceCreateOptions is an autogenerated conversion function. +func Convert_v1alpha1_InstanceConfigInterfaceCreateOptions_To_v1alpha2_InstanceConfigInterfaceCreateOptions(in *InstanceConfigInterfaceCreateOptions, out *v1alpha2.InstanceConfigInterfaceCreateOptions, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceConfigInterfaceCreateOptions_To_v1alpha2_InstanceConfigInterfaceCreateOptions(in, out, s) +} + +func autoConvert_v1alpha2_InstanceConfigInterfaceCreateOptions_To_v1alpha1_InstanceConfigInterfaceCreateOptions(in *v1alpha2.InstanceConfigInterfaceCreateOptions, out *InstanceConfigInterfaceCreateOptions, s conversion.Scope) error { + out.IPAMAddress = in.IPAMAddress + out.Label = in.Label + out.Purpose = linodego.ConfigInterfacePurpose(in.Purpose) + out.Primary = in.Primary + out.SubnetID = (*int)(unsafe.Pointer(in.SubnetID)) + out.IPv4 = (*VPCIPv4)(unsafe.Pointer(in.IPv4)) + out.IPRanges = *(*[]string)(unsafe.Pointer(&in.IPRanges)) + return nil +} + +// Convert_v1alpha2_InstanceConfigInterfaceCreateOptions_To_v1alpha1_InstanceConfigInterfaceCreateOptions is an autogenerated conversion function. +func Convert_v1alpha2_InstanceConfigInterfaceCreateOptions_To_v1alpha1_InstanceConfigInterfaceCreateOptions(in *v1alpha2.InstanceConfigInterfaceCreateOptions, out *InstanceConfigInterfaceCreateOptions, s conversion.Scope) error { + return autoConvert_v1alpha2_InstanceConfigInterfaceCreateOptions_To_v1alpha1_InstanceConfigInterfaceCreateOptions(in, out, s) +} + +func autoConvert_v1alpha1_InstanceDisk_To_v1alpha2_InstanceDisk(in *InstanceDisk, out *v1alpha2.InstanceDisk, s conversion.Scope) error { + out.DiskID = in.DiskID + out.Size = in.Size + out.Label = in.Label + out.Filesystem = in.Filesystem + return nil +} + +// Convert_v1alpha1_InstanceDisk_To_v1alpha2_InstanceDisk is an autogenerated conversion function. +func Convert_v1alpha1_InstanceDisk_To_v1alpha2_InstanceDisk(in *InstanceDisk, out *v1alpha2.InstanceDisk, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceDisk_To_v1alpha2_InstanceDisk(in, out, s) +} + +func autoConvert_v1alpha2_InstanceDisk_To_v1alpha1_InstanceDisk(in *v1alpha2.InstanceDisk, out *InstanceDisk, s conversion.Scope) error { + out.DiskID = in.DiskID + out.Size = in.Size + out.Label = in.Label + out.Filesystem = in.Filesystem + return nil +} + +// Convert_v1alpha2_InstanceDisk_To_v1alpha1_InstanceDisk is an autogenerated conversion function. +func Convert_v1alpha2_InstanceDisk_To_v1alpha1_InstanceDisk(in *v1alpha2.InstanceDisk, out *InstanceDisk, s conversion.Scope) error { + return autoConvert_v1alpha2_InstanceDisk_To_v1alpha1_InstanceDisk(in, out, s) +} + +func autoConvert_v1alpha1_InstanceMetadataOptions_To_v1alpha2_InstanceMetadataOptions(in *InstanceMetadataOptions, out *v1alpha2.InstanceMetadataOptions, s conversion.Scope) error { + out.UserData = in.UserData + return nil +} + +// Convert_v1alpha1_InstanceMetadataOptions_To_v1alpha2_InstanceMetadataOptions is an autogenerated conversion function. +func Convert_v1alpha1_InstanceMetadataOptions_To_v1alpha2_InstanceMetadataOptions(in *InstanceMetadataOptions, out *v1alpha2.InstanceMetadataOptions, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceMetadataOptions_To_v1alpha2_InstanceMetadataOptions(in, out, s) +} + +func autoConvert_v1alpha2_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(in *v1alpha2.InstanceMetadataOptions, out *InstanceMetadataOptions, s conversion.Scope) error { + out.UserData = in.UserData + return nil +} + +// Convert_v1alpha2_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions is an autogenerated conversion function. +func Convert_v1alpha2_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(in *v1alpha2.InstanceMetadataOptions, out *InstanceMetadataOptions, s conversion.Scope) error { + return autoConvert_v1alpha2_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(in, out, s) +} + +func autoConvert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster(in *LinodeCluster, out *v1alpha2.LinodeCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster is an autogenerated conversion function. +func Convert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster(in *LinodeCluster, out *v1alpha2.LinodeCluster, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster(in, out, s) +} + +func autoConvert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster(in *v1alpha2.LinodeCluster, out *LinodeCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster is an autogenerated conversion function. +func Convert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster(in *v1alpha2.LinodeCluster, out *LinodeCluster, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterList_To_v1alpha2_LinodeClusterList(in *LinodeClusterList, out *v1alpha2.LinodeClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha2.LinodeCluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_LinodeCluster_To_v1alpha2_LinodeCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_LinodeClusterList_To_v1alpha2_LinodeClusterList is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterList_To_v1alpha2_LinodeClusterList(in *LinodeClusterList, out *v1alpha2.LinodeClusterList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterList_To_v1alpha2_LinodeClusterList(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterList_To_v1alpha1_LinodeClusterList(in *v1alpha2.LinodeClusterList, out *LinodeClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinodeCluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_LinodeCluster_To_v1alpha1_LinodeCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_LinodeClusterList_To_v1alpha1_LinodeClusterList is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterList_To_v1alpha1_LinodeClusterList(in *v1alpha2.LinodeClusterList, out *LinodeClusterList, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterList_To_v1alpha1_LinodeClusterList(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(in *LinodeClusterSpec, out *v1alpha2.LinodeClusterSpec, s conversion.Scope) error { + out.Region = in.Region + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if err := Convert_v1alpha1_NetworkSpec_To_v1alpha2_NetworkSpec(&in.Network, &out.Network, s); err != nil { + return err + } + out.VPCRef = (*v1.ObjectReference)(unsafe.Pointer(in.VPCRef)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(in *LinodeClusterSpec, out *v1alpha2.LinodeClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(in *v1alpha2.LinodeClusterSpec, out *LinodeClusterSpec, s conversion.Scope) error { + out.Region = in.Region + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if err := Convert_v1alpha2_NetworkSpec_To_v1alpha1_NetworkSpec(&in.Network, &out.Network, s); err != nil { + return err + } + out.VPCRef = (*v1.ObjectReference)(unsafe.Pointer(in.VPCRef)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(in *v1alpha2.LinodeClusterSpec, out *LinodeClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus(in *LinodeClusterStatus, out *v1alpha2.LinodeClusterStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.FailureReason = (*errors.ClusterStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus(in *LinodeClusterStatus, out *v1alpha2.LinodeClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterStatus_To_v1alpha2_LinodeClusterStatus(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus(in *v1alpha2.LinodeClusterStatus, out *LinodeClusterStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.FailureReason = (*errors.ClusterStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus(in *v1alpha2.LinodeClusterStatus, out *LinodeClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterStatus_To_v1alpha1_LinodeClusterStatus(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(in *LinodeClusterTemplate, out *v1alpha2.LinodeClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(in *LinodeClusterTemplate, out *v1alpha2.LinodeClusterTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(in *v1alpha2.LinodeClusterTemplate, out *LinodeClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(in *v1alpha2.LinodeClusterTemplate, out *LinodeClusterTemplate, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList(in *LinodeClusterTemplateList, out *v1alpha2.LinodeClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha2.LinodeClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_LinodeClusterTemplate_To_v1alpha2_LinodeClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList(in *LinodeClusterTemplateList, out *v1alpha2.LinodeClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterTemplateList_To_v1alpha2_LinodeClusterTemplateList(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList(in *v1alpha2.LinodeClusterTemplateList, out *LinodeClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinodeClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_LinodeClusterTemplate_To_v1alpha1_LinodeClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList(in *v1alpha2.LinodeClusterTemplateList, out *LinodeClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterTemplateList_To_v1alpha1_LinodeClusterTemplateList(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource(in *LinodeClusterTemplateResource, out *v1alpha2.LinodeClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha1_LinodeClusterSpec_To_v1alpha2_LinodeClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource(in *LinodeClusterTemplateResource, out *v1alpha2.LinodeClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource(in *v1alpha2.LinodeClusterTemplateResource, out *LinodeClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha2_LinodeClusterSpec_To_v1alpha1_LinodeClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource(in *v1alpha2.LinodeClusterTemplateResource, out *LinodeClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource(in, out, s) +} + +func autoConvert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec(in *LinodeClusterTemplateSpec, out *v1alpha2.LinodeClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_LinodeClusterTemplateResource_To_v1alpha2_LinodeClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec(in *LinodeClusterTemplateSpec, out *v1alpha2.LinodeClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeClusterTemplateSpec_To_v1alpha2_LinodeClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec(in *v1alpha2.LinodeClusterTemplateSpec, out *LinodeClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha2_LinodeClusterTemplateResource_To_v1alpha1_LinodeClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec(in *v1alpha2.LinodeClusterTemplateSpec, out *LinodeClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeClusterTemplateSpec_To_v1alpha1_LinodeClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinodeMachine_To_v1alpha2_LinodeMachine(in *LinodeMachine, out *v1alpha2.LinodeMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeMachine_To_v1alpha2_LinodeMachine is an autogenerated conversion function. +func Convert_v1alpha1_LinodeMachine_To_v1alpha2_LinodeMachine(in *LinodeMachine, out *v1alpha2.LinodeMachine, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeMachine_To_v1alpha2_LinodeMachine(in, out, s) +} + +func autoConvert_v1alpha2_LinodeMachine_To_v1alpha1_LinodeMachine(in *v1alpha2.LinodeMachine, out *LinodeMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeMachine_To_v1alpha1_LinodeMachine is an autogenerated conversion function. +func Convert_v1alpha2_LinodeMachine_To_v1alpha1_LinodeMachine(in *v1alpha2.LinodeMachine, out *LinodeMachine, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeMachine_To_v1alpha1_LinodeMachine(in, out, s) +} + +func autoConvert_v1alpha1_LinodeMachineList_To_v1alpha2_LinodeMachineList(in *LinodeMachineList, out *v1alpha2.LinodeMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha2.LinodeMachine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_LinodeMachineList_To_v1alpha2_LinodeMachineList is an autogenerated conversion function. +func Convert_v1alpha1_LinodeMachineList_To_v1alpha2_LinodeMachineList(in *LinodeMachineList, out *v1alpha2.LinodeMachineList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeMachineList_To_v1alpha2_LinodeMachineList(in, out, s) +} + +func autoConvert_v1alpha2_LinodeMachineList_To_v1alpha1_LinodeMachineList(in *v1alpha2.LinodeMachineList, out *LinodeMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]LinodeMachine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_LinodeMachineList_To_v1alpha1_LinodeMachineList is an autogenerated conversion function. +func Convert_v1alpha2_LinodeMachineList_To_v1alpha1_LinodeMachineList(in *v1alpha2.LinodeMachineList, out *LinodeMachineList, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeMachineList_To_v1alpha1_LinodeMachineList(in, out, s) +} + +func autoConvert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec(in *LinodeMachineSpec, out *v1alpha2.LinodeMachineSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.InstanceID = (*int)(unsafe.Pointer(in.InstanceID)) + out.Region = in.Region + out.Type = in.Type + out.Group = in.Group + out.RootPass = in.RootPass + out.AuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.AuthorizedKeys)) + out.AuthorizedUsers = *(*[]string)(unsafe.Pointer(&in.AuthorizedUsers)) + out.BackupID = in.BackupID + out.Image = in.Image + out.Interfaces = *(*[]v1alpha2.InstanceConfigInterfaceCreateOptions)(unsafe.Pointer(&in.Interfaces)) + out.BackupsEnabled = in.BackupsEnabled + out.PrivateIP = (*bool)(unsafe.Pointer(in.PrivateIP)) + out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags)) + out.FirewallID = in.FirewallID + out.OSDisk = (*v1alpha2.InstanceDisk)(unsafe.Pointer(in.OSDisk)) + out.DataDisks = *(*map[string]*v1alpha2.InstanceDisk)(unsafe.Pointer(&in.DataDisks)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec(in *LinodeMachineSpec, out *v1alpha2.LinodeMachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeMachineSpec_To_v1alpha2_LinodeMachineSpec(in, out, s) +} + +func autoConvert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec(in *v1alpha2.LinodeMachineSpec, out *LinodeMachineSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.InstanceID = (*int)(unsafe.Pointer(in.InstanceID)) + out.Region = in.Region + out.Type = in.Type + out.Group = in.Group + out.RootPass = in.RootPass + out.AuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.AuthorizedKeys)) + out.AuthorizedUsers = *(*[]string)(unsafe.Pointer(&in.AuthorizedUsers)) + out.BackupID = in.BackupID + out.Image = in.Image + out.Interfaces = *(*[]InstanceConfigInterfaceCreateOptions)(unsafe.Pointer(&in.Interfaces)) + out.BackupsEnabled = in.BackupsEnabled + out.PrivateIP = (*bool)(unsafe.Pointer(in.PrivateIP)) + out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags)) + out.FirewallID = in.FirewallID + out.OSDisk = (*InstanceDisk)(unsafe.Pointer(in.OSDisk)) + out.DataDisks = *(*map[string]*InstanceDisk)(unsafe.Pointer(&in.DataDisks)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec is an autogenerated conversion function. +func Convert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec(in *v1alpha2.LinodeMachineSpec, out *LinodeMachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeMachineSpec_To_v1alpha1_LinodeMachineSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus(in *LinodeMachineStatus, out *v1alpha2.LinodeMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Addresses = *(*[]v1beta1.MachineAddress)(unsafe.Pointer(&in.Addresses)) + out.InstanceState = (*linodego.InstanceStatus)(unsafe.Pointer(in.InstanceState)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus is an autogenerated conversion function. +func Convert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus(in *LinodeMachineStatus, out *v1alpha2.LinodeMachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeMachineStatus_To_v1alpha2_LinodeMachineStatus(in, out, s) +} + +func autoConvert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus(in *v1alpha2.LinodeMachineStatus, out *LinodeMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Addresses = *(*[]v1beta1.MachineAddress)(unsafe.Pointer(&in.Addresses)) + out.InstanceState = (*linodego.InstanceStatus)(unsafe.Pointer(in.InstanceState)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus is an autogenerated conversion function. +func Convert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus(in *v1alpha2.LinodeMachineStatus, out *LinodeMachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeMachineStatus_To_v1alpha1_LinodeMachineStatus(in, out, s) +} + +func autoConvert_v1alpha1_LinodeVPC_To_v1alpha2_LinodeVPC(in *LinodeVPC, out *v1alpha2.LinodeVPC, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinodeVPC_To_v1alpha2_LinodeVPC is an autogenerated conversion function. +func Convert_v1alpha1_LinodeVPC_To_v1alpha2_LinodeVPC(in *LinodeVPC, out *v1alpha2.LinodeVPC, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeVPC_To_v1alpha2_LinodeVPC(in, out, s) +} + +func autoConvert_v1alpha2_LinodeVPC_To_v1alpha1_LinodeVPC(in *v1alpha2.LinodeVPC, out *LinodeVPC, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_LinodeVPC_To_v1alpha1_LinodeVPC is an autogenerated conversion function. +func Convert_v1alpha2_LinodeVPC_To_v1alpha1_LinodeVPC(in *v1alpha2.LinodeVPC, out *LinodeVPC, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeVPC_To_v1alpha1_LinodeVPC(in, out, s) +} + +func autoConvert_v1alpha1_LinodeVPCList_To_v1alpha2_LinodeVPCList(in *LinodeVPCList, out *v1alpha2.LinodeVPCList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha2.LinodeVPC)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_LinodeVPCList_To_v1alpha2_LinodeVPCList is an autogenerated conversion function. +func Convert_v1alpha1_LinodeVPCList_To_v1alpha2_LinodeVPCList(in *LinodeVPCList, out *v1alpha2.LinodeVPCList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeVPCList_To_v1alpha2_LinodeVPCList(in, out, s) +} + +func autoConvert_v1alpha2_LinodeVPCList_To_v1alpha1_LinodeVPCList(in *v1alpha2.LinodeVPCList, out *LinodeVPCList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]LinodeVPC)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_LinodeVPCList_To_v1alpha1_LinodeVPCList is an autogenerated conversion function. +func Convert_v1alpha2_LinodeVPCList_To_v1alpha1_LinodeVPCList(in *v1alpha2.LinodeVPCList, out *LinodeVPCList, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeVPCList_To_v1alpha1_LinodeVPCList(in, out, s) +} + +func autoConvert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec(in *LinodeVPCSpec, out *v1alpha2.LinodeVPCSpec, s conversion.Scope) error { + out.VPCID = (*int)(unsafe.Pointer(in.VPCID)) + out.Description = in.Description + out.Region = in.Region + out.Subnets = *(*[]v1alpha2.VPCSubnetCreateOptions)(unsafe.Pointer(&in.Subnets)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec(in *LinodeVPCSpec, out *v1alpha2.LinodeVPCSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeVPCSpec_To_v1alpha2_LinodeVPCSpec(in, out, s) +} + +func autoConvert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec(in *v1alpha2.LinodeVPCSpec, out *LinodeVPCSpec, s conversion.Scope) error { + out.VPCID = (*int)(unsafe.Pointer(in.VPCID)) + out.Description = in.Description + out.Region = in.Region + out.Subnets = *(*[]VPCSubnetCreateOptions)(unsafe.Pointer(&in.Subnets)) + out.CredentialsRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsRef)) + return nil +} + +// Convert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec is an autogenerated conversion function. +func Convert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec(in *v1alpha2.LinodeVPCSpec, out *LinodeVPCSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeVPCSpec_To_v1alpha1_LinodeVPCSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus(in *LinodeVPCStatus, out *v1alpha2.LinodeVPCStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.FailureReason = (*v1alpha2.VPCStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus is an autogenerated conversion function. +func Convert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus(in *LinodeVPCStatus, out *v1alpha2.LinodeVPCStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LinodeVPCStatus_To_v1alpha2_LinodeVPCStatus(in, out, s) +} + +func autoConvert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus(in *v1alpha2.LinodeVPCStatus, out *LinodeVPCStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.FailureReason = (*VPCStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Conditions = *(*v1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus is an autogenerated conversion function. +func Convert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus(in *v1alpha2.LinodeVPCStatus, out *LinodeVPCStatus, s conversion.Scope) error { + return autoConvert_v1alpha2_LinodeVPCStatus_To_v1alpha1_LinodeVPCStatus(in, out, s) +} + +func autoConvert_v1alpha1_NetworkSpec_To_v1alpha2_NetworkSpec(in *NetworkSpec, out *v1alpha2.NetworkSpec, s conversion.Scope) error { + out.LoadBalancerType = in.LoadBalancerType + // WARNING: in.LoadBalancerPort requires manual conversion: does not exist in peer-type + out.NodeBalancerID = (*int)(unsafe.Pointer(in.NodeBalancerID)) + // WARNING: in.NodeBalancerConfigID requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_NetworkSpec_To_v1alpha1_NetworkSpec(in *v1alpha2.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { + out.LoadBalancerType = in.LoadBalancerType + // WARNING: in.DNSProvider requires manual conversion: does not exist in peer-type + // WARNING: in.DNSRootDomain requires manual conversion: does not exist in peer-type + // WARNING: in.DNSUniqueIdentifier requires manual conversion: does not exist in peer-type + // WARNING: in.DNSTTLSec requires manual conversion: does not exist in peer-type + // WARNING: in.ApiserverLoadBalancerPort requires manual conversion: does not exist in peer-type + out.NodeBalancerID = (*int)(unsafe.Pointer(in.NodeBalancerID)) + // WARNING: in.ApiserverNodeBalancerConfigID requires manual conversion: does not exist in peer-type + // WARNING: in.AdditionalPorts requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha1_VPCIPv4_To_v1alpha2_VPCIPv4(in *VPCIPv4, out *v1alpha2.VPCIPv4, s conversion.Scope) error { + out.VPC = in.VPC + out.NAT1To1 = in.NAT1To1 + return nil +} + +// Convert_v1alpha1_VPCIPv4_To_v1alpha2_VPCIPv4 is an autogenerated conversion function. +func Convert_v1alpha1_VPCIPv4_To_v1alpha2_VPCIPv4(in *VPCIPv4, out *v1alpha2.VPCIPv4, s conversion.Scope) error { + return autoConvert_v1alpha1_VPCIPv4_To_v1alpha2_VPCIPv4(in, out, s) +} + +func autoConvert_v1alpha2_VPCIPv4_To_v1alpha1_VPCIPv4(in *v1alpha2.VPCIPv4, out *VPCIPv4, s conversion.Scope) error { + out.VPC = in.VPC + out.NAT1To1 = in.NAT1To1 + return nil +} + +// Convert_v1alpha2_VPCIPv4_To_v1alpha1_VPCIPv4 is an autogenerated conversion function. +func Convert_v1alpha2_VPCIPv4_To_v1alpha1_VPCIPv4(in *v1alpha2.VPCIPv4, out *VPCIPv4, s conversion.Scope) error { + return autoConvert_v1alpha2_VPCIPv4_To_v1alpha1_VPCIPv4(in, out, s) +} + +func autoConvert_v1alpha1_VPCSubnetCreateOptions_To_v1alpha2_VPCSubnetCreateOptions(in *VPCSubnetCreateOptions, out *v1alpha2.VPCSubnetCreateOptions, s conversion.Scope) error { + out.Label = in.Label + out.IPv4 = in.IPv4 + return nil +} + +// Convert_v1alpha1_VPCSubnetCreateOptions_To_v1alpha2_VPCSubnetCreateOptions is an autogenerated conversion function. +func Convert_v1alpha1_VPCSubnetCreateOptions_To_v1alpha2_VPCSubnetCreateOptions(in *VPCSubnetCreateOptions, out *v1alpha2.VPCSubnetCreateOptions, s conversion.Scope) error { + return autoConvert_v1alpha1_VPCSubnetCreateOptions_To_v1alpha2_VPCSubnetCreateOptions(in, out, s) +} + +func autoConvert_v1alpha2_VPCSubnetCreateOptions_To_v1alpha1_VPCSubnetCreateOptions(in *v1alpha2.VPCSubnetCreateOptions, out *VPCSubnetCreateOptions, s conversion.Scope) error { + out.Label = in.Label + out.IPv4 = in.IPv4 + return nil +} + +// Convert_v1alpha2_VPCSubnetCreateOptions_To_v1alpha1_VPCSubnetCreateOptions is an autogenerated conversion function. +func Convert_v1alpha2_VPCSubnetCreateOptions_To_v1alpha1_VPCSubnetCreateOptions(in *v1alpha2.VPCSubnetCreateOptions, out *VPCSubnetCreateOptions, s conversion.Scope) error { + return autoConvert_v1alpha2_VPCSubnetCreateOptions_To_v1alpha1_VPCSubnetCreateOptions(in, out, s) +} diff --git a/api/v1alpha2/linodeclustertemplate_conversion.go b/api/v1alpha2/linodeclustertemplate_conversion.go new file mode 100644 index 00000000..c85dfcda --- /dev/null +++ b/api/v1alpha2/linodeclustertemplate_conversion.go @@ -0,0 +1,23 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +// Hub marks LinodeClusterTemplate as a conversion hub. +func (*LinodeClusterTemplate) Hub() {} + +// Hub marks LinodeClusterTemplateList as a conversion hub. +func (*LinodeClusterTemplateList) Hub() {} diff --git a/api/v1alpha2/linodeclustertemplate_types.go b/api/v1alpha2/linodeclustertemplate_types.go new file mode 100644 index 00000000..df156548 --- /dev/null +++ b/api/v1alpha2/linodeclustertemplate_types.go @@ -0,0 +1,56 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinodeClusterTemplateSpec defines the desired state of LinodeClusterTemplate +type LinodeClusterTemplateSpec struct { + Template LinodeClusterTemplateResource `json:"template"` +} + +// LinodeClusterTemplateResource describes the data needed to create a LinodeCluster from a template. +type LinodeClusterTemplateResource struct { + Spec LinodeClusterSpec `json:"spec"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=linodeclustertemplates,scope=Namespaced,categories=cluster-api,shortName=lct +// +kubebuilder:storageversion + +// LinodeClusterTemplate is the Schema for the linodeclustertemplates API +type LinodeClusterTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec LinodeClusterTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// LinodeClusterTemplateList contains a list of LinodeClusterTemplate +type LinodeClusterTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LinodeClusterTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&LinodeClusterTemplate{}, &LinodeClusterTemplateList{}) +} diff --git a/api/v1alpha2/linodeclustertemplate_webhook.go b/api/v1alpha2/linodeclustertemplate_webhook.go new file mode 100644 index 00000000..1c24ff85 --- /dev/null +++ b/api/v1alpha2/linodeclustertemplate_webhook.go @@ -0,0 +1,28 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +// SetupWebhookWithManager will setup the manager to manage the webhooks +func (r *LinodeClusterTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/api/v1alpha2/linodeclustertemplate_webhook_test.go b/api/v1alpha2/linodeclustertemplate_webhook_test.go new file mode 100644 index 00000000..2e97366d --- /dev/null +++ b/api/v1alpha2/linodeclustertemplate_webhook_test.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 Akamai Technologies, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + . "github.com/onsi/ginkgo/v2" +) + +var _ = Describe("LinodeClusterTemplate Webhook", func() { + + Context("When creating LinodeClusterTemplate under Conversion Webhook", func() { + It("Should get the converted version of LinodeClusterTemplate", func() { + + // TODO(user): Add your logic here + + }) + }) + +}) diff --git a/api/v1alpha2/webhook_helpers.go b/api/v1alpha2/webhook_helpers.go index 93137133..06fbab7b 100644 --- a/api/v1alpha2/webhook_helpers.go +++ b/api/v1alpha2/webhook_helpers.go @@ -25,6 +25,7 @@ import ( "github.com/linode/linodego" "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" "github.com/linode/cluster-api-provider-linode/observability/wrappers/linodeclient" @@ -38,14 +39,10 @@ const ( defaultClientTimeout = time.Second * 10 ) -func mkptr[T any](v T) *T { - return &v -} - var ( // defaultLinodeClient is an unauthenticated Linode client defaultLinodeClient = linodeclient.NewLinodeClientWithTracing( - mkptr(linodego.NewClient(&http.Client{Timeout: defaultClientTimeout})), + ptr.To(linodego.NewClient(&http.Client{Timeout: defaultClientTimeout})), ) ) diff --git a/api/v1alpha2/zz_generated.deepcopy.go b/api/v1alpha2/zz_generated.deepcopy.go index 828eb70b..12bf16a4 100644 --- a/api/v1alpha2/zz_generated.deepcopy.go +++ b/api/v1alpha2/zz_generated.deepcopy.go @@ -207,6 +207,96 @@ func (in *LinodeClusterStatus) DeepCopy() *LinodeClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplate) DeepCopyInto(out *LinodeClusterTemplate) { + *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 LinodeClusterTemplate. +func (in *LinodeClusterTemplate) DeepCopy() *LinodeClusterTemplate { + if in == nil { + return nil + } + out := new(LinodeClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeClusterTemplate) 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 *LinodeClusterTemplateList) DeepCopyInto(out *LinodeClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinodeClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateList. +func (in *LinodeClusterTemplateList) DeepCopy() *LinodeClusterTemplateList { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinodeClusterTemplateList) 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 *LinodeClusterTemplateResource) DeepCopyInto(out *LinodeClusterTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateResource. +func (in *LinodeClusterTemplateResource) DeepCopy() *LinodeClusterTemplateResource { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeClusterTemplateSpec) DeepCopyInto(out *LinodeClusterTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeClusterTemplateSpec. +func (in *LinodeClusterTemplateSpec) DeepCopy() *LinodeClusterTemplateSpec { + if in == nil { + return nil + } + out := new(LinodeClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LinodeMachine) DeepCopyInto(out *LinodeMachine) { *out = *in diff --git a/cmd/main.go b/cmd/main.go index 4e1270f0..a9ee2aea 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -267,14 +267,26 @@ func setupWebhooks(mgr manager.Manager) { setupLog.Error(err, "unable to create webhook", "webhook", "LinodeCluster") os.Exit(1) } + if err = (&infrastructurev1alpha2.LinodeClusterTemplate{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "LinodeCluster") + os.Exit(1) + } if err = (&infrastructurev1alpha1.LinodeMachine{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "LinodeMachine") os.Exit(1) } + if err = (&infrastructurev1alpha2.LinodeMachine{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "LinodeMachine") + os.Exit(1) + } if err = (&infrastructurev1alpha1.LinodeVPC{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "LinodeVPC") os.Exit(1) } + if err = (&infrastructurev1alpha2.LinodeVPC{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "LinodeVPC") + os.Exit(1) + } if err = (&infrastructurev1alpha1.LinodeObjectStorageBucket{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "LinodeObjectStorageBucket") os.Exit(1) diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml index 681e3cdc..57731ef1 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml @@ -130,6 +130,221 @@ spec: will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + Instead of using this type, create a locally provided and used type that is well-focused on your reference. + For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf + required: + - region + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: false + - name: v1alpha2 + schema: + openAPIV3Schema: + description: LinodeClusterTemplate is the Schema for the linodeclustertemplates + 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: LinodeClusterTemplateSpec defines the desired state of LinodeClusterTemplate + properties: + template: + description: LinodeClusterTemplateResource describes the data needed + to create a LinodeCluster from a template. + properties: + spec: + description: LinodeClusterSpec defines the desired state of LinodeCluster + properties: + controlPlaneEndpoint: + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the LinodeCluster control plane. + If ControlPlaneEndpoint is unset then the Nodebalancer ip will be used. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + credentialsRef: + description: |- + CredentialsRef is a reference to a Secret that contains the credentials to use for provisioning this cluster. If not + supplied then the credentials of the controller will be used. + properties: + name: + description: name is unique within a namespace to reference + a secret resource. + type: string + namespace: + description: namespace defines the space within which + the secret name must be unique. + type: string + type: object + x-kubernetes-map-type: atomic + network: + description: NetworkSpec encapsulates all things related to + Linode network. + properties: + additionalPorts: + description: additionalPorts contains list of ports to + be configured with NodeBalancer. + items: + properties: + nodeBalancerConfigID: + description: nodeBalancerConfigID is the config + ID of port's NodeBalancer config. + type: integer + port: + description: port configured on the NodeBalancer. + It must be valid port range (1-65535). + maximum: 65535 + minimum: 1 + type: integer + required: + - port + type: object + type: array + apiserverLoadBalancerPort: + description: |- + apiserverLoadBalancerPort used by the api server. It must be valid ports range (1-65535). + If omitted, default value is 6443. + maximum: 65535 + minimum: 1 + type: integer + apiserverNodeBalancerConfigID: + description: apiserverNodeBalancerConfigID is the config + ID of api server NodeBalancer config. + type: integer + dnsProvider: + description: |- + DNSProvider is provider who manages the domain + Ignored if the LoadBalancerType is set to anything other than dns + If not set, defaults linode dns + enum: + - linode + - akamai + type: string + dnsRootDomain: + description: |- + DNSRootDomain is the root domain used to create a DNS entry for the control-plane endpoint + Ignored if the LoadBalancerType is set to anything other than dns + type: string + dnsTTLsec: + description: |- + DNSTTLSec is the TTL for the domain record + Ignored if the LoadBalancerType is set to anything other than dns + If not set, defaults to 30 + type: integer + dnsUniqueIdentifier: + description: |- + DNSUniqueIdentifier is the unique identifier for the DNS. This let clusters with the same name have unique + DNS record + Ignored if the LoadBalancerType is set to anything other than dns + If not set, CAPL will create a unique identifier for you + type: string + loadBalancerType: + description: LoadBalancerType is the type of load balancer + to use, defaults to NodeBalancer if not otherwise set + enum: + - NodeBalancer + - dns + type: string + nodeBalancerID: + description: NodeBalancerID is the id of NodeBalancer. + type: integer + type: object + region: + description: The Linode Region the LinodeCluster lives in. + type: string + vpcRef: + description: |- + ObjectReference contains enough information to let you inspect or modify the referred object. + --- + New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. + 1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage. + 2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular + restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". + Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. + 4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity + during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple + and the version of the actual struct is irrelevant. + 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + + Instead of using this type, create a locally provided and used type that is well-focused on your reference. For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . properties: diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 3693467d..e867863e 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -32,6 +32,7 @@ patches: - path: patches/webhook_in_linodemachines.yaml - path: patches/webhook_in_linodevpcs.yaml - path: patches/webhook_in_linodevpcs.yaml +- path: patches/webhook_in_linodeclustertemplates.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch - path: patches/capicontract_in_linodeclusters.yaml diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml index 72949c72..c72c7aad 100644 --- a/config/rbac/kustomization.yaml +++ b/config/rbac/kustomization.yaml @@ -20,6 +20,8 @@ resources: # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines # if you do not want those helpers be installed with your Project. +- linodeclustertemplate_editor_role.yaml +- linodeclustertemplate_viewer_role.yaml - linodevpc_editor_role.yaml - linodevpc_viewer_role.yaml - linodemachine_editor_role.yaml diff --git a/config/samples/infrastructure_v1alpha2_linodeclustertemplate.yaml b/config/samples/infrastructure_v1alpha2_linodeclustertemplate.yaml new file mode 100644 index 00000000..543b4857 --- /dev/null +++ b/config/samples/infrastructure_v1alpha2_linodeclustertemplate.yaml @@ -0,0 +1,9 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: LinodeClusterTemplate +metadata: + labels: + app.kubernetes.io/name: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + name: linodeclustertemplate-sample +spec: + # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index f2a7e04b..66b59dad 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -9,4 +9,5 @@ resources: - infrastructure_v1alpha2_linodecluster.yaml - infrastructure_v1alpha2_linodemachine.yaml - infrastructure_v1alpha2_linodevpc.yaml +- infrastructure_v1alpha2_linodeclustertemplate.yaml #+kubebuilder:scaffold:manifestskustomizesamples