From f8f9f309f7675eeaf307d24734922002a176e2f0 Mon Sep 17 00:00:00 2001 From: Victor Pineda Date: Tue, 21 Jun 2022 07:50:19 -0700 Subject: [PATCH 19/34] Add feature to specifiy additional host containers in BR Host containers are a feature within BR that allows us to pull images without the need of having to bootstrap kuberentes. Such containers can be superpowered and user-data can be attached to each one of them. As such, this commit creates the `BottlerocketHostContainer` struct to allow the user to customize the those fields. Users can specify an arbitrary number of host containers in the `AdditionalHostContainers` field. This commit also does some refactoring around the templating system BR has to generate the TOML files. It generifies the host-container template to be reused as much as a user wants to. SIM: https://i.amazon.com/P66557529 cr: https://code.amazon.com/reviews/CR-71408825 --- bootstrap/kubeadm/api/v1alpha4/conversion.go | 5 + .../api/v1alpha4/zz_generated.conversion.go | 37 ++++-- .../kubeadm/api/v1beta1/kubeadm_types.go | 25 +++++ .../api/v1beta1/zz_generated.deepcopy.go | 26 +++++ ...strap.cluster.x-k8s.io_kubeadmconfigs.yaml | 84 ++++++++++++++ ...uster.x-k8s.io_kubeadmconfigtemplates.yaml | 86 ++++++++++++++ .../internal/bottlerocket/bootstrap.go | 44 +++----- .../internal/bottlerocket/bottlerocket.go | 105 +++++++++++------- .../controllers/kubeadmconfig_controller.go | 21 ++-- .../types/upstreamv1beta1/conversion.go | 5 + .../zz_generated.conversion.go | 17 ++- .../types/upstreamv1beta2/conversion.go | 5 + .../zz_generated.conversion.go | 17 ++- .../types/upstreamv1beta3/conversion.go | 10 ++ .../zz_generated.conversion.go | 32 ++---- ...cluster.x-k8s.io_kubeadmcontrolplanes.yaml | 86 ++++++++++++++ ...x-k8s.io_kubeadmcontrolplanetemplates.yaml | 90 +++++++++++++++ 17 files changed, 569 insertions(+), 126 deletions(-) diff --git a/bootstrap/kubeadm/api/v1alpha4/conversion.go b/bootstrap/kubeadm/api/v1alpha4/conversion.go index 576fceebd..5457cd58d 100644 --- a/bootstrap/kubeadm/api/v1alpha4/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha4/conversion.go @@ -210,6 +210,11 @@ func Convert_v1beta1_User_To_v1alpha4_User(in *bootstrapv1.User, out *User, s ap return autoConvert_v1beta1_User_To_v1alpha4_User(in, out, s) } +func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *bootstrapv1.ClusterConfiguration, out *ClusterConfiguration, s apiconversion.Scope) error { + // ClusterConfiguration.BottlerocketCustomHostContainers exists in bootstrapv1.ClusterConfiguration but not in v1alpha4 + return autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) +} + func Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, out *NodeRegistrationOptions, s apiconversion.Scope) error { // NodeRegistrationOptions.ImagePullPolicy does not exit in // kubeadm v1alpha4 API. diff --git a/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go index 5c36c5ca4..fcea82a30 100644 --- a/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go +++ b/bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go @@ -115,11 +115,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1beta1.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(a.(*ClusterStatus), b.(*v1beta1.ClusterStatus), scope) }); err != nil { @@ -430,6 +425,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(a.(*v1beta1.InitConfiguration), b.(*InitConfiguration), scope) }); err != nil { @@ -727,14 +727,10 @@ func autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(i out.ImageRepository = in.ImageRepository out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) out.ClusterName = in.ClusterName + // WARNING: in.BottlerocketHostContainers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *v1beta1.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) -} - func autoConvert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(in *ClusterStatus, out *v1beta1.ClusterStatus, s conversion.Scope) error { out.APIEndpoints = *(*map[string]v1beta1.APIEndpoint)(unsafe.Pointer(&in.APIEndpoints)) return nil @@ -1136,6 +1132,7 @@ func autoConvert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *v1b out.ControlPlane = (*JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) // WARNING: in.SkipPhases requires manual conversion: does not exist in peer-type // WARNING: in.Patches requires manual conversion: does not exist in peer-type + // WARNING: in.BottlerocketCustomHostContainers requires manual conversion: does not exist in peer-type return nil } @@ -1238,7 +1235,15 @@ func Convert_v1beta1_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(in *v1beta1 } func autoConvert_v1alpha4_KubeadmConfigSpec_To_v1beta1_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1beta1.KubeadmConfigSpec, s conversion.Scope) error { - out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + if in.ClusterConfiguration != nil { + in, out := &in.ClusterConfiguration, &out.ClusterConfiguration + *out = new(v1beta1.ClusterConfiguration) + if err := Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.ClusterConfiguration = nil + } if in.InitConfiguration != nil { in, out := &in.InitConfiguration, &out.InitConfiguration *out = new(v1beta1.InitConfiguration) @@ -1296,7 +1301,15 @@ func Convert_v1alpha4_KubeadmConfigSpec_To_v1beta1_KubeadmConfigSpec(in *Kubeadm } func autoConvert_v1beta1_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *v1beta1.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { - out.ClusterConfiguration = (*ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + if in.ClusterConfiguration != nil { + in, out := &in.ClusterConfiguration, &out.ClusterConfiguration + *out = new(ClusterConfiguration) + if err := Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.ClusterConfiguration = nil + } if in.InitConfiguration != nil { in, out := &in.InitConfiguration, &out.InitConfiguration *out = new(InitConfiguration) diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go index 8c9dcac00..44ffa00f3 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadm_types.go @@ -170,6 +170,11 @@ type ClusterConfiguration struct { // The cluster name // +optional ClusterName string `json:"clusterName,omitempty"` + + // BottlerocketHostContainers contains the information of any additional images + // that we will deploy as host containers in the CPIs + // +optional + BottlerocketHostContainers []BottlerocketHostContainer `json:"bottlerocketCustomHostContainers,omitempty"` } // Pause defines the pause image repo and tag that should be run on the bootstrapped nodes. @@ -537,6 +542,26 @@ type JoinConfiguration struct { // "kubeadm join". The minimum kubernetes version needed to support Patches is v1.22 // +optional Patches *Patches `json:"patches,omitempty"` + + // BottlerocketCustomHostContainers contains the information of any additional images + // that we will deploy as host containers in the CPIs + // +optional + BottlerocketCustomHostContainers []BottlerocketHostContainer `json:"bottlerocketCustomHostContainers,omitempty"` +} + +// BottlerocketHostContainer describes a host image for Bottlerocket +type BottlerocketHostContainer struct { + // Name is the host container name that will be given to the container in BR's `apiserver` + // +kubebuilder:validation:Required + Name string `json:"name"` + // Superpowered indicates if the container will be superpowered + // +kubebuilder:validation:Required + Superpowered bool `json:"superpowered"` + // ImageMeta is the actual location of the container image + ImageMeta `json:"source"` + // UserData is the userdata that will be attached to the image. + // +optional + UserData string `json:"userData,omitempty"` } // JoinControlPlane contains elements describing an additional control plane instance to be deployed on the joining node. diff --git a/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go index 921e6b0ea..1a6861a8f 100644 --- a/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go @@ -175,6 +175,22 @@ func (in *BottlerocketControl) DeepCopy() *BottlerocketControl { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BottlerocketHostContainer) DeepCopyInto(out *BottlerocketHostContainer) { + *out = *in + out.ImageMeta = in.ImageMeta +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BottlerocketHostContainer. +func (in *BottlerocketHostContainer) DeepCopy() *BottlerocketHostContainer { + if in == nil { + return nil + } + out := new(BottlerocketHostContainer) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterConfiguration) DeepCopyInto(out *ClusterConfiguration) { *out = *in @@ -197,6 +213,11 @@ func (in *ClusterConfiguration) DeepCopyInto(out *ClusterConfiguration) { (*out)[key] = val } } + if in.BottlerocketHostContainers != nil { + in, out := &in.BottlerocketHostContainers, &out.BottlerocketHostContainers + *out = make([]BottlerocketHostContainer, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConfiguration. @@ -615,6 +636,11 @@ func (in *JoinConfiguration) DeepCopyInto(out *JoinConfiguration) { *out = new(Patches) **out = **in } + if in.BottlerocketCustomHostContainers != nil { + in, out := &in.BottlerocketCustomHostContainers, &out.BottlerocketCustomHostContainers + *out = make([]BottlerocketHostContainer, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new 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 c98744828..15536cd1d 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 @@ -2397,6 +2397,48 @@ spec: the version of the above components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketHostContainers contains the information + of any additional images that we will deploy as host containers + in the CPIs + items: + description: BottlerocketHostContainer describes a host image + for Bottlerocket + properties: + name: + description: Name is the host container name that will be + given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of the container + image + properties: + imageRepository: + description: ImageRepository sets the container registry + to pull images from. if not set, the ImageRepository + defined in ClusterConfiguration will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag for the + image. In case this value is set, kubeadm does not + change automatically the version of the above components + during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container will + be superpowered + type: boolean + userData: + description: UserData is the userdata that will be attached + to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array certificatesDir: description: 'CertificatesDir specifies where to store or look for all required certificates. NB: if not provided, this will @@ -3090,6 +3132,48 @@ spec: the version of the above components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketCustomHostContainers contains the information + of any additional images that we will deploy as host containers + in the CPIs + items: + description: BottlerocketHostContainer describes a host image + for Bottlerocket + properties: + name: + description: Name is the host container name that will be + given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of the container + image + properties: + imageRepository: + description: ImageRepository sets the container registry + to pull images from. if not set, the ImageRepository + defined in ClusterConfiguration will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag for the + image. In case this value is set, kubeadm does not + change automatically the version of the above components + during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container will + be superpowered + type: boolean + userData: + description: UserData is the userdata that will be attached + to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array caCertPath: description: 'CACertPath is the path to the SSL certificate authority used to secure comunications between node and control-plane. 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 1ffc551c9..19b364d72 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 @@ -2430,6 +2430,49 @@ spec: components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketHostContainers contains the information + of any additional images that we will deploy as host + containers in the CPIs + items: + description: BottlerocketHostContainer describes a host + image for Bottlerocket + properties: + name: + description: Name is the host container name that + will be given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of + the container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, + the ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag + for the image. In case this value is set, + kubeadm does not change automatically the + version of the above components during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will + be attached to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array certificatesDir: description: 'CertificatesDir specifies where to store or look for all required certificates. NB: if not provided, @@ -3172,6 +3215,49 @@ spec: components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketCustomHostContainers contains + the information of any additional images that we will + deploy as host containers in the CPIs + items: + description: BottlerocketHostContainer describes a host + image for Bottlerocket + properties: + name: + description: Name is the host container name that + will be given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of + the container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, + the ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag + for the image. In case this value is set, + kubeadm does not change automatically the + version of the above components during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will + be attached to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array caCertPath: description: 'CACertPath is the path to the SSL certificate authority used to secure comunications between node diff --git a/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go b/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go index efdb51fef..bc5094eb1 100644 --- a/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go +++ b/bootstrap/kubeadm/internal/bottlerocket/bootstrap.go @@ -3,12 +3,6 @@ package bottlerocket const ( - adminContainerInitTemplate = `{{ define "adminContainerInitSettings" -}} -[settings.host-containers.admin] -enabled = true -user-data = "{{.AdminContainerUserData}}" -{{- end -}} -` kubernetesInitTemplate = `{{ define "kubernetesInitSettings" -}} [settings.kubernetes] cluster-domain = "cluster.local" @@ -22,14 +16,26 @@ provider-id = "{{.ProviderId}}" {{- end -}} ` - bootstrapHostContainerTemplate = `{{define "bootstrapHostContainerSettings" -}} -[settings.host-containers.kubeadm-bootstrap] + hostContainerTemplate = `{{define "hostContainerSettings" -}} +[settings.host-containers.{{.Name}}] enabled = true -superpowered = true -source = "{{.BootstrapContainerSource}}" -user-data = "{{.BootstrapContainerUserData}}" +superpowered = {{.Superpowered}} +{{- if (ne (imageUrl .ImageMeta) "")}} +source = "{{imageUrl .ImageMeta}}" +{{- end -}} +{{- if (ne .UserData "")}} +user-data = "{{.UserData}}" +{{- end -}} +{{- end -}} +` + + hostContainerSliceTemplate = `{{define "hostContainerSlice" -}} +{{- range $hContainer := .HostContainers }} +{{template "hostContainerSettings" $hContainer }} +{{- end -}} {{- end -}} ` + networkInitTemplate = `{{ define "networkInitSettings" -}} [settings.network] https-proxy = "{{.HTTPSProxyEndpoint}}" @@ -58,17 +64,7 @@ trusted=true {{- end -}} ` - controlContainerTemplate = `{{ define "controlContainerSettings" -}} -[settings.host-containers.control] -enabled = true -superpowered = false -source = "{{.ControlContainerSource}}" -{{- end -}} -` - - bottlerocketNodeInitSettingsTemplate = `{{template "bootstrapHostContainerSettings" .}} - -{{template "adminContainerInitSettings" .}} + bottlerocketNodeInitSettingsTemplate = `{{template "hostContainerSlice" .}} {{template "kubernetesInitSettings" .}} @@ -91,9 +87,5 @@ source = "{{.ControlContainerSource}}" {{- if (ne .Taints "")}} {{template "taintsTemplate" .}} {{- end -}} - -{{- if (ne .ControlContainerSource "")}} -{{template "controlContainerSettings" .}} -{{- end -}} ` ) diff --git a/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go b/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go index 3a760d51a..73d35963e 100644 --- a/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go +++ b/bootstrap/kubeadm/internal/bottlerocket/bottlerocket.go @@ -23,28 +23,26 @@ const ( ) type BottlerocketConfig struct { - Pause bootstrapv1.Pause - BottlerocketBootstrap bootstrapv1.BottlerocketBootstrap - BottlerocketControl bootstrapv1.BottlerocketControl - ProxyConfiguration bootstrapv1.ProxyConfiguration - RegistryMirrorConfiguration bootstrapv1.RegistryMirrorConfiguration - KubeletExtraArgs map[string]string - Taints []corev1.Taint + Pause bootstrapv1.Pause + BottlerocketBootstrap bootstrapv1.BottlerocketBootstrap + BottlerocketControl bootstrapv1.BottlerocketControl + ProxyConfiguration bootstrapv1.ProxyConfiguration + RegistryMirrorConfiguration bootstrapv1.RegistryMirrorConfiguration + KubeletExtraArgs map[string]string + Taints []corev1.Taint + BottlerocketCustomHostContainers []bootstrapv1.BottlerocketHostContainer } type BottlerocketSettingsInput struct { - BootstrapContainerUserData string - AdminContainerUserData string - BootstrapContainerSource string - ControlContainerSource string - PauseContainerSource string - HTTPSProxyEndpoint string - NoProxyEndpoints []string - RegistryMirrorEndpoint string - RegistryMirrorCACert string - NodeLabels string - Taints string - ProviderId string + PauseContainerSource string + HTTPSProxyEndpoint string + NoProxyEndpoints []string + RegistryMirrorEndpoint string + RegistryMirrorCACert string + NodeLabels string + Taints string + ProviderId string + HostContainers []bootstrapv1.BottlerocketHostContainer } type HostPath struct { @@ -87,16 +85,23 @@ func generateAdminContainerUserData(kind string, tpl string, data interface{}) ( return out.Bytes(), nil } -func generateNodeUserData(kind string, tpl string, data interface{}) ([]byte, error) { - tm := template.New(kind).Funcs(template.FuncMap{"stringsJoin": strings.Join}) - if _, err := tm.Parse(bootstrapHostContainerTemplate); err != nil { - return nil, errors.Wrapf(err, "failed to parse hostContainer %s template", kind) +func imageUrl(containerLocation bootstrapv1.ImageMeta) string { + if containerLocation.ImageRepository != "" && containerLocation.ImageTag != "" { + return fmt.Sprintf("%s:%s", containerLocation.ImageRepository, containerLocation.ImageTag) } - if _, err := tm.Parse(adminContainerInitTemplate); err != nil { - return nil, errors.Wrapf(err, "failed to parse adminContainer %s template", kind) + return "" +} + +func generateNodeUserData(kind string, tpl string, data interface{}) ([]byte, error) { + tm := template.New(kind).Funcs(template.FuncMap{ + "stringsJoin": strings.Join, + "imageUrl": imageUrl, + }) + if _, err := tm.Parse(hostContainerTemplate); err != nil { + return nil, errors.Wrapf(err, "failed to parse hostContainerSettings %s template", kind) } - if _, err := tm.Parse(controlContainerTemplate); err != nil { - return nil, errors.Wrapf(err, "failed to parse controlContainer %s template", kind) + if _, err := tm.Parse(hostContainerSliceTemplate); err != nil { + return nil, errors.Wrapf(err, "failed to parse hostContainerSettingsSlice %s template", kind) } if _, err := tm.Parse(kubernetesInitTemplate); err != nil { return nil, errors.Wrapf(err, "failed to parse kubernetes %s template", kind) @@ -143,20 +148,42 @@ func getBottlerocketNodeUserData(bootstrapContainerUserData []byte, users []boot } b64AdminContainerUserData := base64.StdEncoding.EncodeToString(adminContainerUserData) - bottlerocketInput := &BottlerocketSettingsInput{ - BootstrapContainerUserData: b64BootstrapContainerUserData, - AdminContainerUserData: b64AdminContainerUserData, - BootstrapContainerSource: fmt.Sprintf("%s:%s", config.BottlerocketBootstrap.ImageRepository, config.BottlerocketBootstrap.ImageTag), - PauseContainerSource: fmt.Sprintf("%s:%s", config.Pause.ImageRepository, config.Pause.ImageTag), - HTTPSProxyEndpoint: config.ProxyConfiguration.HTTPSProxy, - RegistryMirrorEndpoint: config.RegistryMirrorConfiguration.Endpoint, - NodeLabels: parseNodeLabels(config.KubeletExtraArgs["node-labels"]), // empty string if it does not exist - Taints: parseTaints(config.Taints), //empty string if it does not exist - ProviderId: config.KubeletExtraArgs["provider-id"], + hostContainers := []bootstrapv1.BottlerocketHostContainer{ + { + Name: "admin", + Superpowered: true, + UserData: b64AdminContainerUserData, + }, + { + Name: "kubeadm-bootstrap", + Superpowered: true, + ImageMeta: config.BottlerocketBootstrap.ImageMeta, + UserData: b64BootstrapContainerUserData, + }, } + if config.BottlerocketControl.ImageRepository != "" && config.BottlerocketControl.ImageTag != "" { - bottlerocketInput.ControlContainerSource = fmt.Sprintf("%s:%s", config.BottlerocketControl.ImageRepository, config.BottlerocketControl.ImageTag) + hostContainers = append(hostContainers, bootstrapv1.BottlerocketHostContainer{ + Name: "control", + Superpowered: false, + ImageMeta: config.BottlerocketControl.ImageMeta, + }) } + + if len(config.BottlerocketCustomHostContainers) != 0 { + hostContainers = append(hostContainers, config.BottlerocketCustomHostContainers...) + } + + bottlerocketInput := &BottlerocketSettingsInput{ + PauseContainerSource: fmt.Sprintf("%s:%s", config.Pause.ImageRepository, config.Pause.ImageTag), + HTTPSProxyEndpoint: config.ProxyConfiguration.HTTPSProxy, + RegistryMirrorEndpoint: config.RegistryMirrorConfiguration.Endpoint, + NodeLabels: parseNodeLabels(config.KubeletExtraArgs["node-labels"]), // empty string if it does not exist + Taints: parseTaints(config.Taints), //empty string if it does not exist + ProviderId: config.KubeletExtraArgs["provider-id"], + HostContainers: hostContainers, + } + if len(config.ProxyConfiguration.NoProxy) > 0 { for _, noProxy := range config.ProxyConfiguration.NoProxy { bottlerocketInput.NoProxyEndpoints = append(bottlerocketInput.NoProxyEndpoints, strconv.Quote(noProxy)) @@ -183,7 +210,7 @@ func parseTaints(taints []corev1.Taint) string { taintsMap := make(map[string][]string) for _, taint := range taints { valueEffectString := fmt.Sprintf(taintValueEffectTemplate, taint.Value, taint.Effect) - taintsMap[taint.Key]= append(taintsMap[taint.Key], valueEffectString) + taintsMap[taint.Key] = append(taintsMap[taint.Key], valueEffectString) } var taintsToml strings.Builder diff --git a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go index 2d536dd33..bc1ca64d9 100644 --- a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go @@ -465,9 +465,10 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex } bottlerocketConfig = &bottlerocket.BottlerocketConfig{ - Pause: scope.Config.Spec.ClusterConfiguration.Pause, - BottlerocketBootstrap: scope.Config.Spec.ClusterConfiguration.BottlerocketBootstrap, - BottlerocketControl: scope.Config.Spec.ClusterConfiguration.BottlerocketControl, + Pause: scope.Config.Spec.ClusterConfiguration.Pause, + BottlerocketBootstrap: scope.Config.Spec.ClusterConfiguration.BottlerocketBootstrap, + BottlerocketControl: scope.Config.Spec.ClusterConfiguration.BottlerocketControl, + BottlerocketCustomHostContainers: scope.Config.Spec.ClusterConfiguration.BottlerocketHostContainers, } if scope.Config.Spec.ClusterConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.ClusterConfiguration.Proxy @@ -667,9 +668,10 @@ func (r *KubeadmConfigReconciler) joinWorker(ctx context.Context, scope *Scope) }) case bootstrapv1.Bottlerocket: bottlerocketConfig := &bottlerocket.BottlerocketConfig{ - Pause: scope.Config.Spec.JoinConfiguration.Pause, - BottlerocketBootstrap: scope.Config.Spec.JoinConfiguration.BottlerocketBootstrap, - BottlerocketControl: scope.Config.Spec.JoinConfiguration.BottlerocketControl, + Pause: scope.Config.Spec.JoinConfiguration.Pause, + BottlerocketBootstrap: scope.Config.Spec.JoinConfiguration.BottlerocketBootstrap, + BottlerocketControl: scope.Config.Spec.JoinConfiguration.BottlerocketControl, + BottlerocketCustomHostContainers: scope.Config.Spec.JoinConfiguration.BottlerocketCustomHostContainers, } if scope.Config.Spec.JoinConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.JoinConfiguration.Proxy @@ -793,9 +795,10 @@ func (r *KubeadmConfigReconciler) joinControlplane(ctx context.Context, scope *S }) case bootstrapv1.Bottlerocket: bottlerocketConfig := &bottlerocket.BottlerocketConfig{ - Pause: scope.Config.Spec.JoinConfiguration.Pause, - BottlerocketBootstrap: scope.Config.Spec.JoinConfiguration.BottlerocketBootstrap, - BottlerocketControl: scope.Config.Spec.JoinConfiguration.BottlerocketControl, + Pause: scope.Config.Spec.JoinConfiguration.Pause, + BottlerocketBootstrap: scope.Config.Spec.JoinConfiguration.BottlerocketBootstrap, + BottlerocketControl: scope.Config.Spec.JoinConfiguration.BottlerocketControl, + BottlerocketCustomHostContainers: scope.Config.Spec.JoinConfiguration.BottlerocketCustomHostContainers, } if scope.Config.Spec.JoinConfiguration.Proxy.HTTPSProxy != "" { bottlerocketConfig.ProxyConfiguration = scope.Config.Spec.JoinConfiguration.Proxy diff --git a/bootstrap/kubeadm/types/upstreamv1beta1/conversion.go b/bootstrap/kubeadm/types/upstreamv1beta1/conversion.go index e893686d5..6cfa9628b 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta1/conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta1/conversion.go @@ -95,3 +95,8 @@ func Convert_v1beta1_JoinConfiguration_To_upstreamv1beta1_JoinConfiguration(in * // JoinConfiguration.Patches does not exist in kubeadm v1beta1 API return autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta1_JoinConfiguration(in, out, s) } + +func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(src *bootstrapv1.ClusterConfiguration, dst *ClusterConfiguration, s apimachineryconversion.Scope) error { + // ClusterConfiguration.BottlerocketCustomHostContainers exists in bootstrapv1.ClusterConfiguration but not in upstreamv1beta1 + return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(src, dst, s) +} diff --git a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go index 700d980fe..733b0a54a 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go @@ -108,11 +108,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1beta1.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_upstreamv1beta1_ClusterStatus_To_v1beta1_ClusterStatus(a.(*ClusterStatus), b.(*v1beta1.ClusterStatus), scope) }); err != nil { @@ -283,6 +278,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_InitConfiguration_To_upstreamv1beta1_InitConfiguration(a.(*v1beta1.InitConfiguration), b.(*InitConfiguration), scope) }); err != nil { @@ -561,14 +561,10 @@ func autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfigur out.ImageRepository = in.ImageRepository out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) out.ClusterName = in.ClusterName + // WARNING: in.BottlerocketHostContainers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(in *v1beta1.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta1_ClusterConfiguration(in, out, s) -} - func autoConvert_upstreamv1beta1_ClusterStatus_To_v1beta1_ClusterStatus(in *ClusterStatus, out *v1beta1.ClusterStatus, s conversion.Scope) error { out.APIEndpoints = *(*map[string]v1beta1.APIEndpoint)(unsafe.Pointer(&in.APIEndpoints)) return nil @@ -862,6 +858,7 @@ func autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta1_JoinConfiguration( out.ControlPlane = (*JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) // WARNING: in.SkipPhases requires manual conversion: does not exist in peer-type // WARNING: in.Patches requires manual conversion: does not exist in peer-type + // WARNING: in.BottlerocketCustomHostContainers requires manual conversion: does not exist in peer-type return nil } diff --git a/bootstrap/kubeadm/types/upstreamv1beta2/conversion.go b/bootstrap/kubeadm/types/upstreamv1beta2/conversion.go index fc95ca21d..20f52cae5 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta2/conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta2/conversion.go @@ -93,6 +93,11 @@ func Convert_v1beta1_JoinConfiguration_To_upstreamv1beta2_JoinConfiguration(in * return autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta2_JoinConfiguration(in, out, s) } +func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(src *bootstrapv1.ClusterConfiguration, dst *ClusterConfiguration, s apimachineryconversion.Scope) error { + // ClusterConfiguration.BottlerocketCustomHostContainers exists in bootstrapv1.ClusterConfiguration but not in upstreamv1beta2 + return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(src, dst, s) +} + func Convert_v1beta1_NodeRegistrationOptions_To_upstreamv1beta2_NodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, out *NodeRegistrationOptions, s apimachineryconversion.Scope) error { // NodeRegistrationOptions.ImagePullPolicy does not exit in // kubeadm v1beta2 API. diff --git a/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go index a0d3f763c..6b4eac17b 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go @@ -108,11 +108,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1beta1.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_upstreamv1beta2_ClusterStatus_To_v1beta1_ClusterStatus(a.(*ClusterStatus), b.(*v1beta1.ClusterStatus), scope) }); err != nil { @@ -283,6 +278,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_InitConfiguration_To_upstreamv1beta2_InitConfiguration(a.(*v1beta1.InitConfiguration), b.(*InitConfiguration), scope) }); err != nil { @@ -561,14 +561,10 @@ func autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfigur out.ImageRepository = in.ImageRepository out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) out.ClusterName = in.ClusterName + // WARNING: in.BottlerocketHostContainers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(in *v1beta1.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta2_ClusterConfiguration(in, out, s) -} - func autoConvert_upstreamv1beta2_ClusterStatus_To_v1beta1_ClusterStatus(in *ClusterStatus, out *v1beta1.ClusterStatus, s conversion.Scope) error { out.APIEndpoints = *(*map[string]v1beta1.APIEndpoint)(unsafe.Pointer(&in.APIEndpoints)) return nil @@ -874,6 +870,7 @@ func autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta2_JoinConfiguration( } // WARNING: in.SkipPhases requires manual conversion: does not exist in peer-type // WARNING: in.Patches requires manual conversion: does not exist in peer-type + // WARNING: in.BottlerocketCustomHostContainers requires manual conversion: does not exist in peer-type return nil } diff --git a/bootstrap/kubeadm/types/upstreamv1beta3/conversion.go b/bootstrap/kubeadm/types/upstreamv1beta3/conversion.go index bcf9e1ef1..1a96971e5 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta3/conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta3/conversion.go @@ -78,3 +78,13 @@ func Convert_upstreamv1beta3_JoinControlPlane_To_v1beta1_JoinControlPlane(in *Jo // JoinControlPlane.CertificateKey exists in v1beta3 types but not in bootstrapv1.JoinControlPlane (Cluster API does not uses automatic copy certs). Ignoring when converting. return autoConvert_upstreamv1beta3_JoinControlPlane_To_v1beta1_JoinControlPlane(in, out, s) } + +func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(src *bootstrapv1.ClusterConfiguration, dst *ClusterConfiguration, s apimachineryconversion.Scope) error { + // ClusterConfiguration.BottlerocketCustomHostContainers exists in bootstrapv1.ClusterConfiguration but not in upstreamv1beta3 + return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(src, dst, s) +} + +func Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(src *bootstrapv1.JoinConfiguration, dst *JoinConfiguration, s apimachineryconversion.Scope) error { + // JoinConfiguration.BottlerocketCustomHostContainers exists in bootstrapv1.JoinControlPlane but not in upstreamv1beta3 + return autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(src, dst, s) +} diff --git a/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go b/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go index 197c2ef74..d290e4d94 100644 --- a/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/upstreamv1beta3/zz_generated.conversion.go @@ -113,11 +113,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ControlPlaneComponent)(nil), (*v1beta1.ControlPlaneComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_upstreamv1beta3_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(a.(*ControlPlaneComponent), b.(*v1beta1.ControlPlaneComponent), scope) }); err != nil { @@ -203,11 +198,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(a.(*v1beta1.JoinConfiguration), b.(*JoinConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1beta1.JoinControlPlane)(nil), (*JoinControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_JoinControlPlane_To_upstreamv1beta3_JoinControlPlane(a.(*v1beta1.JoinControlPlane), b.(*JoinControlPlane), scope) }); err != nil { @@ -298,6 +288,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*ClusterConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta1.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(a.(*v1beta1.JoinConfiguration), b.(*JoinConfiguration), scope) + }); err != nil { + return err + } return nil } @@ -565,14 +565,10 @@ func autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfigur out.ImageRepository = in.ImageRepository out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) out.ClusterName = in.ClusterName + // WARNING: in.BottlerocketHostContainers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in *v1beta1.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(in, out, s) -} - func autoConvert_upstreamv1beta3_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(in *ControlPlaneComponent, out *v1beta1.ControlPlaneComponent, s conversion.Scope) error { out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) out.ExtraVolumes = *(*[]v1beta1.HostPathMount)(unsafe.Pointer(&in.ExtraVolumes)) @@ -866,14 +862,10 @@ func autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration( } out.SkipPhases = *(*[]string)(unsafe.Pointer(&in.SkipPhases)) out.Patches = (*Patches)(unsafe.Pointer(in.Patches)) + // WARNING: in.BottlerocketCustomHostContainers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration is an autogenerated conversion function. -func Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(in *v1beta1.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(in, out, s) -} - func autoConvert_upstreamv1beta3_JoinControlPlane_To_v1beta1_JoinControlPlane(in *JoinControlPlane, out *v1beta1.JoinControlPlane, s conversion.Scope) error { if err := Convert_upstreamv1beta3_APIEndpoint_To_v1beta1_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { return err 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 2fc03f208..2f5b8f610 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 @@ -2871,6 +2871,49 @@ spec: upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketHostContainers contains the information + of any additional images that we will deploy as host containers + in the CPIs + items: + description: BottlerocketHostContainer describes a host + image for Bottlerocket + properties: + name: + description: Name is the host container name that will + be given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of the + container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, the + ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag for + the image. In case this value is set, kubeadm + does not change automatically the version of the + above components during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will be attached + to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array certificatesDir: description: 'CertificatesDir specifies where to store or look for all required certificates. NB: if not provided, @@ -3593,6 +3636,49 @@ spec: upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketCustomHostContainers contains the + information of any additional images that we will deploy + as host containers in the CPIs + items: + description: BottlerocketHostContainer describes a host + image for Bottlerocket + properties: + name: + description: Name is the host container name that will + be given to the container in BR's `apiserver` + type: string + source: + description: ImageMeta is the actual location of the + container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, the + ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag for + the image. In case this value is set, kubeadm + does not change automatically the version of the + above components during upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will be attached + to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array caCertPath: description: 'CACertPath is the path to the SSL certificate authority used to secure comunications between node and 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 e11d335ee..1cf471a08 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 @@ -1502,6 +1502,51 @@ spec: the above components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketHostContainers contains the + information of any additional images that we will + deploy as host containers in the CPIs + items: + description: BottlerocketHostContainer describes + a host image for Bottlerocket + properties: + name: + description: Name is the host container name + that will be given to the container in BR's + `apiserver` + type: string + source: + description: ImageMeta is the actual location + of the container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, + the ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify + a tag for the image. In case this value + is set, kubeadm does not change automatically + the version of the above components during + upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will + be attached to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array certificatesDir: description: 'CertificatesDir specifies where to store or look for all required certificates. NB: if not @@ -2274,6 +2319,51 @@ spec: the above components during upgrades. type: string type: object + bottlerocketCustomHostContainers: + description: BottlerocketCustomHostContainers contains + the information of any additional images that we + will deploy as host containers in the CPIs + items: + description: BottlerocketHostContainer describes + a host image for Bottlerocket + properties: + name: + description: Name is the host container name + that will be given to the container in BR's + `apiserver` + type: string + source: + description: ImageMeta is the actual location + of the container image + properties: + imageRepository: + description: ImageRepository sets the container + registry to pull images from. if not set, + the ImageRepository defined in ClusterConfiguration + will be used instead. + type: string + imageTag: + description: ImageTag allows to specify + a tag for the image. In case this value + is set, kubeadm does not change automatically + the version of the above components during + upgrades. + type: string + type: object + superpowered: + description: Superpowered indicates if the container + will be superpowered + type: boolean + userData: + description: UserData is the userdata that will + be attached to the image. + type: string + required: + - name + - source + - superpowered + type: object + type: array caCertPath: description: 'CACertPath is the path to the SSL certificate authority used to secure comunications between node -- 2.40.0