From 4be5d1d84fa1c09cdfd0d0c2298f33639660a4b4 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 21 Sep 2021 08:57:56 -0700 Subject: [PATCH 06/34] add support for registry mirror for bottlerocket --- api/v1alpha2/zz_generated.conversion.go | 1007 +++++++++++++++++ .../kubeadm/api/v1beta1/kubeadm_types.go | 19 + ...strap.cluster.x-k8s.io_kubeadmconfigs.yaml | 48 + ...uster.x-k8s.io_kubeadmconfigtemplates.yaml | 52 + .../internal/bottlerocket/bootstrap.go | 19 + .../internal/bottlerocket/bottlerocket.go | 20 +- .../controllers/kubeadmconfig_controller.go | 9 + .../kubeadm/types/upstreamv1beta1/types.go | 19 + .../upstreamv1beta1/zz_generated.deepcopy.go | 17 + ...cluster.x-k8s.io_kubeadmcontrolplanes.yaml | 52 + ...x-k8s.io_kubeadmcontrolplanetemplates.yaml | 26 + 11 files changed, 1284 insertions(+), 4 deletions(-) create mode 100644 api/v1alpha2/zz_generated.conversion.go diff --git a/api/v1alpha2/zz_generated.conversion.go b/api/v1alpha2/zz_generated.conversion.go new file mode 100644 index 000000000..68299ede9 --- /dev/null +++ b/api/v1alpha2/zz_generated.conversion.go @@ -0,0 +1,1007 @@ +// +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 v1alpha2 + +import ( + unsafe "unsafe" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" + v1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" +) + +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((*APIEndpoint)(nil), (*v1alpha3.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(a.(*APIEndpoint), b.(*v1alpha3.APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.APIEndpoint)(nil), (*APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(a.(*v1alpha3.APIEndpoint), b.(*APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Bootstrap)(nil), (*v1alpha3.Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(a.(*Bootstrap), b.(*v1alpha3.Bootstrap), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*v1alpha3.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(a.(*Cluster), b.(*v1alpha3.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(a.(*v1alpha3.Cluster), b.(*Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterList)(nil), (*v1alpha3.ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(a.(*ClusterList), b.(*v1alpha3.ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterList)(nil), (*ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(a.(*v1alpha3.ClusterList), b.(*ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterNetwork)(nil), (*v1alpha3.ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(a.(*ClusterNetwork), b.(*v1alpha3.ClusterNetwork), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterNetwork)(nil), (*ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(a.(*v1alpha3.ClusterNetwork), b.(*ClusterNetwork), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Machine)(nil), (*v1alpha3.Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_Machine_To_v1alpha3_Machine(a.(*Machine), b.(*v1alpha3.Machine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Machine)(nil), (*Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Machine_To_v1alpha2_Machine(a.(*v1alpha3.Machine), b.(*Machine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineAddress)(nil), (*v1alpha3.MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(a.(*MachineAddress), b.(*v1alpha3.MachineAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineAddress)(nil), (*MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(a.(*v1alpha3.MachineAddress), b.(*MachineAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeployment)(nil), (*v1alpha3.MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(a.(*MachineDeployment), b.(*v1alpha3.MachineDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeployment)(nil), (*MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(a.(*v1alpha3.MachineDeployment), b.(*MachineDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentList)(nil), (*v1alpha3.MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(a.(*MachineDeploymentList), b.(*v1alpha3.MachineDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeploymentList)(nil), (*MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(a.(*v1alpha3.MachineDeploymentList), b.(*MachineDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentSpec)(nil), (*v1alpha3.MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(a.(*MachineDeploymentSpec), b.(*v1alpha3.MachineDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentStatus)(nil), (*v1alpha3.MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(a.(*MachineDeploymentStatus), b.(*v1alpha3.MachineDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentStrategy)(nil), (*v1alpha3.MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(a.(*MachineDeploymentStrategy), b.(*v1alpha3.MachineDeploymentStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeploymentStrategy)(nil), (*MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(a.(*v1alpha3.MachineDeploymentStrategy), b.(*MachineDeploymentStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1alpha3.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineList_To_v1alpha3_MachineList(a.(*MachineList), b.(*v1alpha3.MachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineList)(nil), (*MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineList_To_v1alpha2_MachineList(a.(*v1alpha3.MachineList), b.(*MachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineRollingUpdateDeployment)(nil), (*v1alpha3.MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(a.(*MachineRollingUpdateDeployment), b.(*v1alpha3.MachineRollingUpdateDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineRollingUpdateDeployment)(nil), (*MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(a.(*v1alpha3.MachineRollingUpdateDeployment), b.(*MachineRollingUpdateDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSet)(nil), (*v1alpha3.MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(a.(*MachineSet), b.(*v1alpha3.MachineSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineSet)(nil), (*MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(a.(*v1alpha3.MachineSet), b.(*MachineSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSetList)(nil), (*v1alpha3.MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(a.(*MachineSetList), b.(*v1alpha3.MachineSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineSetList)(nil), (*MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(a.(*v1alpha3.MachineSetList), b.(*MachineSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSetSpec)(nil), (*v1alpha3.MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(a.(*MachineSetSpec), b.(*v1alpha3.MachineSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineTemplateSpec)(nil), (*v1alpha3.MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(a.(*MachineTemplateSpec), b.(*v1alpha3.MachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineTemplateSpec)(nil), (*MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(a.(*v1alpha3.MachineTemplateSpec), b.(*MachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkRanges)(nil), (*v1alpha3.NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(a.(*NetworkRanges), b.(*v1alpha3.NetworkRanges), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.NetworkRanges)(nil), (*NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(a.(*v1alpha3.NetworkRanges), b.(*NetworkRanges), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ObjectMeta)(nil), (*v1alpha3.ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(a.(*ObjectMeta), b.(*v1alpha3.ObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ObjectMeta)(nil), (*ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(a.(*v1alpha3.ObjectMeta), b.(*ObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*ClusterSpec)(nil), (*v1alpha3.ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(a.(*ClusterSpec), b.(*v1alpha3.ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*ClusterStatus)(nil), (*v1alpha3.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(a.(*ClusterStatus), b.(*v1alpha3.ClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*MachineSetStatus)(nil), (*v1alpha3.MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(a.(*MachineSetStatus), b.(*v1alpha3.MachineSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*MachineSpec)(nil), (*v1alpha3.MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(a.(*MachineSpec), b.(*v1alpha3.MachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*MachineStatus)(nil), (*v1alpha3.MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(a.(*MachineStatus), b.(*v1alpha3.MachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.Bootstrap)(nil), (*Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(a.(*v1alpha3.Bootstrap), b.(*Bootstrap), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(a.(*v1alpha3.ClusterSpec), b.(*ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(a.(*v1alpha3.ClusterStatus), b.(*ClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineDeploymentSpec)(nil), (*MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(a.(*v1alpha3.MachineDeploymentSpec), b.(*MachineDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineDeploymentStatus)(nil), (*MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(a.(*v1alpha3.MachineDeploymentStatus), b.(*MachineDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineSetSpec)(nil), (*MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(a.(*v1alpha3.MachineSetSpec), b.(*MachineSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineSetStatus)(nil), (*MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(a.(*v1alpha3.MachineSetStatus), b.(*MachineSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineSpec)(nil), (*MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(a.(*v1alpha3.MachineSpec), b.(*MachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.MachineStatus)(nil), (*MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(a.(*v1alpha3.MachineStatus), b.(*MachineStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in *APIEndpoint, out *v1alpha3.APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = int32(in.Port) + return nil +} + +// Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in *APIEndpoint, out *v1alpha3.APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in *v1alpha3.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = int(in.Port) + return nil +} + +// Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in *v1alpha3.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in *Bootstrap, out *v1alpha3.Bootstrap, s conversion.Scope) error { + out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) + out.Data = (*string)(unsafe.Pointer(in.Data)) + return nil +} + +// Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap is an autogenerated conversion function. +func Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in *Bootstrap, out *v1alpha3.Bootstrap, s conversion.Scope) error { + return autoConvert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in, out, s) +} + +func autoConvert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(in *v1alpha3.Bootstrap, out *Bootstrap, s conversion.Scope) error { + out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) + out.Data = (*string)(unsafe.Pointer(in.Data)) + // WARNING: in.DataSecretName requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_Cluster_To_v1alpha3_Cluster(in *Cluster, out *v1alpha3.Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_Cluster_To_v1alpha3_Cluster is an autogenerated conversion function. +func Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(in *Cluster, out *v1alpha3.Cluster, s conversion.Scope) error { + return autoConvert_v1alpha2_Cluster_To_v1alpha3_Cluster(in, out, s) +} + +func autoConvert_v1alpha3_Cluster_To_v1alpha2_Cluster(in *v1alpha3.Cluster, out *Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Cluster_To_v1alpha2_Cluster is an autogenerated conversion function. +func Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(in *v1alpha3.Cluster, out *Cluster, s conversion.Scope) error { + return autoConvert_v1alpha3_Cluster_To_v1alpha2_Cluster(in, out, s) +} + +func autoConvert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in *ClusterList, out *v1alpha3.ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.Cluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList is an autogenerated conversion function. +func Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in *ClusterList, out *v1alpha3.ClusterList, s conversion.Scope) error { + return autoConvert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in, out, s) +} + +func autoConvert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in *v1alpha3.ClusterList, out *ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList is an autogenerated conversion function. +func Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in *v1alpha3.ClusterList, out *ClusterList, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in, out, s) +} + +func autoConvert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *ClusterNetwork, out *v1alpha3.ClusterNetwork, s conversion.Scope) error { + out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) + out.Services = (*v1alpha3.NetworkRanges)(unsafe.Pointer(in.Services)) + out.Pods = (*v1alpha3.NetworkRanges)(unsafe.Pointer(in.Pods)) + out.ServiceDomain = in.ServiceDomain + return nil +} + +// Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork is an autogenerated conversion function. +func Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *ClusterNetwork, out *v1alpha3.ClusterNetwork, s conversion.Scope) error { + return autoConvert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in, out, s) +} + +func autoConvert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in *v1alpha3.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { + out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) + out.Services = (*NetworkRanges)(unsafe.Pointer(in.Services)) + out.Pods = (*NetworkRanges)(unsafe.Pointer(in.Pods)) + out.ServiceDomain = in.ServiceDomain + return nil +} + +// Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork is an autogenerated conversion function. +func Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in *v1alpha3.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in, out, s) +} + +func autoConvert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(in *ClusterSpec, out *v1alpha3.ClusterSpec, s conversion.Scope) error { + out.ClusterNetwork = (*v1alpha3.ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) + out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) + return nil +} + +func autoConvert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(in *v1alpha3.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { + // WARNING: in.Paused requires manual conversion: does not exist in peer-type + out.ClusterNetwork = (*ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) + // WARNING: in.ControlPlaneEndpoint requires manual conversion: does not exist in peer-type + // WARNING: in.ControlPlaneRef requires manual conversion: does not exist in peer-type + // WARNING: in.ManagedExternalEtcdRef requires manual conversion: does not exist in peer-type + out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) + return nil +} + +func autoConvert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in *ClusterStatus, out *v1alpha3.ClusterStatus, s conversion.Scope) error { + // WARNING: in.APIEndpoints requires manual conversion: does not exist in peer-type + // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type + // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type + out.Phase = in.Phase + out.InfrastructureReady = in.InfrastructureReady + out.ControlPlaneInitialized = in.ControlPlaneInitialized + return nil +} + +func autoConvert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in *v1alpha3.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { + // WARNING: in.FailureDomains requires manual conversion: does not exist in peer-type + // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type + // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type + out.Phase = in.Phase + out.InfrastructureReady = in.InfrastructureReady + out.ControlPlaneInitialized = in.ControlPlaneInitialized + // WARNING: in.ControlPlaneReady requires manual conversion: does not exist in peer-type + // WARNING: in.Conditions requires manual conversion: does not exist in peer-type + // WARNING: in.ObservedGeneration requires manual conversion: does not exist in peer-type + // WARNING: in.ManagedExternalEtcdInitialized requires manual conversion: does not exist in peer-type + // WARNING: in.ManagedExternalEtcdReady requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_Machine_To_v1alpha3_Machine(in *Machine, out *v1alpha3.Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_Machine_To_v1alpha3_Machine is an autogenerated conversion function. +func Convert_v1alpha2_Machine_To_v1alpha3_Machine(in *Machine, out *v1alpha3.Machine, s conversion.Scope) error { + return autoConvert_v1alpha2_Machine_To_v1alpha3_Machine(in, out, s) +} + +func autoConvert_v1alpha3_Machine_To_v1alpha2_Machine(in *v1alpha3.Machine, out *Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Machine_To_v1alpha2_Machine is an autogenerated conversion function. +func Convert_v1alpha3_Machine_To_v1alpha2_Machine(in *v1alpha3.Machine, out *Machine, s conversion.Scope) error { + return autoConvert_v1alpha3_Machine_To_v1alpha2_Machine(in, out, s) +} + +func autoConvert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in *MachineAddress, out *v1alpha3.MachineAddress, s conversion.Scope) error { + out.Type = v1alpha3.MachineAddressType(in.Type) + out.Address = in.Address + return nil +} + +// Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress is an autogenerated conversion function. +func Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in *MachineAddress, out *v1alpha3.MachineAddress, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in, out, s) +} + +func autoConvert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in *v1alpha3.MachineAddress, out *MachineAddress, s conversion.Scope) error { + out.Type = MachineAddressType(in.Type) + out.Address = in.Address + return nil +} + +// Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress is an autogenerated conversion function. +func Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in *v1alpha3.MachineAddress, out *MachineAddress, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in, out, s) +} + +func autoConvert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in *MachineDeployment, out *v1alpha3.MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment is an autogenerated conversion function. +func Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in *MachineDeployment, out *v1alpha3.MachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in *v1alpha3.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in *v1alpha3.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in, out, s) +} + +func autoConvert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha3.MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.MachineDeployment, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList is an autogenerated conversion function. +func Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha3.MachineDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in *v1alpha3.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in *v1alpha3.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in, out, s) +} + +func autoConvert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha3.MachineDeploymentSpec, s conversion.Scope) error { + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Selector = in.Selector + if err := Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.Strategy = (*v1alpha3.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +// Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec is an autogenerated conversion function. +func Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha3.MachineDeploymentSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(in *v1alpha3.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { + // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Selector = in.Selector + if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.Strategy = (*MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +func autoConvert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha3.MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + return nil +} + +// Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus is an autogenerated conversion function. +func Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha3.MachineDeploymentStatus, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(in *v1alpha3.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + // WARNING: in.Phase requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha3.MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = v1alpha3.MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*v1alpha3.MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha3.MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in *v1alpha3.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in *v1alpha3.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_v1alpha2_MachineList_To_v1alpha3_MachineList(in *MachineList, out *v1alpha3.MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.Machine, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_Machine_To_v1alpha3_Machine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_MachineList_To_v1alpha3_MachineList is an autogenerated conversion function. +func Convert_v1alpha2_MachineList_To_v1alpha3_MachineList(in *MachineList, out *v1alpha3.MachineList, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineList_To_v1alpha3_MachineList(in, out, s) +} + +func autoConvert_v1alpha3_MachineList_To_v1alpha2_MachineList(in *v1alpha3.MachineList, out *MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_Machine_To_v1alpha2_Machine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_MachineList_To_v1alpha2_MachineList is an autogenerated conversion function. +func Convert_v1alpha3_MachineList_To_v1alpha2_MachineList(in *v1alpha3.MachineList, out *MachineList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineList_To_v1alpha2_MachineList(in, out, s) +} + +func autoConvert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha3.MachineRollingUpdateDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment is an autogenerated conversion function. +func Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha3.MachineRollingUpdateDeployment, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in, out, s) +} + +func autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in *v1alpha3.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment is an autogenerated conversion function. +func Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in *v1alpha3.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in, out, s) +} + +func autoConvert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in *MachineSet, out *v1alpha3.MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet is an autogenerated conversion function. +func Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in *MachineSet, out *v1alpha3.MachineSet, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in, out, s) +} + +func autoConvert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in *v1alpha3.MachineSet, out *MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet is an autogenerated conversion function. +func Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in *v1alpha3.MachineSet, out *MachineSet, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in, out, s) +} + +func autoConvert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in *MachineSetList, out *v1alpha3.MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.MachineSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList is an autogenerated conversion function. +func Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in *MachineSetList, out *v1alpha3.MachineSetList, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in, out, s) +} + +func autoConvert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in *v1alpha3.MachineSetList, out *MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList is an autogenerated conversion function. +func Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in *v1alpha3.MachineSetList, out *MachineSetList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in, out, s) +} + +func autoConvert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *MachineSetSpec, out *v1alpha3.MachineSetSpec, s conversion.Scope) error { + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.MinReadySeconds = in.MinReadySeconds + out.DeletePolicy = in.DeletePolicy + out.Selector = in.Selector + if err := Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec is an autogenerated conversion function. +func Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *MachineSetSpec, out *v1alpha3.MachineSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(in *v1alpha3.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { + // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.MinReadySeconds = in.MinReadySeconds + out.DeletePolicy = in.DeletePolicy + out.Selector = in.Selector + if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *MachineSetStatus, out *v1alpha3.MachineSetStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.ObservedGeneration = in.ObservedGeneration + // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type + // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in *v1alpha3.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.ObservedGeneration = in.ObservedGeneration + // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type + // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(in *MachineSpec, out *v1alpha3.MachineSpec, s conversion.Scope) error { + // WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type + if err := Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { + return err + } + out.InfrastructureRef = in.InfrastructureRef + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + return nil +} + +func autoConvert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(in *v1alpha3.MachineSpec, out *MachineSpec, s conversion.Scope) error { + // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type + if err := Convert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { + return err + } + out.InfrastructureRef = in.InfrastructureRef + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + // WARNING: in.FailureDomain requires manual conversion: does not exist in peer-type + // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in *MachineStatus, out *v1alpha3.MachineStatus, s conversion.Scope) error { + out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) + out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type + // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type + out.Addresses = *(*v1alpha3.MachineAddresses)(unsafe.Pointer(&in.Addresses)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + return nil +} + +func autoConvert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in *v1alpha3.MachineStatus, out *MachineStatus, s conversion.Scope) error { + out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) + out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type + // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type + out.Addresses = *(*MachineAddresses)(unsafe.Pointer(&in.Addresses)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + // WARNING: in.ObservedGeneration requires manual conversion: does not exist in peer-type + // WARNING: in.Conditions requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha3.MachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha3.MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in *v1alpha3.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in *v1alpha3.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in *NetworkRanges, out *v1alpha3.NetworkRanges, s conversion.Scope) error { + out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) + return nil +} + +// Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges is an autogenerated conversion function. +func Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in *NetworkRanges, out *v1alpha3.NetworkRanges, s conversion.Scope) error { + return autoConvert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in, out, s) +} + +func autoConvert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in *v1alpha3.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { + out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) + return nil +} + +// Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges is an autogenerated conversion function. +func Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in *v1alpha3.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { + return autoConvert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in, out, s) +} + +func autoConvert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in *ObjectMeta, out *v1alpha3.ObjectMeta, s conversion.Scope) error { + out.Name = in.Name + out.GenerateName = in.GenerateName + out.Namespace = in.Namespace + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) + return nil +} + +// Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta is an autogenerated conversion function. +func Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in *ObjectMeta, out *v1alpha3.ObjectMeta, s conversion.Scope) error { + return autoConvert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in, out, s) +} + +func autoConvert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in *v1alpha3.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { + out.Name = in.Name + out.GenerateName = in.GenerateName + out.Namespace = in.Namespace + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) + return nil +} + +// Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta is an autogenerated conversion function. +func Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in *v1alpha3.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { + return autoConvert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in, out, s) +} diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go index 11aa737a7..9676d26a8 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go @@ -88,6 +88,11 @@ type ClusterConfiguration struct { // +optional Proxy ProxyConfiguration `json:"proxy,omitempty"` + // RegistryMirror holds the image registry mirror information + // This is only for bottlerocket + // +optional + RegistryMirror RegistryMirrorConfiguration `json:"registryMirror,omitempty"` + // Etcd holds configuration for etcd. // NB: This value defaults to a Local (stacked) etcd // +optional @@ -185,6 +190,15 @@ type ProxyConfiguration struct { NoProxy []string `json:"noProxy,omitempty"` } +// RegistryMirrorConfiguration holds the settings for image registry mirror +type RegistryMirrorConfiguration struct { + // Endpoint defines the registry mirror endpoint to use for pulling images + Endpoint string `json:"endpoint,omitempty"` + + // CACert defines the CA cert for the registry mirror + CACert string `json:"caCert,omitempty"` +} + // ControlPlaneComponent holds settings common to control plane component of the cluster. type ControlPlaneComponent struct { // ExtraArgs is an extra set of flags to pass to the control plane component. @@ -468,6 +482,11 @@ type JoinConfiguration struct { // +optional Proxy ProxyConfiguration `json:"proxy,omitempty"` + // RegistryMirror holds the image registry mirror information + // This is only for bottlerocket + // +optional + RegistryMirror RegistryMirrorConfiguration `json:"registryMirror,omitempty"` + // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster. // When used in the context of control plane nodes, NodeRegistration should remain consistent // across both InitConfiguration and JoinConfiguration diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index c9a3c1cea..15413b5dc 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -349,6 +349,18 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror information + This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -918,6 +930,18 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror information + This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object type: object mounts: description: Mounts specifies a list of mount points to be setup. @@ -2422,6 +2446,18 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror information + This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -3085,6 +3121,18 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror information + This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object skipPhases: description: SkipPhases is a list of phases to skip during command execution. The list of phases can be obtained with the "kubeadm diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml index 348bc8362..b4f286dd6 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml @@ -373,6 +373,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -977,6 +990,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object type: object mounts: description: Mounts specifies a list of mount points to be @@ -2457,6 +2483,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -3168,6 +3207,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object skipPhases: description: SkipPhases is a list of phases to skip during command execution. The list of phases can be obtained diff --git a/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go b/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go index e4be8d945..886af6d87 100644 --- a/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go +++ b/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go @@ -31,6 +31,17 @@ user-data = "{{.BootstrapContainerUserData}}" https-proxy = "{{.HTTPSProxyEndpoint}}" no-proxy = "{{.NoProxyEndpoints}}" {{- end -}} +` + registryMirrorTemplate = `{{ define "registryMirrorSettings" -}} +[settings.container-registry.mirrors] +"public.ecr.aws" = ["https://{{.RegistryMirrorEndpoint}}"] +{{- end -}} +` + registryMirrorCACertTemplate = `{{ define "registryMirrorCACertSettings" -}} +[settings.pki.registry-mirror-ca] +data = "{{.RegistryMirrorCACert}}" +trusted=true +{{- end -}} ` bottlerocketNodeInitSettingsTemplate = `{{template "bootstrapHostContainerSettings" .}} @@ -41,5 +52,13 @@ no-proxy = "{{.NoProxyEndpoints}}" {{- if (ne .HTTPSProxyEndpoint "")}} {{template "networkInitSettings" .}} {{- end -}} + +{{- if (ne .RegistryMirrorEndpoint "")}} +{{template "registryMirrorSettings" .}} +{{- end -}} + +{{- if (ne .RegistryMirrorCACert "")}} +{{template "registryMirrorCACertSettings" .}} +{{- end -}} ` ) diff --git a/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go b/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go index d35016276..f127ec4f1 100644 --- a/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go +++ b/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go @@ -21,9 +21,10 @@ const ( ) type BottlerocketConfig struct { - Pause bootstrapv1.Pause - BottlerocketBootstrap bootstrapv1.BottlerocketBootstrap - ProxyConfiguration bootstrapv1.ProxyConfiguration + Pause bootstrapv1.Pause + BottlerocketBootstrap bootstrapv1.BottlerocketBootstrap + ProxyConfiguration bootstrapv1.ProxyConfiguration + RegistryMirrorConfiguration bootstrapv1.RegistryMirrorConfiguration } type BottlerocketSettingsInput struct { @@ -33,6 +34,8 @@ type BottlerocketSettingsInput struct { PauseContainerSource string HTTPSProxyEndpoint string NoProxyEndpoints []string + RegistryMirrorEndpoint string + RegistryMirrorCACert string } type HostPath struct { @@ -89,7 +92,12 @@ func generateNodeUserData(kind string, tpl string, data interface{}) ([]byte, er if _, err := tm.Parse(networkInitTemplate); err != nil { return nil, errors.Wrapf(err, "failed to parse networks %s template", kind) } - + if _, err := tm.Parse(registryMirrorTemplate); err != nil { + return nil, errors.Wrapf(err, "failed to parse registry mirror %s template", kind) + } + if _, err := tm.Parse(registryMirrorCACertTemplate); err != nil { + return nil, errors.Wrapf(err, "failed to parse registry mirror ca cert %s template", kind) + } t, err := tm.Parse(tpl) if err != nil { return nil, errors.Wrapf(err, "failed to parse %s template", kind) @@ -124,6 +132,10 @@ func getBottlerocketNodeUserData(bootstrapContainerUserData []byte, users []boot PauseContainerSource: fmt.Sprintf("%s:%s", config.Pause.ImageRepository, config.Pause.ImageTag), HTTPSProxyEndpoint: config.ProxyConfiguration.HTTPSProxy, NoProxyEndpoints: config.ProxyConfiguration.NoProxy, + RegistryMirrorEndpoint: config.RegistryMirrorConfiguration.Endpoint, + } + if config.RegistryMirrorConfiguration.CACert != "" { + bottlerocketInput.RegistryMirrorCACert = base64.StdEncoding.EncodeToString([]byte(config.RegistryMirrorConfiguration.CACert)) } bottlerocketNodeUserData, err := generateNodeUserData("InitBottlerocketNode", bottlerocketNodeInitSettingsTemplate, bottlerocketInput) diff --git a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go index 2ac572c92..b1fb19751 100644 --- a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go @@ -471,6 +471,9 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex if scope.Config.Spec.ClusterConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.ClusterConfiguration.Proxy } + if scope.Config.Spec.ClusterConfiguration.RegistryMirror.Endpoint != "" { + bottlerocketConfig.RegistryMirrorConfiguration = scope.Config.Spec.ClusterConfiguration.RegistryMirror + } } clusterdata, err := kubeadmtypes.MarshalClusterConfigurationForVersion(scope.Config.Spec.ClusterConfiguration, parsedVersion) @@ -663,6 +666,9 @@ func (r *KubeadmConfigReconciler) joinWorker(ctx context.Context, scope *Scope) if scope.Config.Spec.JoinConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.JoinConfiguration.Proxy } + if scope.Config.Spec.JoinConfiguration.RegistryMirror.Endpoint != "" { + bottlerocketConfig.RegistryMirrorConfiguration = scope.Config.Spec.JoinConfiguration.RegistryMirror + } bootstrapJoinData, err = bottlerocket.NewNode(nodeInput, bottlerocketConfig) if err != nil { scope.Error(err, "Failed to create a worker bottlerocket join configuration") @@ -779,6 +785,9 @@ func (r *KubeadmConfigReconciler) joinControlplane(ctx context.Context, scope *S if scope.Config.Spec.JoinConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.JoinConfiguration.Proxy } + if scope.Config.Spec.ClusterConfiguration.RegistryMirror.Endpoint != "" { + bottlerocketConfig.RegistryMirrorConfiguration = scope.Config.Spec.ClusterConfiguration.RegistryMirror + } bootstrapJoinData, err = bottlerocket.NewJoinControlPlane(controlPlaneJoinInput, bottlerocketConfig) if err != nil { scope.Error(err, "Failed to generate cloud init for bottlerocket bootstrap control plane") diff --git a/bootstrap/kubeadm/types/upstreamv1beta1/types.go b/bootstrap/kubeadm/types/upstreamv1beta1/types.go index 45bfe7dcd..408678fe6 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta1/types.go +++ b/bootstrap/kubeadm/types/upstreamv1beta1/types.go @@ -70,6 +70,11 @@ type ClusterConfiguration struct { // +optional Proxy ProxyConfiguration `json:"proxy,omitempty"` + // RegistryMirror holds the image registry mirror information + // This is only for bottlerocket + // +optional + RegistryMirror RegistryMirrorConfiguration `json:"registryMirror,omitempty"` + // Etcd holds configuration for etcd. // NB: This value defaults to a Local (stacked) etcd // +optional @@ -164,6 +169,15 @@ type ProxyConfiguration struct { NoProxy []string `json:"noProxy,omitempty"` } +// RegistryMirrorConfiguration holds the settings for image registry mirror +type RegistryMirrorConfiguration struct { + // Endpoint defines the registry mirror endpoint to use for pulling images + Endpoint string `json:"endpoint,omitempty"` + + // CACert defines the CA cert for the registry mirror + CACert string `json:"caCert,omitempty"` +} + // ControlPlaneComponent holds settings common to control plane component of the cluster type ControlPlaneComponent struct { // ExtraArgs is an extra set of flags to pass to the control plane component. @@ -380,6 +394,11 @@ type JoinConfiguration struct { // +optional Proxy ProxyConfiguration `json:"proxy,omitempty"` + // RegistryMirror holds the image registry mirror information + // This is only for bottlerocket + // +optional + RegistryMirror RegistryMirrorConfiguration `json:"registryMirror,omitempty"` + // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster. // When used in the context of control plane nodes, NodeRegistration should remain consistent // across both InitConfiguration and JoinConfiguration diff --git a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.deepcopy.go b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.deepcopy.go index e924a4a4b..71e769f0f 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.deepcopy.go @@ -165,6 +165,7 @@ func (in *ClusterConfiguration) DeepCopyInto(out *ClusterConfiguration) { out.Pause = in.Pause out.BottlerocketBootstrap = in.BottlerocketBootstrap in.Proxy.DeepCopyInto(&out.Proxy) + out.RegistryMirror = in.RegistryMirror in.Etcd.DeepCopyInto(&out.Etcd) out.Networking = in.Networking in.APIServer.DeepCopyInto(&out.APIServer) @@ -432,6 +433,7 @@ func (in *JoinConfiguration) DeepCopyInto(out *JoinConfiguration) { out.Pause = in.Pause out.BottlerocketBootstrap = in.BottlerocketBootstrap in.Proxy.DeepCopyInto(&out.Proxy) + out.RegistryMirror = in.RegistryMirror in.NodeRegistration.DeepCopyInto(&out.NodeRegistration) in.Discovery.DeepCopyInto(&out.Discovery) if in.ControlPlane != nil { @@ -587,3 +589,18 @@ func (in *ProxyConfiguration) DeepCopy() *ProxyConfiguration { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryMirrorConfiguration) DeepCopyInto(out *RegistryMirrorConfiguration) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryMirrorConfiguration. +func (in *RegistryMirrorConfiguration) DeepCopy() *RegistryMirrorConfiguration { + if in == nil { + return nil + } + out := new(RegistryMirrorConfiguration) + in.DeepCopyInto(out) + return out +} diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml index f7418dfa5..a552a9b25 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml @@ -433,6 +433,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -1024,6 +1037,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object type: object mounts: description: Mounts specifies a list of mount points to be setup. @@ -2890,6 +2916,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -3583,6 +3622,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry mirror + information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the registry + mirror + type: string + endpoint: + description: Endpoint defines the registry mirror endpoint + to use for pulling images + type: string + type: object skipPhases: description: SkipPhases is a list of phases to skip during command execution. The list of phases can be obtained with diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml index 5a1623e9f..5410d4145 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanetemplates.yaml @@ -1587,6 +1587,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry + mirror information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the + registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object scheduler: description: Scheduler contains extra settings for the scheduler control plane component @@ -2329,6 +2342,19 @@ spec: type: string type: array type: object + registryMirror: + description: RegistryMirror holds the image registry + mirror information This is only for bottlerocket + properties: + caCert: + description: CACert defines the CA cert for the + registry mirror + type: string + endpoint: + description: Endpoint defines the registry mirror + endpoint to use for pulling images + type: string + type: object skipPhases: description: SkipPhases is a list of phases to skip during command execution. The list of phases can -- 2.40.0