From eecac0587182db8274c1951fd6afeff36918c227 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Tue, 20 Jun 2023 10:42:53 +0300 Subject: [PATCH 1/2] kubeadm: add v1beta4 API boilerplate Create v1beta4 by copying v1beta3. --- .../app/apis/kubeadm/v1beta4/conversion.go | 36 + .../app/apis/kubeadm/v1beta4/defaults.go | 216 +++++ .../app/apis/kubeadm/v1beta4/defaults_unix.go | 27 + .../apis/kubeadm/v1beta4/defaults_windows.go | 27 + cmd/kubeadm/app/apis/kubeadm/v1beta4/doc.go | 273 +++++++ .../app/apis/kubeadm/v1beta4/register.go | 64 ++ cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go | 445 ++++++++++ .../v1beta4/zz_generated.conversion.go | 767 ++++++++++++++++++ .../kubeadm/v1beta4/zz_generated.deepcopy.go | 506 ++++++++++++ .../kubeadm/v1beta4/zz_generated.defaults.go | 62 ++ 10 files changed, 2423 insertions(+) create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/conversion.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_unix.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_windows.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/doc.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/register.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.conversion.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.deepcopy.go create mode 100644 cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/conversion.go new file mode 100644 index 00000000000..6cdbc582b9f --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/conversion.go @@ -0,0 +1,36 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +import ( + "k8s.io/apimachinery/pkg/conversion" + + "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" +) + +func Convert_kubeadm_InitConfiguration_To_v1beta4_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { + return autoConvert_kubeadm_InitConfiguration_To_v1beta4_InitConfiguration(in, out, s) +} + +func Convert_v1beta4_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { + err := autoConvert_v1beta4_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s) + if err != nil { + return err + } + err = Convert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration(&ClusterConfiguration{}, &out.ClusterConfiguration, s) + return err +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go new file mode 100644 index 00000000000..a599cf154a9 --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go @@ -0,0 +1,216 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +import ( + "net/url" + "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" + "k8s.io/kubernetes/cmd/kubeadm/app/constants" +) + +const ( + // DefaultServiceDNSDomain defines default cluster-internal domain name for Services and Pods + DefaultServiceDNSDomain = "cluster.local" + // DefaultServicesSubnet defines default service subnet range + DefaultServicesSubnet = "10.96.0.0/12" + // DefaultClusterDNSIP defines default DNS IP + DefaultClusterDNSIP = "10.96.0.10" + // DefaultKubernetesVersion defines default kubernetes version + DefaultKubernetesVersion = "stable-1" + // DefaultAPIBindPort defines default API port + DefaultAPIBindPort = 6443 + // DefaultCertificatesDir defines default certificate directory + DefaultCertificatesDir = "/etc/kubernetes/pki" + // DefaultImageRepository defines default image registry + // (previously this defaulted to k8s.gcr.io) + DefaultImageRepository = "registry.k8s.io" + // DefaultManifestsDir defines default manifests directory + DefaultManifestsDir = "/etc/kubernetes/manifests" + // DefaultClusterName defines the default cluster name + DefaultClusterName = "kubernetes" + + // DefaultEtcdDataDir defines default location of etcd where static pods will save data to + DefaultEtcdDataDir = "/var/lib/etcd" + // DefaultProxyBindAddressv4 is the default bind address when the advertise address is v4 + DefaultProxyBindAddressv4 = "0.0.0.0" + // DefaultProxyBindAddressv6 is the default bind address when the advertise address is v6 + DefaultProxyBindAddressv6 = "::" + // DefaultDiscoveryTimeout specifies the default discovery timeout for kubeadm (used unless one is specified in the JoinConfiguration) + DefaultDiscoveryTimeout = 5 * time.Minute + + // DefaultImagePullPolicy is the default image pull policy in kubeadm + DefaultImagePullPolicy = corev1.PullIfNotPresent +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_InitConfiguration assigns default values for the InitConfiguration +func SetDefaults_InitConfiguration(obj *InitConfiguration) { + SetDefaults_BootstrapTokens(obj) + SetDefaults_APIEndpoint(&obj.LocalAPIEndpoint) + SetDefaults_NodeRegistration(&obj.NodeRegistration) +} + +// SetDefaults_ClusterConfiguration assigns default values for the ClusterConfiguration +func SetDefaults_ClusterConfiguration(obj *ClusterConfiguration) { + if obj.KubernetesVersion == "" { + obj.KubernetesVersion = DefaultKubernetesVersion + } + + if obj.Networking.ServiceSubnet == "" { + obj.Networking.ServiceSubnet = DefaultServicesSubnet + } + + if obj.Networking.DNSDomain == "" { + obj.Networking.DNSDomain = DefaultServiceDNSDomain + } + + if obj.CertificatesDir == "" { + obj.CertificatesDir = DefaultCertificatesDir + } + + if obj.ImageRepository == "" { + obj.ImageRepository = DefaultImageRepository + } + + if obj.ClusterName == "" { + obj.ClusterName = DefaultClusterName + } + + SetDefaults_Etcd(obj) + SetDefaults_APIServer(&obj.APIServer) +} + +// SetDefaults_APIServer assigns default values for the API Server +func SetDefaults_APIServer(obj *APIServer) { + if obj.TimeoutForControlPlane == nil { + obj.TimeoutForControlPlane = &metav1.Duration{ + Duration: constants.DefaultControlPlaneTimeout, + } + } +} + +// SetDefaults_Etcd assigns default values for the proxy +func SetDefaults_Etcd(obj *ClusterConfiguration) { + if obj.Etcd.External == nil && obj.Etcd.Local == nil { + obj.Etcd.Local = &LocalEtcd{} + } + if obj.Etcd.Local != nil { + if obj.Etcd.Local.DataDir == "" { + obj.Etcd.Local.DataDir = DefaultEtcdDataDir + } + } +} + +// SetDefaults_JoinConfiguration assigns default values to a regular node +func SetDefaults_JoinConfiguration(obj *JoinConfiguration) { + if obj.CACertPath == "" { + obj.CACertPath = DefaultCACertPath + } + + SetDefaults_JoinControlPlane(obj.ControlPlane) + SetDefaults_Discovery(&obj.Discovery) + SetDefaults_NodeRegistration(&obj.NodeRegistration) +} + +func SetDefaults_JoinControlPlane(obj *JoinControlPlane) { + if obj != nil { + SetDefaults_APIEndpoint(&obj.LocalAPIEndpoint) + } +} + +// SetDefaults_Discovery assigns default values for the discovery process +func SetDefaults_Discovery(obj *Discovery) { + if len(obj.TLSBootstrapToken) == 0 && obj.BootstrapToken != nil { + obj.TLSBootstrapToken = obj.BootstrapToken.Token + } + + if obj.Timeout == nil { + obj.Timeout = &metav1.Duration{ + Duration: DefaultDiscoveryTimeout, + } + } + + if obj.File != nil { + SetDefaults_FileDiscovery(obj.File) + } +} + +// SetDefaults_FileDiscovery assigns default values for file based discovery +func SetDefaults_FileDiscovery(obj *FileDiscovery) { + // Make sure file URL becomes path + if len(obj.KubeConfigPath) != 0 { + u, err := url.Parse(obj.KubeConfigPath) + if err == nil && u.Scheme == "file" { + obj.KubeConfigPath = u.Path + } + } +} + +// SetDefaults_BootstrapTokens sets the defaults for the .BootstrapTokens field +// If the slice is empty, it's defaulted with one token. Otherwise it just loops +// through the slice and sets the defaults for the omitempty fields that are TTL, +// Usages and Groups. Token is NOT defaulted with a random one in the API defaulting +// layer, but set to a random value later at runtime if not set before. +func SetDefaults_BootstrapTokens(obj *InitConfiguration) { + + if obj.BootstrapTokens == nil || len(obj.BootstrapTokens) == 0 { + obj.BootstrapTokens = []bootstraptokenv1.BootstrapToken{{}} + } + + for i := range obj.BootstrapTokens { + SetDefaults_BootstrapToken(&obj.BootstrapTokens[i]) + } +} + +// SetDefaults_BootstrapToken sets the defaults for an individual Bootstrap Token +func SetDefaults_BootstrapToken(bt *bootstraptokenv1.BootstrapToken) { + if bt.TTL == nil { + bt.TTL = &metav1.Duration{ + Duration: constants.DefaultTokenDuration, + } + } + if len(bt.Usages) == 0 { + bt.Usages = constants.DefaultTokenUsages + } + + if len(bt.Groups) == 0 { + bt.Groups = constants.DefaultTokenGroups + } +} + +// SetDefaults_APIEndpoint sets the defaults for the API server instance deployed on a node. +func SetDefaults_APIEndpoint(obj *APIEndpoint) { + if obj.BindPort == 0 { + obj.BindPort = DefaultAPIBindPort + } +} + +// SetDefaults_NodeRegistration sets the defaults for the NodeRegistrationOptions object +func SetDefaults_NodeRegistration(obj *NodeRegistrationOptions) { + if len(obj.ImagePullPolicy) == 0 { + obj.ImagePullPolicy = DefaultImagePullPolicy + } +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_unix.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_unix.go new file mode 100644 index 00000000000..cb79b8d2e18 --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_unix.go @@ -0,0 +1,27 @@ +//go:build !windows +// +build !windows + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +const ( + // DefaultCACertPath defines default location of CA certificate on Linux + DefaultCACertPath = "/etc/kubernetes/pki/ca.crt" + // DefaultContainerRuntimeURLScheme defines default socket url prefix + DefaultContainerRuntimeURLScheme = "unix" +) diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_windows.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_windows.go new file mode 100644 index 00000000000..6926d7d8370 --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults_windows.go @@ -0,0 +1,27 @@ +//go:build windows +// +build windows + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +const ( + // DefaultCACertPath defines default location of CA certificate on Windows + DefaultCACertPath = "C:/etc/kubernetes/pki/ca.crt" + // DefaultContainerRuntimeURLScheme defines default socket url prefix + DefaultContainerRuntimeURLScheme = "npipe" +) diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/doc.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/doc.go new file mode 100644 index 00000000000..5056e492e7f --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/doc.go @@ -0,0 +1,273 @@ +/* +Copyright 2023 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. +*/ + +// +k8s:defaulter-gen=TypeMeta +// +groupName=kubeadm.k8s.io +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm + +// Package v1beta4 defines the v1beta4 version of the kubeadm configuration file format. +// This version improves on the v1beta2 format by fixing some minor issues and adding a few new fields. +// +// A list of changes since v1beta3: +// - TODO https://github.com/kubernetes/kubeadm/issues/2890 +// +// Migration from old kubeadm config versions +// +// - kubeadm v1.15.x and newer can be used to migrate from v1beta1 to v1beta2. +// - kubeadm v1.22.x and newer no longer support v1beta1 and older APIs, but can be used to migrate v1beta2 to v1beta3. +// - kubeadm v1.27.x and newer no longer support v1beta2 and older APIs. +// - TODO: https://github.com/kubernetes/kubeadm/issues/2890 +// add version that can be used to convert to v1beta4 +// +// # Basics +// +// The preferred way to configure kubeadm is to pass an YAML configuration file with the --config option. Some of the +// configuration options defined in the kubeadm config file are also available as command line flags, but only +// the most common/simple use case are supported with this approach. +// +// A kubeadm config file could contain multiple configuration types separated using three dashes (“---”). +// +// kubeadm supports the following configuration types: +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: InitConfiguration +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: ClusterConfiguration +// +// apiVersion: kubelet.config.k8s.io/v1beta1 +// kind: KubeletConfiguration +// +// apiVersion: kubeproxy.config.k8s.io/v1alpha1 +// kind: KubeProxyConfiguration +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: JoinConfiguration +// +// To print the defaults for "init" and "join" actions use the following commands: +// +// kubeadm config print init-defaults +// kubeadm config print join-defaults +// +// The list of configuration types that must be included in a configuration file depends by the action you are +// performing (init or join) and by the configuration options you are going to use (defaults or advanced customization). +// +// If some configuration types are not provided, or provided only partially, kubeadm will use default values; defaults +// provided by kubeadm includes also enforcing consistency of values across components when required (e.g. +// cluster-cidr flag on controller manager and clusterCIDR on kube-proxy). +// +// Users are always allowed to override default values, with the only exception of a small subset of setting with +// relevance for security (e.g. enforce authorization-mode Node and RBAC on api server) +// +// If the user provides a configuration types that is not expected for the action you are performing, kubeadm will +// ignore those types and print a warning. +// +// # Kubeadm init configuration types +// +// When executing kubeadm init with the --config option, the following configuration types could be used: +// InitConfiguration, ClusterConfiguration, KubeProxyConfiguration, KubeletConfiguration, but only one +// between InitConfiguration and ClusterConfiguration is mandatory. +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: InitConfiguration +// bootstrapTokens: +// ... +// nodeRegistration: +// ... +// +// The InitConfiguration type should be used to configure runtime settings, that in case of kubeadm init +// are the configuration of the bootstrap token and all the setting which are specific to the node where kubeadm +// is executed, including: +// +// - NodeRegistration, that holds fields that relate to registering the new node to the cluster; +// use it to customize the node name, the CRI socket to use or any other settings that should apply to this +// node only (e.g. the node ip). +// +// - LocalAPIEndpoint, that represents the endpoint of the instance of the API server to be deployed on this node; +// use it e.g. to customize the API server advertise address. +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: ClusterConfiguration +// networking: +// ... +// etcd: +// ... +// apiServer: +// extraArgs: +// ... +// extraVolumes: +// ... +// ... +// +// The ClusterConfiguration type should be used to configure cluster-wide settings, +// including settings for: +// +// - Networking, that holds configuration for the networking topology of the cluster; use it e.g. to customize +// pod subnet or services subnet. +// +// - Etcd configurations; use it e.g. to customize the local etcd or to configure the API server +// for using an external etcd cluster. +// +// - kube-apiserver, kube-scheduler, kube-controller-manager configurations; use it to customize control-plane +// components by adding customized setting or overriding kubeadm default settings. +// +// apiVersion: kubeproxy.config.k8s.io/v1alpha1 +// kind: KubeProxyConfiguration +// ... +// +// The KubeProxyConfiguration type should be used to change the configuration passed to kube-proxy instances deployed +// in the cluster. If this object is not provided or provided only partially, kubeadm applies defaults. +// +// See https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ or https://pkg.go.dev/k8s.io/kube-proxy/config/v1alpha1#KubeProxyConfiguration +// for kube proxy official documentation. +// +// apiVersion: kubelet.config.k8s.io/v1beta1 +// kind: KubeletConfiguration +// ... +// +// The KubeletConfiguration type should be used to change the configurations that will be passed to all kubelet instances +// deployed in the cluster. If this object is not provided or provided only partially, kubeadm applies defaults. +// +// See https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/ or https://pkg.go.dev/k8s.io/kubelet/config/v1beta1#KubeletConfiguration +// for kubelet official documentation. +// +// Here is a fully populated example of a single YAML file containing multiple +// configuration types to be used during a `kubeadm init` run. +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: InitConfiguration +// bootstrapTokens: +// - token: "9a08jv.c0izixklcxtmnze7" +// description: "kubeadm bootstrap token" +// ttl: "24h" +// - token: "783bde.3f89s0fje9f38fhf" +// description: "another bootstrap token" +// usages: +// - authentication +// - signing +// groups: +// - system:bootstrappers:kubeadm:default-node-token +// nodeRegistration: +// name: "ec2-10-100-0-1" +// criSocket: "unix:///var/run/containerd/containerd.sock" +// taints: +// - key: "kubeadmNode" +// value: "someValue" +// effect: "NoSchedule" +// kubeletExtraArgs: +// v: 4 +// ignorePreflightErrors: +// - IsPrivilegedUser +// imagePullPolicy: "IfNotPresent" +// localAPIEndpoint: +// advertiseAddress: "10.100.0.1" +// bindPort: 6443 +// certificateKey: "e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204" +// skipPhases: +// - addon/kube-proxy +// --- +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: ClusterConfiguration +// etcd: +// # one of local or external +// local: +// imageRepository: "registry.k8s.io" +// imageTag: "3.2.24" +// dataDir: "/var/lib/etcd" +// extraArgs: +// listen-client-urls: "http://10.100.0.1:2379" +// serverCertSANs: +// - "ec2-10-100-0-1.compute-1.amazonaws.com" +// peerCertSANs: +// - "10.100.0.1" +// # external: +// # endpoints: +// # - "10.100.0.1:2379" +// # - "10.100.0.2:2379" +// # caFile: "/etcd/kubernetes/pki/etcd/etcd-ca.crt" +// # certFile: "/etcd/kubernetes/pki/etcd/etcd.crt" +// # keyFile: "/etcd/kubernetes/pki/etcd/etcd.key" +// networking: +// serviceSubnet: "10.96.0.0/16" +// podSubnet: "10.244.0.0/24" +// dnsDomain: "cluster.local" +// kubernetesVersion: "v1.21.0" +// controlPlaneEndpoint: "10.100.0.1:6443" +// apiServer: +// extraArgs: +// authorization-mode: "Node,RBAC" +// extraVolumes: +// - name: "some-volume" +// hostPath: "/etc/some-path" +// mountPath: "/etc/some-pod-path" +// readOnly: false +// pathType: File +// certSANs: +// - "10.100.1.1" +// - "ec2-10-100-0-1.compute-1.amazonaws.com" +// timeoutForControlPlane: 4m0s +// controllerManager: +// extraArgs: +// "node-cidr-mask-size": "20" +// extraVolumes: +// - name: "some-volume" +// hostPath: "/etc/some-path" +// mountPath: "/etc/some-pod-path" +// readOnly: false +// pathType: File +// scheduler: +// extraArgs: +// address: "10.100.0.1" +// extraVolumes: +// - name: "some-volume" +// hostPath: "/etc/some-path" +// mountPath: "/etc/some-pod-path" +// readOnly: false +// pathType: File +// certificatesDir: "/etc/kubernetes/pki" +// imageRepository: "registry.k8s.io" +// clusterName: "example-cluster" +// --- +// apiVersion: kubelet.config.k8s.io/v1beta1 +// kind: KubeletConfiguration +// # kubelet specific options here +// --- +// apiVersion: kubeproxy.config.k8s.io/v1alpha1 +// kind: KubeProxyConfiguration +// # kube-proxy specific options here +// +// # Kubeadm join configuration types +// +// When executing kubeadm join with the --config option, the JoinConfiguration type should be provided. +// +// apiVersion: kubeadm.k8s.io/v1beta4 +// kind: JoinConfiguration +// ... +// +// The JoinConfiguration type should be used to configure runtime settings, that in case of kubeadm join +// are the discovery method used for accessing the cluster info and all the setting which are specific +// to the node where kubeadm is executed, including: +// +// - NodeRegistration, that holds fields that relate to registering the new node to the cluster; +// use it to customize the node name, the CRI socket to use or any other settings that should apply to this +// node only (e.g. the node ip). +// +// - APIEndpoint, that represents the endpoint of the instance of the API server to be eventually deployed on this node. +package v1beta4 // import "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta4" + +//TODO: The BootstrapTokenString object should move out to either k8s.io/client-go or k8s.io/api in the future +//(probably as part of Bootstrap Tokens going GA). It should not be staged under the kubeadm API as it is now. diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/register.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/register.go new file mode 100644 index 00000000000..fa40e90c4ab --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/register.go @@ -0,0 +1,64 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "kubeadm.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta4"} + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) +} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &InitConfiguration{}, + &ClusterConfiguration{}, + &JoinConfiguration{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go new file mode 100644 index 00000000000..5d07b270c6e --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go @@ -0,0 +1,445 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InitConfiguration contains a list of elements that is specific "kubeadm init"-only runtime +// information. +type InitConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs. + // After that, the information in the fields IS NOT uploaded to the `kubeadm-config` ConfigMap + // that is used by `kubeadm upgrade` for instance. These fields must be omitempty. + + // BootstrapTokens is respected at `kubeadm init` time and describes a set of Bootstrap Tokens to create. + // This information IS NOT uploaded to the kubeadm cluster configmap, partly because of its sensitive nature + // +optional + BootstrapTokens []bootstraptokenv1.BootstrapToken `json:"bootstrapTokens,omitempty"` + + // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster + // +optional + NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"` + + // LocalAPIEndpoint represents the endpoint of the API server instance that's deployed on this control plane node + // In HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint in the sense that ControlPlaneEndpoint + // is the global endpoint for the cluster, which then loadbalances the requests to each individual API server. This + // configuration object lets you customize what IP/DNS name and port the local API server advertises it's accessible + // on. By default, kubeadm tries to auto-detect the IP of the default interface and use that, but in case that process + // fails you may set the desired value here. + // +optional + LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"` + + // CertificateKey sets the key with which certificates and keys are encrypted prior to being uploaded in + // a secret in the cluster during the uploadcerts init phase. + // +optional + CertificateKey string `json:"certificateKey,omitempty"` + + // SkipPhases is a list of phases to skip during command execution. + // The list of phases can be obtained with the "kubeadm init --help" command. + // The flag "--skip-phases" takes precedence over this field. + // +optional + SkipPhases []string `json:"skipPhases,omitempty"` + + // Patches contains options related to applying patches to components deployed by kubeadm during + // "kubeadm init". + // +optional + Patches *Patches `json:"patches,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterConfiguration contains cluster-wide configuration for a kubeadm cluster +type ClusterConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Etcd holds configuration for etcd. + // +optional + Etcd Etcd `json:"etcd,omitempty"` + + // Networking holds configuration for the networking topology of the cluster. + // +optional + Networking Networking `json:"networking,omitempty"` + + // KubernetesVersion is the target version of the control plane. + // +optional + KubernetesVersion string `json:"kubernetesVersion,omitempty"` + + // ControlPlaneEndpoint sets a stable IP address or DNS name for the control plane; it + // can be a valid IP address or a RFC-1123 DNS subdomain, both with optional TCP port. + // In case the ControlPlaneEndpoint is not specified, the AdvertiseAddress + BindPort + // are used; in case the ControlPlaneEndpoint is specified but without a TCP port, + // the BindPort is used. + // Possible usages are: + // e.g. In a cluster with more than one control plane instances, this field should be + // assigned the address of the external load balancer in front of the + // control plane instances. + // e.g. in environments with enforced node recycling, the ControlPlaneEndpoint + // could be used for assigning a stable DNS to the control plane. + // +optional + ControlPlaneEndpoint string `json:"controlPlaneEndpoint,omitempty"` + + // APIServer contains extra settings for the API server control plane component + // +optional + APIServer APIServer `json:"apiServer,omitempty"` + + // ControllerManager contains extra settings for the controller manager control plane component + // +optional + ControllerManager ControlPlaneComponent `json:"controllerManager,omitempty"` + + // Scheduler contains extra settings for the scheduler control plane component + // +optional + Scheduler ControlPlaneComponent `json:"scheduler,omitempty"` + + // DNS defines the options for the DNS add-on installed in the cluster. + // +optional + DNS DNS `json:"dns,omitempty"` + + // CertificatesDir specifies where to store or look for all required certificates. + // +optional + CertificatesDir string `json:"certificatesDir,omitempty"` + + // ImageRepository sets the container registry to pull images from. + // If empty, `registry.k8s.io` will be used by default; in case of kubernetes version is a CI build (kubernetes version starts with `ci/`) + // `gcr.io/k8s-staging-ci-images` will be used as a default for control plane components and for kube-proxy, while `registry.k8s.io` + // will be used for all the other images. + // +optional + ImageRepository string `json:"imageRepository,omitempty"` + + // FeatureGates enabled by the user. + // +optional + FeatureGates map[string]bool `json:"featureGates,omitempty"` + + // The cluster name + // +optional + ClusterName string `json:"clusterName,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. + // A key in this map is the flag name as it appears on the + // command line except without leading dash(es). + // TODO: This is temporary and ideally we would like to switch all components to + // use ComponentConfig + ConfigMaps. + // +optional + ExtraArgs map[string]string `json:"extraArgs,omitempty"` + + // ExtraVolumes is an extra set of host volumes, mounted to the control plane component. + // +optional + ExtraVolumes []HostPathMount `json:"extraVolumes,omitempty"` +} + +// APIServer holds settings necessary for API server deployments in the cluster +type APIServer struct { + ControlPlaneComponent `json:",inline"` + + // CertSANs sets extra Subject Alternative Names for the API Server signing cert. + // +optional + CertSANs []string `json:"certSANs,omitempty"` + + // TimeoutForControlPlane controls the timeout that we use for API server to appear + // +optional + TimeoutForControlPlane *metav1.Duration `json:"timeoutForControlPlane,omitempty"` +} + +// DNSAddOnType defines string identifying DNS add-on types +type DNSAddOnType string + +// DNS defines the DNS addon that should be used in the cluster +type DNS struct { + // ImageMeta allows to customize the image used for the DNS component + ImageMeta `json:",inline"` +} + +// ImageMeta allows to customize the image used for components that are not +// originated from the Kubernetes/Kubernetes release process +type ImageMeta struct { + // ImageRepository sets the container registry to pull images from. + // if not set, the ImageRepository defined in ClusterConfiguration will be used instead. + // +optional + ImageRepository string `json:"imageRepository,omitempty"` + + // 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. + // +optional + ImageTag string `json:"imageTag,omitempty"` + + //TODO: evaluate if we need also a ImageName based on user feedbacks +} + +// APIEndpoint struct contains elements of API server instance deployed on a node. +type APIEndpoint struct { + // AdvertiseAddress sets the IP address for the API server to advertise. + // +optional + AdvertiseAddress string `json:"advertiseAddress,omitempty"` + + // BindPort sets the secure port for the API Server to bind to. + // Defaults to 6443. + // +optional + BindPort int32 `json:"bindPort,omitempty"` +} + +// NodeRegistrationOptions holds fields that relate to registering a new control-plane or node to the cluster, either via "kubeadm init" or "kubeadm join" +type NodeRegistrationOptions struct { + + // Name is the `.Metadata.Name` field of the Node API object that will be created in this `kubeadm init` or `kubeadm join` operation. + // This field is also used in the CommonName field of the kubelet's client certificate to the API server. + // Defaults to the hostname of the node if not provided. + // +optional + Name string `json:"name,omitempty"` + + // CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use + // +optional + CRISocket string `json:"criSocket,omitempty"` + + // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, + // it will be defaulted with a control-plane taint for control-plane nodes. If you don't want to taint your control-plane + // node, set this field to an empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. + Taints []corev1.Taint `json:"taints"` + + // KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file + // kubeadm writes at runtime for the kubelet to source. This overrides the generic base-level configuration in the kubelet-config ConfigMap + // Flags have higher priority when parsing. These values are local and specific to the node kubeadm is executing on. + // A key in this map is the flag name as it appears on the + // command line except without leading dash(es). + // +optional + KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"` + + // IgnorePreflightErrors provides a slice of pre-flight errors to be ignored when the current node is registered. + // +optional + IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"` + + // ImagePullPolicy specifies the policy for image pulling during kubeadm "init" and "join" operations. + // The value of this field must be one of "Always", "IfNotPresent" or "Never". + // If this field is unset kubeadm will default it to "IfNotPresent", or pull the required images if not present on the host. + // +optional + ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` +} + +// Networking contains elements describing cluster's networking configuration +type Networking struct { + // ServiceSubnet is the subnet used by k8s services. Defaults to "10.96.0.0/12". + // +optional + ServiceSubnet string `json:"serviceSubnet,omitempty"` + // PodSubnet is the subnet used by pods. + // +optional + PodSubnet string `json:"podSubnet,omitempty"` + // DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local". + // +optional + DNSDomain string `json:"dnsDomain,omitempty"` +} + +// Etcd contains elements describing Etcd configuration. +type Etcd struct { + + // Local provides configuration knobs for configuring the local etcd instance + // Local and External are mutually exclusive + // +optional + Local *LocalEtcd `json:"local,omitempty"` + + // External describes how to connect to an external etcd cluster + // Local and External are mutually exclusive + // +optional + External *ExternalEtcd `json:"external,omitempty"` +} + +// LocalEtcd describes that kubeadm should run an etcd cluster locally +type LocalEtcd struct { + // ImageMeta allows to customize the container used for etcd + ImageMeta `json:",inline"` + + // DataDir is the directory etcd will place its data. + // Defaults to "/var/lib/etcd". + DataDir string `json:"dataDir"` + + // ExtraArgs are extra arguments provided to the etcd binary + // when run inside a static pod. + // A key in this map is the flag name as it appears on the + // command line except without leading dash(es). + // +optional + ExtraArgs map[string]string `json:"extraArgs,omitempty"` + + // ServerCertSANs sets extra Subject Alternative Names for the etcd server signing cert. + // +optional + ServerCertSANs []string `json:"serverCertSANs,omitempty"` + // PeerCertSANs sets extra Subject Alternative Names for the etcd peer signing cert. + // +optional + PeerCertSANs []string `json:"peerCertSANs,omitempty"` +} + +// ExternalEtcd describes an external etcd cluster. +// Kubeadm has no knowledge of where certificate files live and they must be supplied. +type ExternalEtcd struct { + // Endpoints of etcd members. Required for ExternalEtcd. + Endpoints []string `json:"endpoints"` + + // CAFile is an SSL Certificate Authority file used to secure etcd communication. + // Required if using a TLS connection. + CAFile string `json:"caFile"` + + // CertFile is an SSL certification file used to secure etcd communication. + // Required if using a TLS connection. + CertFile string `json:"certFile"` + + // KeyFile is an SSL key file used to secure etcd communication. + // Required if using a TLS connection. + KeyFile string `json:"keyFile"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// JoinConfiguration contains elements describing a particular node. +type JoinConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster + // +optional + NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"` + + // CACertPath is the path to the SSL certificate authority used to + // secure comunications between node and control-plane. + // Defaults to "/etc/kubernetes/pki/ca.crt". + // +optional + CACertPath string `json:"caCertPath,omitempty"` + + // Discovery specifies the options for the kubelet to use during the TLS Bootstrap process + Discovery Discovery `json:"discovery"` + + // ControlPlane defines the additional control plane instance to be deployed on the joining node. + // If nil, no additional control plane instance will be deployed. + // +optional + ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"` + + // SkipPhases is a list of phases to skip during command execution. + // The list of phases can be obtained with the "kubeadm join --help" command. + // The flag "--skip-phases" takes precedence over this field. + // +optional + SkipPhases []string `json:"skipPhases,omitempty"` + + // Patches contains options related to applying patches to components deployed by kubeadm during + // "kubeadm join". + // +optional + Patches *Patches `json:"patches,omitempty"` +} + +// JoinControlPlane contains elements describing an additional control plane instance to be deployed on the joining node. +type JoinControlPlane struct { + // LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this node. + // +optional + LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"` + + // CertificateKey is the key that is used for decryption of certificates after they are downloaded from the secret + // upon joining a new control plane node. The corresponding encryption key is in the InitConfiguration. + // +optional + CertificateKey string `json:"certificateKey,omitempty"` +} + +// Discovery specifies the options for the kubelet to use during the TLS Bootstrap process +type Discovery struct { + // BootstrapToken is used to set the options for bootstrap token based discovery + // BootstrapToken and File are mutually exclusive + // +optional + BootstrapToken *BootstrapTokenDiscovery `json:"bootstrapToken,omitempty"` + + // File is used to specify a file or URL to a kubeconfig file from which to load cluster information + // BootstrapToken and File are mutually exclusive + // +optional + File *FileDiscovery `json:"file,omitempty"` + + // TLSBootstrapToken is a token used for TLS bootstrapping. + // If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, but can be overridden. + // If .File is set, this field **must be set** in case the KubeConfigFile does not contain any other authentication information + // +optional + TLSBootstrapToken string `json:"tlsBootstrapToken,omitempty" datapolicy:"token"` + + // Timeout modifies the discovery timeout + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty"` +} + +// BootstrapTokenDiscovery is used to set the options for bootstrap token based discovery +type BootstrapTokenDiscovery struct { + // Token is a token used to validate cluster information + // fetched from the control-plane. + Token string `json:"token" datapolicy:"token"` + + // APIServerEndpoint is an IP or domain name to the API server from which info will be fetched. + // +optional + APIServerEndpoint string `json:"apiServerEndpoint,omitempty"` + + // CACertHashes specifies a set of public key pins to verify + // when token-based discovery is used. The root CA found during discovery + // must match one of these values. Specifying an empty set disables root CA + // pinning, which can be unsafe. Each hash is specified as ":", + // where the only currently supported type is "sha256". This is a hex-encoded + // SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded + // ASN.1. These hashes can be calculated using, for example, OpenSSL. + // +optional + CACertHashes []string `json:"caCertHashes,omitempty" datapolicy:"security-key"` + + // UnsafeSkipCAVerification allows token-based discovery + // without CA verification via CACertHashes. This can weaken + // the security of kubeadm since other nodes can impersonate the control-plane. + // +optional + UnsafeSkipCAVerification bool `json:"unsafeSkipCAVerification,omitempty"` +} + +// FileDiscovery is used to specify a file or URL to a kubeconfig file from which to load cluster information +type FileDiscovery struct { + // KubeConfigPath is used to specify the actual file path or URL to the kubeconfig file from which to load cluster information + KubeConfigPath string `json:"kubeConfigPath"` +} + +// HostPathMount contains elements describing volumes that are mounted from the +// host. +type HostPathMount struct { + // Name of the volume inside the pod template. + Name string `json:"name"` + // HostPath is the path in the host that will be mounted inside + // the pod. + HostPath string `json:"hostPath"` + // MountPath is the path inside the pod where hostPath will be mounted. + MountPath string `json:"mountPath"` + // ReadOnly controls write access to the volume + // +optional + ReadOnly bool `json:"readOnly,omitempty"` + // PathType is the type of the HostPath. + // +optional + PathType corev1.HostPathType `json:"pathType,omitempty"` +} + +// Patches contains options related to applying patches to components deployed by kubeadm. +type Patches struct { + // Directory is a path to a directory that contains files named "target[suffix][+patchtype].extension". + // For example, "kube-apiserver0+merge.yaml" or just "etcd.json". "target" can be one of + // "kube-apiserver", "kube-controller-manager", "kube-scheduler", "etcd", "kubeletconfiguration". + // "patchtype" can be one of "strategic" "merge" or "json" and they match the patch formats supported by kubectl. + // The default "patchtype" is "strategic". "extension" must be either "json" or "yaml". + // "suffix" is an optional string that can be used to determine which patches are applied + // first alpha-numerically. + // +optional + Directory string `json:"directory,omitempty"` +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.conversion.go new file mode 100644 index 00000000000..3126823e2ef --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.conversion.go @@ -0,0 +1,767 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1beta4 + +import ( + unsafe "unsafe" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" + kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" +) + +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), (*kubeadm.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(a.(*APIEndpoint), b.(*kubeadm.APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.APIEndpoint)(nil), (*APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(a.(*kubeadm.APIEndpoint), b.(*APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServer)(nil), (*kubeadm.APIServer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_APIServer_To_kubeadm_APIServer(a.(*APIServer), b.(*kubeadm.APIServer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.APIServer)(nil), (*APIServer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_APIServer_To_v1beta4_APIServer(a.(*kubeadm.APIServer), b.(*APIServer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BootstrapTokenDiscovery)(nil), (*kubeadm.BootstrapTokenDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_BootstrapTokenDiscovery_To_kubeadm_BootstrapTokenDiscovery(a.(*BootstrapTokenDiscovery), b.(*kubeadm.BootstrapTokenDiscovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.BootstrapTokenDiscovery)(nil), (*BootstrapTokenDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_BootstrapTokenDiscovery_To_v1beta4_BootstrapTokenDiscovery(a.(*kubeadm.BootstrapTokenDiscovery), b.(*BootstrapTokenDiscovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterConfiguration)(nil), (*kubeadm.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration(a.(*ClusterConfiguration), b.(*kubeadm.ClusterConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_ClusterConfiguration_To_v1beta4_ClusterConfiguration(a.(*kubeadm.ClusterConfiguration), b.(*ClusterConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ControlPlaneComponent)(nil), (*kubeadm.ControlPlaneComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(a.(*ControlPlaneComponent), b.(*kubeadm.ControlPlaneComponent), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.ControlPlaneComponent)(nil), (*ControlPlaneComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(a.(*kubeadm.ControlPlaneComponent), b.(*ControlPlaneComponent), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DNS)(nil), (*kubeadm.DNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_DNS_To_kubeadm_DNS(a.(*DNS), b.(*kubeadm.DNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.DNS)(nil), (*DNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_DNS_To_v1beta4_DNS(a.(*kubeadm.DNS), b.(*DNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Discovery)(nil), (*kubeadm.Discovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_Discovery_To_kubeadm_Discovery(a.(*Discovery), b.(*kubeadm.Discovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.Discovery)(nil), (*Discovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_Discovery_To_v1beta4_Discovery(a.(*kubeadm.Discovery), b.(*Discovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Etcd)(nil), (*kubeadm.Etcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_Etcd_To_kubeadm_Etcd(a.(*Etcd), b.(*kubeadm.Etcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.Etcd)(nil), (*Etcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_Etcd_To_v1beta4_Etcd(a.(*kubeadm.Etcd), b.(*Etcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExternalEtcd)(nil), (*kubeadm.ExternalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_ExternalEtcd_To_kubeadm_ExternalEtcd(a.(*ExternalEtcd), b.(*kubeadm.ExternalEtcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.ExternalEtcd)(nil), (*ExternalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_ExternalEtcd_To_v1beta4_ExternalEtcd(a.(*kubeadm.ExternalEtcd), b.(*ExternalEtcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*FileDiscovery)(nil), (*kubeadm.FileDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_FileDiscovery_To_kubeadm_FileDiscovery(a.(*FileDiscovery), b.(*kubeadm.FileDiscovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.FileDiscovery)(nil), (*FileDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_FileDiscovery_To_v1beta4_FileDiscovery(a.(*kubeadm.FileDiscovery), b.(*FileDiscovery), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HostPathMount)(nil), (*kubeadm.HostPathMount)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_HostPathMount_To_kubeadm_HostPathMount(a.(*HostPathMount), b.(*kubeadm.HostPathMount), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.HostPathMount)(nil), (*HostPathMount)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_HostPathMount_To_v1beta4_HostPathMount(a.(*kubeadm.HostPathMount), b.(*HostPathMount), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ImageMeta)(nil), (*kubeadm.ImageMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(a.(*ImageMeta), b.(*kubeadm.ImageMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.ImageMeta)(nil), (*ImageMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(a.(*kubeadm.ImageMeta), b.(*ImageMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*JoinConfiguration)(nil), (*kubeadm.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration(a.(*JoinConfiguration), b.(*kubeadm.JoinConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(a.(*kubeadm.JoinConfiguration), b.(*JoinConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*JoinControlPlane)(nil), (*kubeadm.JoinControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_JoinControlPlane_To_kubeadm_JoinControlPlane(a.(*JoinControlPlane), b.(*kubeadm.JoinControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.JoinControlPlane)(nil), (*JoinControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_JoinControlPlane_To_v1beta4_JoinControlPlane(a.(*kubeadm.JoinControlPlane), b.(*JoinControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LocalEtcd)(nil), (*kubeadm.LocalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_LocalEtcd_To_kubeadm_LocalEtcd(a.(*LocalEtcd), b.(*kubeadm.LocalEtcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.LocalEtcd)(nil), (*LocalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_LocalEtcd_To_v1beta4_LocalEtcd(a.(*kubeadm.LocalEtcd), b.(*LocalEtcd), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Networking)(nil), (*kubeadm.Networking)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_Networking_To_kubeadm_Networking(a.(*Networking), b.(*kubeadm.Networking), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.Networking)(nil), (*Networking)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_Networking_To_v1beta4_Networking(a.(*kubeadm.Networking), b.(*Networking), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeRegistrationOptions)(nil), (*kubeadm.NodeRegistrationOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(a.(*NodeRegistrationOptions), b.(*kubeadm.NodeRegistrationOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.NodeRegistrationOptions)(nil), (*NodeRegistrationOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(a.(*kubeadm.NodeRegistrationOptions), b.(*NodeRegistrationOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Patches)(nil), (*kubeadm.Patches)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_Patches_To_kubeadm_Patches(a.(*Patches), b.(*kubeadm.Patches), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*kubeadm.Patches)(nil), (*Patches)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_Patches_To_v1beta4_Patches(a.(*kubeadm.Patches), b.(*Patches), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*kubeadm.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_kubeadm_InitConfiguration_To_v1beta4_InitConfiguration(a.(*kubeadm.InitConfiguration), b.(*InitConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*InitConfiguration)(nil), (*kubeadm.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta4_InitConfiguration_To_kubeadm_InitConfiguration(a.(*InitConfiguration), b.(*kubeadm.InitConfiguration), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(in *APIEndpoint, out *kubeadm.APIEndpoint, s conversion.Scope) error { + out.AdvertiseAddress = in.AdvertiseAddress + out.BindPort = in.BindPort + return nil +} + +// Convert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint is an autogenerated conversion function. +func Convert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(in *APIEndpoint, out *kubeadm.APIEndpoint, s conversion.Scope) error { + return autoConvert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(in, out, s) +} + +func autoConvert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(in *kubeadm.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + out.AdvertiseAddress = in.AdvertiseAddress + out.BindPort = in.BindPort + return nil +} + +// Convert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint is an autogenerated conversion function. +func Convert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(in *kubeadm.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + return autoConvert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(in, out, s) +} + +func autoConvert_v1beta4_APIServer_To_kubeadm_APIServer(in *APIServer, out *kubeadm.APIServer, s conversion.Scope) error { + if err := Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(&in.ControlPlaneComponent, &out.ControlPlaneComponent, s); err != nil { + return err + } + out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs)) + out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane)) + return nil +} + +// Convert_v1beta4_APIServer_To_kubeadm_APIServer is an autogenerated conversion function. +func Convert_v1beta4_APIServer_To_kubeadm_APIServer(in *APIServer, out *kubeadm.APIServer, s conversion.Scope) error { + return autoConvert_v1beta4_APIServer_To_kubeadm_APIServer(in, out, s) +} + +func autoConvert_kubeadm_APIServer_To_v1beta4_APIServer(in *kubeadm.APIServer, out *APIServer, s conversion.Scope) error { + if err := Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(&in.ControlPlaneComponent, &out.ControlPlaneComponent, s); err != nil { + return err + } + out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs)) + out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane)) + return nil +} + +// Convert_kubeadm_APIServer_To_v1beta4_APIServer is an autogenerated conversion function. +func Convert_kubeadm_APIServer_To_v1beta4_APIServer(in *kubeadm.APIServer, out *APIServer, s conversion.Scope) error { + return autoConvert_kubeadm_APIServer_To_v1beta4_APIServer(in, out, s) +} + +func autoConvert_v1beta4_BootstrapTokenDiscovery_To_kubeadm_BootstrapTokenDiscovery(in *BootstrapTokenDiscovery, out *kubeadm.BootstrapTokenDiscovery, s conversion.Scope) error { + out.Token = in.Token + out.APIServerEndpoint = in.APIServerEndpoint + out.CACertHashes = *(*[]string)(unsafe.Pointer(&in.CACertHashes)) + out.UnsafeSkipCAVerification = in.UnsafeSkipCAVerification + return nil +} + +// Convert_v1beta4_BootstrapTokenDiscovery_To_kubeadm_BootstrapTokenDiscovery is an autogenerated conversion function. +func Convert_v1beta4_BootstrapTokenDiscovery_To_kubeadm_BootstrapTokenDiscovery(in *BootstrapTokenDiscovery, out *kubeadm.BootstrapTokenDiscovery, s conversion.Scope) error { + return autoConvert_v1beta4_BootstrapTokenDiscovery_To_kubeadm_BootstrapTokenDiscovery(in, out, s) +} + +func autoConvert_kubeadm_BootstrapTokenDiscovery_To_v1beta4_BootstrapTokenDiscovery(in *kubeadm.BootstrapTokenDiscovery, out *BootstrapTokenDiscovery, s conversion.Scope) error { + out.Token = in.Token + out.APIServerEndpoint = in.APIServerEndpoint + out.CACertHashes = *(*[]string)(unsafe.Pointer(&in.CACertHashes)) + out.UnsafeSkipCAVerification = in.UnsafeSkipCAVerification + return nil +} + +// Convert_kubeadm_BootstrapTokenDiscovery_To_v1beta4_BootstrapTokenDiscovery is an autogenerated conversion function. +func Convert_kubeadm_BootstrapTokenDiscovery_To_v1beta4_BootstrapTokenDiscovery(in *kubeadm.BootstrapTokenDiscovery, out *BootstrapTokenDiscovery, s conversion.Scope) error { + return autoConvert_kubeadm_BootstrapTokenDiscovery_To_v1beta4_BootstrapTokenDiscovery(in, out, s) +} + +func autoConvert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error { + if err := Convert_v1beta4_Etcd_To_kubeadm_Etcd(&in.Etcd, &out.Etcd, s); err != nil { + return err + } + if err := Convert_v1beta4_Networking_To_kubeadm_Networking(&in.Networking, &out.Networking, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if err := Convert_v1beta4_APIServer_To_kubeadm_APIServer(&in.APIServer, &out.APIServer, s); err != nil { + return err + } + if err := Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(&in.ControllerManager, &out.ControllerManager, s); err != nil { + return err + } + if err := Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(&in.Scheduler, &out.Scheduler, s); err != nil { + return err + } + if err := Convert_v1beta4_DNS_To_kubeadm_DNS(&in.DNS, &out.DNS, s); err != nil { + return err + } + out.CertificatesDir = in.CertificatesDir + out.ImageRepository = in.ImageRepository + out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) + out.ClusterName = in.ClusterName + return nil +} + +// Convert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration is an autogenerated conversion function. +func Convert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error { + return autoConvert_v1beta4_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in, out, s) +} + +func autoConvert_kubeadm_ClusterConfiguration_To_v1beta4_ClusterConfiguration(in *kubeadm.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { + // INFO: in.ComponentConfigs opted out of conversion generation + if err := Convert_kubeadm_Etcd_To_v1beta4_Etcd(&in.Etcd, &out.Etcd, s); err != nil { + return err + } + if err := Convert_kubeadm_Networking_To_v1beta4_Networking(&in.Networking, &out.Networking, s); err != nil { + return err + } + out.KubernetesVersion = in.KubernetesVersion + // INFO: in.CIKubernetesVersion opted out of conversion generation + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if err := Convert_kubeadm_APIServer_To_v1beta4_APIServer(&in.APIServer, &out.APIServer, s); err != nil { + return err + } + if err := Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(&in.ControllerManager, &out.ControllerManager, s); err != nil { + return err + } + if err := Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(&in.Scheduler, &out.Scheduler, s); err != nil { + return err + } + if err := Convert_kubeadm_DNS_To_v1beta4_DNS(&in.DNS, &out.DNS, s); err != nil { + return err + } + out.CertificatesDir = in.CertificatesDir + out.ImageRepository = in.ImageRepository + // INFO: in.CIImageRepository opted out of conversion generation + out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) + out.ClusterName = in.ClusterName + return nil +} + +// Convert_kubeadm_ClusterConfiguration_To_v1beta4_ClusterConfiguration is an autogenerated conversion function. +func Convert_kubeadm_ClusterConfiguration_To_v1beta4_ClusterConfiguration(in *kubeadm.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { + return autoConvert_kubeadm_ClusterConfiguration_To_v1beta4_ClusterConfiguration(in, out, s) +} + +func autoConvert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(in *ControlPlaneComponent, out *kubeadm.ControlPlaneComponent, s conversion.Scope) error { + out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) + out.ExtraVolumes = *(*[]kubeadm.HostPathMount)(unsafe.Pointer(&in.ExtraVolumes)) + return nil +} + +// Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent is an autogenerated conversion function. +func Convert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(in *ControlPlaneComponent, out *kubeadm.ControlPlaneComponent, s conversion.Scope) error { + return autoConvert_v1beta4_ControlPlaneComponent_To_kubeadm_ControlPlaneComponent(in, out, s) +} + +func autoConvert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(in *kubeadm.ControlPlaneComponent, out *ControlPlaneComponent, s conversion.Scope) error { + out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) + out.ExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.ExtraVolumes)) + return nil +} + +// Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent is an autogenerated conversion function. +func Convert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(in *kubeadm.ControlPlaneComponent, out *ControlPlaneComponent, s conversion.Scope) error { + return autoConvert_kubeadm_ControlPlaneComponent_To_v1beta4_ControlPlaneComponent(in, out, s) +} + +func autoConvert_v1beta4_DNS_To_kubeadm_DNS(in *DNS, out *kubeadm.DNS, s conversion.Scope) error { + if err := Convert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta4_DNS_To_kubeadm_DNS is an autogenerated conversion function. +func Convert_v1beta4_DNS_To_kubeadm_DNS(in *DNS, out *kubeadm.DNS, s conversion.Scope) error { + return autoConvert_v1beta4_DNS_To_kubeadm_DNS(in, out, s) +} + +func autoConvert_kubeadm_DNS_To_v1beta4_DNS(in *kubeadm.DNS, out *DNS, s conversion.Scope) error { + if err := Convert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { + return err + } + return nil +} + +// Convert_kubeadm_DNS_To_v1beta4_DNS is an autogenerated conversion function. +func Convert_kubeadm_DNS_To_v1beta4_DNS(in *kubeadm.DNS, out *DNS, s conversion.Scope) error { + return autoConvert_kubeadm_DNS_To_v1beta4_DNS(in, out, s) +} + +func autoConvert_v1beta4_Discovery_To_kubeadm_Discovery(in *Discovery, out *kubeadm.Discovery, s conversion.Scope) error { + out.BootstrapToken = (*kubeadm.BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken)) + out.File = (*kubeadm.FileDiscovery)(unsafe.Pointer(in.File)) + out.TLSBootstrapToken = in.TLSBootstrapToken + out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_v1beta4_Discovery_To_kubeadm_Discovery is an autogenerated conversion function. +func Convert_v1beta4_Discovery_To_kubeadm_Discovery(in *Discovery, out *kubeadm.Discovery, s conversion.Scope) error { + return autoConvert_v1beta4_Discovery_To_kubeadm_Discovery(in, out, s) +} + +func autoConvert_kubeadm_Discovery_To_v1beta4_Discovery(in *kubeadm.Discovery, out *Discovery, s conversion.Scope) error { + out.BootstrapToken = (*BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken)) + out.File = (*FileDiscovery)(unsafe.Pointer(in.File)) + out.TLSBootstrapToken = in.TLSBootstrapToken + out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_kubeadm_Discovery_To_v1beta4_Discovery is an autogenerated conversion function. +func Convert_kubeadm_Discovery_To_v1beta4_Discovery(in *kubeadm.Discovery, out *Discovery, s conversion.Scope) error { + return autoConvert_kubeadm_Discovery_To_v1beta4_Discovery(in, out, s) +} + +func autoConvert_v1beta4_Etcd_To_kubeadm_Etcd(in *Etcd, out *kubeadm.Etcd, s conversion.Scope) error { + out.Local = (*kubeadm.LocalEtcd)(unsafe.Pointer(in.Local)) + out.External = (*kubeadm.ExternalEtcd)(unsafe.Pointer(in.External)) + return nil +} + +// Convert_v1beta4_Etcd_To_kubeadm_Etcd is an autogenerated conversion function. +func Convert_v1beta4_Etcd_To_kubeadm_Etcd(in *Etcd, out *kubeadm.Etcd, s conversion.Scope) error { + return autoConvert_v1beta4_Etcd_To_kubeadm_Etcd(in, out, s) +} + +func autoConvert_kubeadm_Etcd_To_v1beta4_Etcd(in *kubeadm.Etcd, out *Etcd, s conversion.Scope) error { + out.Local = (*LocalEtcd)(unsafe.Pointer(in.Local)) + out.External = (*ExternalEtcd)(unsafe.Pointer(in.External)) + return nil +} + +// Convert_kubeadm_Etcd_To_v1beta4_Etcd is an autogenerated conversion function. +func Convert_kubeadm_Etcd_To_v1beta4_Etcd(in *kubeadm.Etcd, out *Etcd, s conversion.Scope) error { + return autoConvert_kubeadm_Etcd_To_v1beta4_Etcd(in, out, s) +} + +func autoConvert_v1beta4_ExternalEtcd_To_kubeadm_ExternalEtcd(in *ExternalEtcd, out *kubeadm.ExternalEtcd, s conversion.Scope) error { + out.Endpoints = *(*[]string)(unsafe.Pointer(&in.Endpoints)) + out.CAFile = in.CAFile + out.CertFile = in.CertFile + out.KeyFile = in.KeyFile + return nil +} + +// Convert_v1beta4_ExternalEtcd_To_kubeadm_ExternalEtcd is an autogenerated conversion function. +func Convert_v1beta4_ExternalEtcd_To_kubeadm_ExternalEtcd(in *ExternalEtcd, out *kubeadm.ExternalEtcd, s conversion.Scope) error { + return autoConvert_v1beta4_ExternalEtcd_To_kubeadm_ExternalEtcd(in, out, s) +} + +func autoConvert_kubeadm_ExternalEtcd_To_v1beta4_ExternalEtcd(in *kubeadm.ExternalEtcd, out *ExternalEtcd, s conversion.Scope) error { + out.Endpoints = *(*[]string)(unsafe.Pointer(&in.Endpoints)) + out.CAFile = in.CAFile + out.CertFile = in.CertFile + out.KeyFile = in.KeyFile + return nil +} + +// Convert_kubeadm_ExternalEtcd_To_v1beta4_ExternalEtcd is an autogenerated conversion function. +func Convert_kubeadm_ExternalEtcd_To_v1beta4_ExternalEtcd(in *kubeadm.ExternalEtcd, out *ExternalEtcd, s conversion.Scope) error { + return autoConvert_kubeadm_ExternalEtcd_To_v1beta4_ExternalEtcd(in, out, s) +} + +func autoConvert_v1beta4_FileDiscovery_To_kubeadm_FileDiscovery(in *FileDiscovery, out *kubeadm.FileDiscovery, s conversion.Scope) error { + out.KubeConfigPath = in.KubeConfigPath + return nil +} + +// Convert_v1beta4_FileDiscovery_To_kubeadm_FileDiscovery is an autogenerated conversion function. +func Convert_v1beta4_FileDiscovery_To_kubeadm_FileDiscovery(in *FileDiscovery, out *kubeadm.FileDiscovery, s conversion.Scope) error { + return autoConvert_v1beta4_FileDiscovery_To_kubeadm_FileDiscovery(in, out, s) +} + +func autoConvert_kubeadm_FileDiscovery_To_v1beta4_FileDiscovery(in *kubeadm.FileDiscovery, out *FileDiscovery, s conversion.Scope) error { + out.KubeConfigPath = in.KubeConfigPath + return nil +} + +// Convert_kubeadm_FileDiscovery_To_v1beta4_FileDiscovery is an autogenerated conversion function. +func Convert_kubeadm_FileDiscovery_To_v1beta4_FileDiscovery(in *kubeadm.FileDiscovery, out *FileDiscovery, s conversion.Scope) error { + return autoConvert_kubeadm_FileDiscovery_To_v1beta4_FileDiscovery(in, out, s) +} + +func autoConvert_v1beta4_HostPathMount_To_kubeadm_HostPathMount(in *HostPathMount, out *kubeadm.HostPathMount, s conversion.Scope) error { + out.Name = in.Name + out.HostPath = in.HostPath + out.MountPath = in.MountPath + out.ReadOnly = in.ReadOnly + out.PathType = corev1.HostPathType(in.PathType) + return nil +} + +// Convert_v1beta4_HostPathMount_To_kubeadm_HostPathMount is an autogenerated conversion function. +func Convert_v1beta4_HostPathMount_To_kubeadm_HostPathMount(in *HostPathMount, out *kubeadm.HostPathMount, s conversion.Scope) error { + return autoConvert_v1beta4_HostPathMount_To_kubeadm_HostPathMount(in, out, s) +} + +func autoConvert_kubeadm_HostPathMount_To_v1beta4_HostPathMount(in *kubeadm.HostPathMount, out *HostPathMount, s conversion.Scope) error { + out.Name = in.Name + out.HostPath = in.HostPath + out.MountPath = in.MountPath + out.ReadOnly = in.ReadOnly + out.PathType = corev1.HostPathType(in.PathType) + return nil +} + +// Convert_kubeadm_HostPathMount_To_v1beta4_HostPathMount is an autogenerated conversion function. +func Convert_kubeadm_HostPathMount_To_v1beta4_HostPathMount(in *kubeadm.HostPathMount, out *HostPathMount, s conversion.Scope) error { + return autoConvert_kubeadm_HostPathMount_To_v1beta4_HostPathMount(in, out, s) +} + +func autoConvert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(in *ImageMeta, out *kubeadm.ImageMeta, s conversion.Scope) error { + out.ImageRepository = in.ImageRepository + out.ImageTag = in.ImageTag + return nil +} + +// Convert_v1beta4_ImageMeta_To_kubeadm_ImageMeta is an autogenerated conversion function. +func Convert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(in *ImageMeta, out *kubeadm.ImageMeta, s conversion.Scope) error { + return autoConvert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(in, out, s) +} + +func autoConvert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(in *kubeadm.ImageMeta, out *ImageMeta, s conversion.Scope) error { + out.ImageRepository = in.ImageRepository + out.ImageTag = in.ImageTag + return nil +} + +// Convert_kubeadm_ImageMeta_To_v1beta4_ImageMeta is an autogenerated conversion function. +func Convert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(in *kubeadm.ImageMeta, out *ImageMeta, s conversion.Scope) error { + return autoConvert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(in, out, s) +} + +func autoConvert_v1beta4_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { + out.BootstrapTokens = *(*[]bootstraptokenv1.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) + if err := Convert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { + return err + } + if err := Convert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { + return err + } + out.CertificateKey = in.CertificateKey + out.SkipPhases = *(*[]string)(unsafe.Pointer(&in.SkipPhases)) + out.Patches = (*kubeadm.Patches)(unsafe.Pointer(in.Patches)) + return nil +} + +func autoConvert_kubeadm_InitConfiguration_To_v1beta4_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { + // WARNING: in.ClusterConfiguration requires manual conversion: does not exist in peer-type + out.BootstrapTokens = *(*[]bootstraptokenv1.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) + if err := Convert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { + return err + } + if err := Convert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { + return err + } + out.CertificateKey = in.CertificateKey + out.SkipPhases = *(*[]string)(unsafe.Pointer(&in.SkipPhases)) + out.Patches = (*Patches)(unsafe.Pointer(in.Patches)) + return nil +} + +func autoConvert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error { + if err := Convert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { + return err + } + out.CACertPath = in.CACertPath + if err := Convert_v1beta4_Discovery_To_kubeadm_Discovery(&in.Discovery, &out.Discovery, s); err != nil { + return err + } + out.ControlPlane = (*kubeadm.JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) + out.SkipPhases = *(*[]string)(unsafe.Pointer(&in.SkipPhases)) + out.Patches = (*kubeadm.Patches)(unsafe.Pointer(in.Patches)) + return nil +} + +// Convert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration is an autogenerated conversion function. +func Convert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error { + return autoConvert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration(in, out, s) +} + +func autoConvert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(in *kubeadm.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error { + if err := Convert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { + return err + } + out.CACertPath = in.CACertPath + if err := Convert_kubeadm_Discovery_To_v1beta4_Discovery(&in.Discovery, &out.Discovery, s); err != nil { + return err + } + out.ControlPlane = (*JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) + out.SkipPhases = *(*[]string)(unsafe.Pointer(&in.SkipPhases)) + out.Patches = (*Patches)(unsafe.Pointer(in.Patches)) + return nil +} + +// Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration is an autogenerated conversion function. +func Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(in *kubeadm.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error { + return autoConvert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(in, out, s) +} + +func autoConvert_v1beta4_JoinControlPlane_To_kubeadm_JoinControlPlane(in *JoinControlPlane, out *kubeadm.JoinControlPlane, s conversion.Scope) error { + if err := Convert_v1beta4_APIEndpoint_To_kubeadm_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { + return err + } + out.CertificateKey = in.CertificateKey + return nil +} + +// Convert_v1beta4_JoinControlPlane_To_kubeadm_JoinControlPlane is an autogenerated conversion function. +func Convert_v1beta4_JoinControlPlane_To_kubeadm_JoinControlPlane(in *JoinControlPlane, out *kubeadm.JoinControlPlane, s conversion.Scope) error { + return autoConvert_v1beta4_JoinControlPlane_To_kubeadm_JoinControlPlane(in, out, s) +} + +func autoConvert_kubeadm_JoinControlPlane_To_v1beta4_JoinControlPlane(in *kubeadm.JoinControlPlane, out *JoinControlPlane, s conversion.Scope) error { + if err := Convert_kubeadm_APIEndpoint_To_v1beta4_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { + return err + } + out.CertificateKey = in.CertificateKey + return nil +} + +// Convert_kubeadm_JoinControlPlane_To_v1beta4_JoinControlPlane is an autogenerated conversion function. +func Convert_kubeadm_JoinControlPlane_To_v1beta4_JoinControlPlane(in *kubeadm.JoinControlPlane, out *JoinControlPlane, s conversion.Scope) error { + return autoConvert_kubeadm_JoinControlPlane_To_v1beta4_JoinControlPlane(in, out, s) +} + +func autoConvert_v1beta4_LocalEtcd_To_kubeadm_LocalEtcd(in *LocalEtcd, out *kubeadm.LocalEtcd, s conversion.Scope) error { + if err := Convert_v1beta4_ImageMeta_To_kubeadm_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { + return err + } + out.DataDir = in.DataDir + out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) + out.ServerCertSANs = *(*[]string)(unsafe.Pointer(&in.ServerCertSANs)) + out.PeerCertSANs = *(*[]string)(unsafe.Pointer(&in.PeerCertSANs)) + return nil +} + +// Convert_v1beta4_LocalEtcd_To_kubeadm_LocalEtcd is an autogenerated conversion function. +func Convert_v1beta4_LocalEtcd_To_kubeadm_LocalEtcd(in *LocalEtcd, out *kubeadm.LocalEtcd, s conversion.Scope) error { + return autoConvert_v1beta4_LocalEtcd_To_kubeadm_LocalEtcd(in, out, s) +} + +func autoConvert_kubeadm_LocalEtcd_To_v1beta4_LocalEtcd(in *kubeadm.LocalEtcd, out *LocalEtcd, s conversion.Scope) error { + if err := Convert_kubeadm_ImageMeta_To_v1beta4_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { + return err + } + out.DataDir = in.DataDir + out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) + out.ServerCertSANs = *(*[]string)(unsafe.Pointer(&in.ServerCertSANs)) + out.PeerCertSANs = *(*[]string)(unsafe.Pointer(&in.PeerCertSANs)) + return nil +} + +// Convert_kubeadm_LocalEtcd_To_v1beta4_LocalEtcd is an autogenerated conversion function. +func Convert_kubeadm_LocalEtcd_To_v1beta4_LocalEtcd(in *kubeadm.LocalEtcd, out *LocalEtcd, s conversion.Scope) error { + return autoConvert_kubeadm_LocalEtcd_To_v1beta4_LocalEtcd(in, out, s) +} + +func autoConvert_v1beta4_Networking_To_kubeadm_Networking(in *Networking, out *kubeadm.Networking, s conversion.Scope) error { + out.ServiceSubnet = in.ServiceSubnet + out.PodSubnet = in.PodSubnet + out.DNSDomain = in.DNSDomain + return nil +} + +// Convert_v1beta4_Networking_To_kubeadm_Networking is an autogenerated conversion function. +func Convert_v1beta4_Networking_To_kubeadm_Networking(in *Networking, out *kubeadm.Networking, s conversion.Scope) error { + return autoConvert_v1beta4_Networking_To_kubeadm_Networking(in, out, s) +} + +func autoConvert_kubeadm_Networking_To_v1beta4_Networking(in *kubeadm.Networking, out *Networking, s conversion.Scope) error { + out.ServiceSubnet = in.ServiceSubnet + out.PodSubnet = in.PodSubnet + out.DNSDomain = in.DNSDomain + return nil +} + +// Convert_kubeadm_Networking_To_v1beta4_Networking is an autogenerated conversion function. +func Convert_kubeadm_Networking_To_v1beta4_Networking(in *kubeadm.Networking, out *Networking, s conversion.Scope) error { + return autoConvert_kubeadm_Networking_To_v1beta4_Networking(in, out, s) +} + +func autoConvert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in *NodeRegistrationOptions, out *kubeadm.NodeRegistrationOptions, s conversion.Scope) error { + out.Name = in.Name + out.CRISocket = in.CRISocket + out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) + out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) + out.IgnorePreflightErrors = *(*[]string)(unsafe.Pointer(&in.IgnorePreflightErrors)) + out.ImagePullPolicy = corev1.PullPolicy(in.ImagePullPolicy) + return nil +} + +// Convert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions is an autogenerated conversion function. +func Convert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in *NodeRegistrationOptions, out *kubeadm.NodeRegistrationOptions, s conversion.Scope) error { + return autoConvert_v1beta4_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in, out, s) +} + +func autoConvert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(in *kubeadm.NodeRegistrationOptions, out *NodeRegistrationOptions, s conversion.Scope) error { + out.Name = in.Name + out.CRISocket = in.CRISocket + out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) + out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) + out.IgnorePreflightErrors = *(*[]string)(unsafe.Pointer(&in.IgnorePreflightErrors)) + out.ImagePullPolicy = corev1.PullPolicy(in.ImagePullPolicy) + return nil +} + +// Convert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions is an autogenerated conversion function. +func Convert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(in *kubeadm.NodeRegistrationOptions, out *NodeRegistrationOptions, s conversion.Scope) error { + return autoConvert_kubeadm_NodeRegistrationOptions_To_v1beta4_NodeRegistrationOptions(in, out, s) +} + +func autoConvert_v1beta4_Patches_To_kubeadm_Patches(in *Patches, out *kubeadm.Patches, s conversion.Scope) error { + out.Directory = in.Directory + return nil +} + +// Convert_v1beta4_Patches_To_kubeadm_Patches is an autogenerated conversion function. +func Convert_v1beta4_Patches_To_kubeadm_Patches(in *Patches, out *kubeadm.Patches, s conversion.Scope) error { + return autoConvert_v1beta4_Patches_To_kubeadm_Patches(in, out, s) +} + +func autoConvert_kubeadm_Patches_To_v1beta4_Patches(in *kubeadm.Patches, out *Patches, s conversion.Scope) error { + out.Directory = in.Directory + return nil +} + +// Convert_kubeadm_Patches_To_v1beta4_Patches is an autogenerated conversion function. +func Convert_kubeadm_Patches_To_v1beta4_Patches(in *kubeadm.Patches, out *Patches, s conversion.Scope) error { + return autoConvert_kubeadm_Patches_To_v1beta4_Patches(in, out, s) +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.deepcopy.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.deepcopy.go new file mode 100644 index 00000000000..af9f47743a6 --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.deepcopy.go @@ -0,0 +1,506 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1beta4 + +import ( + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIEndpoint) DeepCopyInto(out *APIEndpoint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIEndpoint. +func (in *APIEndpoint) DeepCopy() *APIEndpoint { + if in == nil { + return nil + } + out := new(APIEndpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServer) DeepCopyInto(out *APIServer) { + *out = *in + in.ControlPlaneComponent.DeepCopyInto(&out.ControlPlaneComponent) + if in.CertSANs != nil { + in, out := &in.CertSANs, &out.CertSANs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.TimeoutForControlPlane != nil { + in, out := &in.TimeoutForControlPlane, &out.TimeoutForControlPlane + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServer. +func (in *APIServer) DeepCopy() *APIServer { + if in == nil { + return nil + } + out := new(APIServer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BootstrapTokenDiscovery) DeepCopyInto(out *BootstrapTokenDiscovery) { + *out = *in + if in.CACertHashes != nil { + in, out := &in.CACertHashes, &out.CACertHashes + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapTokenDiscovery. +func (in *BootstrapTokenDiscovery) DeepCopy() *BootstrapTokenDiscovery { + if in == nil { + return nil + } + out := new(BootstrapTokenDiscovery) + 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 + out.TypeMeta = in.TypeMeta + in.Etcd.DeepCopyInto(&out.Etcd) + out.Networking = in.Networking + in.APIServer.DeepCopyInto(&out.APIServer) + in.ControllerManager.DeepCopyInto(&out.ControllerManager) + in.Scheduler.DeepCopyInto(&out.Scheduler) + out.DNS = in.DNS + if in.FeatureGates != nil { + in, out := &in.FeatureGates, &out.FeatureGates + *out = make(map[string]bool, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConfiguration. +func (in *ClusterConfiguration) DeepCopy() *ClusterConfiguration { + if in == nil { + return nil + } + out := new(ClusterConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneComponent) DeepCopyInto(out *ControlPlaneComponent) { + *out = *in + if in.ExtraArgs != nil { + in, out := &in.ExtraArgs, &out.ExtraArgs + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ExtraVolumes != nil { + in, out := &in.ExtraVolumes, &out.ExtraVolumes + *out = make([]HostPathMount, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneComponent. +func (in *ControlPlaneComponent) DeepCopy() *ControlPlaneComponent { + if in == nil { + return nil + } + out := new(ControlPlaneComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DNS) DeepCopyInto(out *DNS) { + *out = *in + out.ImageMeta = in.ImageMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNS. +func (in *DNS) DeepCopy() *DNS { + if in == nil { + return nil + } + out := new(DNS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Discovery) DeepCopyInto(out *Discovery) { + *out = *in + if in.BootstrapToken != nil { + in, out := &in.BootstrapToken, &out.BootstrapToken + *out = new(BootstrapTokenDiscovery) + (*in).DeepCopyInto(*out) + } + if in.File != nil { + in, out := &in.File, &out.File + *out = new(FileDiscovery) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Discovery. +func (in *Discovery) DeepCopy() *Discovery { + if in == nil { + return nil + } + out := new(Discovery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Etcd) DeepCopyInto(out *Etcd) { + *out = *in + if in.Local != nil { + in, out := &in.Local, &out.Local + *out = new(LocalEtcd) + (*in).DeepCopyInto(*out) + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(ExternalEtcd) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Etcd. +func (in *Etcd) DeepCopy() *Etcd { + if in == nil { + return nil + } + out := new(Etcd) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExternalEtcd) DeepCopyInto(out *ExternalEtcd) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalEtcd. +func (in *ExternalEtcd) DeepCopy() *ExternalEtcd { + if in == nil { + return nil + } + out := new(ExternalEtcd) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileDiscovery. +func (in *FileDiscovery) DeepCopy() *FileDiscovery { + if in == nil { + return nil + } + out := new(FileDiscovery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HostPathMount) DeepCopyInto(out *HostPathMount) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPathMount. +func (in *HostPathMount) DeepCopy() *HostPathMount { + if in == nil { + return nil + } + out := new(HostPathMount) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageMeta) DeepCopyInto(out *ImageMeta) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageMeta. +func (in *ImageMeta) DeepCopy() *ImageMeta { + if in == nil { + return nil + } + out := new(ImageMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.BootstrapTokens != nil { + in, out := &in.BootstrapTokens, &out.BootstrapTokens + *out = make([]bootstraptokenv1.BootstrapToken, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.NodeRegistration.DeepCopyInto(&out.NodeRegistration) + out.LocalAPIEndpoint = in.LocalAPIEndpoint + if in.SkipPhases != nil { + in, out := &in.SkipPhases, &out.SkipPhases + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Patches != nil { + in, out := &in.Patches, &out.Patches + *out = new(Patches) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitConfiguration. +func (in *InitConfiguration) DeepCopy() *InitConfiguration { + if in == nil { + return nil + } + out := new(InitConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InitConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JoinConfiguration) DeepCopyInto(out *JoinConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.NodeRegistration.DeepCopyInto(&out.NodeRegistration) + in.Discovery.DeepCopyInto(&out.Discovery) + if in.ControlPlane != nil { + in, out := &in.ControlPlane, &out.ControlPlane + *out = new(JoinControlPlane) + **out = **in + } + if in.SkipPhases != nil { + in, out := &in.SkipPhases, &out.SkipPhases + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Patches != nil { + in, out := &in.Patches, &out.Patches + *out = new(Patches) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JoinConfiguration. +func (in *JoinConfiguration) DeepCopy() *JoinConfiguration { + if in == nil { + return nil + } + out := new(JoinConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *JoinConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JoinControlPlane) DeepCopyInto(out *JoinControlPlane) { + *out = *in + out.LocalAPIEndpoint = in.LocalAPIEndpoint + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JoinControlPlane. +func (in *JoinControlPlane) DeepCopy() *JoinControlPlane { + if in == nil { + return nil + } + out := new(JoinControlPlane) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalEtcd) DeepCopyInto(out *LocalEtcd) { + *out = *in + out.ImageMeta = in.ImageMeta + if in.ExtraArgs != nil { + in, out := &in.ExtraArgs, &out.ExtraArgs + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ServerCertSANs != nil { + in, out := &in.ServerCertSANs, &out.ServerCertSANs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PeerCertSANs != nil { + in, out := &in.PeerCertSANs, &out.PeerCertSANs + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalEtcd. +func (in *LocalEtcd) DeepCopy() *LocalEtcd { + if in == nil { + return nil + } + out := new(LocalEtcd) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Networking) DeepCopyInto(out *Networking) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Networking. +func (in *Networking) DeepCopy() *Networking { + if in == nil { + return nil + } + out := new(Networking) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeRegistrationOptions) DeepCopyInto(out *NodeRegistrationOptions) { + *out = *in + if in.Taints != nil { + in, out := &in.Taints, &out.Taints + *out = make([]corev1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.KubeletExtraArgs != nil { + in, out := &in.KubeletExtraArgs, &out.KubeletExtraArgs + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.IgnorePreflightErrors != nil { + in, out := &in.IgnorePreflightErrors, &out.IgnorePreflightErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeRegistrationOptions. +func (in *NodeRegistrationOptions) DeepCopy() *NodeRegistrationOptions { + if in == nil { + return nil + } + out := new(NodeRegistrationOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Patches) DeepCopyInto(out *Patches) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Patches. +func (in *Patches) DeepCopy() *Patches { + if in == nil { + return nil + } + out := new(Patches) + in.DeepCopyInto(out) + return out +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go new file mode 100644 index 00000000000..dfa01af863b --- /dev/null +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go @@ -0,0 +1,62 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1beta4 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&ClusterConfiguration{}, func(obj interface{}) { SetObjectDefaults_ClusterConfiguration(obj.(*ClusterConfiguration)) }) + scheme.AddTypeDefaultingFunc(&InitConfiguration{}, func(obj interface{}) { SetObjectDefaults_InitConfiguration(obj.(*InitConfiguration)) }) + scheme.AddTypeDefaultingFunc(&JoinConfiguration{}, func(obj interface{}) { SetObjectDefaults_JoinConfiguration(obj.(*JoinConfiguration)) }) + return nil +} + +func SetObjectDefaults_ClusterConfiguration(in *ClusterConfiguration) { + SetDefaults_ClusterConfiguration(in) + SetDefaults_APIServer(&in.APIServer) +} + +func SetObjectDefaults_InitConfiguration(in *InitConfiguration) { + SetDefaults_InitConfiguration(in) + for i := range in.BootstrapTokens { + a := &in.BootstrapTokens[i] + SetDefaults_BootstrapToken(a) + } + SetDefaults_APIEndpoint(&in.LocalAPIEndpoint) +} + +func SetObjectDefaults_JoinConfiguration(in *JoinConfiguration) { + SetDefaults_JoinConfiguration(in) + SetDefaults_Discovery(&in.Discovery) + if in.Discovery.File != nil { + SetDefaults_FileDiscovery(in.Discovery.File) + } + if in.ControlPlane != nil { + SetDefaults_JoinControlPlane(in.ControlPlane) + SetDefaults_APIEndpoint(&in.ControlPlane.LocalAPIEndpoint) + } +} From edb59e9bc753458762014590eec7a15292183003 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 21 Jun 2023 13:33:26 +0300 Subject: [PATCH 2/2] kubeadm: move token defaulting and related constants to token package Move the defaulting of the BootstrapToken type inside the bootstraptoken/v1 package. This prevents an error where codegen complains that a defaulter for the type exists in both the kubeadm v1beta3 and v1beta4. Adapt kubeadm code to use the defaulter function and constants that were moved to bootstraptoken/v1. NOTE: technically this is a breaking change for direct users of v1beta3/SetDefaults_BootstrapToken(). --- .../app/apis/bootstraptoken/v1/defaults.go | 54 +++++++++++++++++++ .../app/apis/kubeadm/v1beta3/defaults.go | 18 +------ .../kubeadm/v1beta3/zz_generated.defaults.go | 4 -- .../app/apis/kubeadm/v1beta4/defaults.go | 18 +------ .../kubeadm/v1beta4/zz_generated.defaults.go | 4 -- cmd/kubeadm/app/cmd/init_test.go | 8 +-- cmd/kubeadm/app/cmd/options/token.go | 5 +- cmd/kubeadm/app/constants/constants.go | 11 ---- 8 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 cmd/kubeadm/app/apis/bootstraptoken/v1/defaults.go diff --git a/cmd/kubeadm/app/apis/bootstraptoken/v1/defaults.go b/cmd/kubeadm/app/apis/bootstraptoken/v1/defaults.go new file mode 100644 index 00000000000..1d98d3b0608 --- /dev/null +++ b/cmd/kubeadm/app/apis/bootstraptoken/v1/defaults.go @@ -0,0 +1,54 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + bootstrapapi "k8s.io/cluster-bootstrap/token/api" +) + +const ( + // DefaultTokenDuration specifies the default amount of time that a bootstrap token will be valid + // Default behaviour is 24 hours + DefaultTokenDuration = 24 * time.Hour +) + +var ( + // DefaultTokenUsages specifies the default functions a token will get + DefaultTokenUsages = bootstrapapi.KnownTokenUsages + + // DefaultTokenGroups specifies the default groups that this token will authenticate as when used for authentication + DefaultTokenGroups = []string{"system:bootstrappers:kubeadm:default-node-token"} +) + +// SetDefaults_BootstrapToken sets the defaults for an individual Bootstrap Token +func SetDefaults_BootstrapToken(bt *BootstrapToken) { + if bt.TTL == nil { + bt.TTL = &metav1.Duration{ + Duration: DefaultTokenDuration, + } + } + if len(bt.Usages) == 0 { + bt.Usages = DefaultTokenUsages + } + + if len(bt.Groups) == 0 { + bt.Groups = DefaultTokenGroups + } +} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta3/defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta3/defaults.go index 7fdaa274b4e..d007ad0b36e 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta3/defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta3/defaults.go @@ -181,23 +181,7 @@ func SetDefaults_BootstrapTokens(obj *InitConfiguration) { } for i := range obj.BootstrapTokens { - SetDefaults_BootstrapToken(&obj.BootstrapTokens[i]) - } -} - -// SetDefaults_BootstrapToken sets the defaults for an individual Bootstrap Token -func SetDefaults_BootstrapToken(bt *bootstraptokenv1.BootstrapToken) { - if bt.TTL == nil { - bt.TTL = &metav1.Duration{ - Duration: constants.DefaultTokenDuration, - } - } - if len(bt.Usages) == 0 { - bt.Usages = constants.DefaultTokenUsages - } - - if len(bt.Groups) == 0 { - bt.Groups = constants.DefaultTokenGroups + bootstraptokenv1.SetDefaults_BootstrapToken(&obj.BootstrapTokens[i]) } } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta3/zz_generated.defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta3/zz_generated.defaults.go index b3fa54fbe26..c9c1b487e83 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta3/zz_generated.defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta3/zz_generated.defaults.go @@ -42,10 +42,6 @@ func SetObjectDefaults_ClusterConfiguration(in *ClusterConfiguration) { func SetObjectDefaults_InitConfiguration(in *InitConfiguration) { SetDefaults_InitConfiguration(in) - for i := range in.BootstrapTokens { - a := &in.BootstrapTokens[i] - SetDefaults_BootstrapToken(a) - } SetDefaults_APIEndpoint(&in.LocalAPIEndpoint) } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go index a599cf154a9..f303b386719 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/defaults.go @@ -181,23 +181,7 @@ func SetDefaults_BootstrapTokens(obj *InitConfiguration) { } for i := range obj.BootstrapTokens { - SetDefaults_BootstrapToken(&obj.BootstrapTokens[i]) - } -} - -// SetDefaults_BootstrapToken sets the defaults for an individual Bootstrap Token -func SetDefaults_BootstrapToken(bt *bootstraptokenv1.BootstrapToken) { - if bt.TTL == nil { - bt.TTL = &metav1.Duration{ - Duration: constants.DefaultTokenDuration, - } - } - if len(bt.Usages) == 0 { - bt.Usages = constants.DefaultTokenUsages - } - - if len(bt.Groups) == 0 { - bt.Groups = constants.DefaultTokenGroups + bootstraptokenv1.SetDefaults_BootstrapToken(&obj.BootstrapTokens[i]) } } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go index dfa01af863b..c898c74a884 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta4/zz_generated.defaults.go @@ -42,10 +42,6 @@ func SetObjectDefaults_ClusterConfiguration(in *ClusterConfiguration) { func SetObjectDefaults_InitConfiguration(in *InitConfiguration) { SetDefaults_InitConfiguration(in) - for i := range in.BootstrapTokens { - a := &in.BootstrapTokens[i] - SetDefaults_BootstrapToken(a) - } SetDefaults_APIEndpoint(&in.LocalAPIEndpoint) } diff --git a/cmd/kubeadm/app/cmd/init_test.go b/cmd/kubeadm/app/cmd/init_test.go index 91846d92faa..ef380388af2 100644 --- a/cmd/kubeadm/app/cmd/init_test.go +++ b/cmd/kubeadm/app/cmd/init_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" - v1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" + bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" "k8s.io/kubernetes/cmd/kubeadm/app/cmd/options" @@ -121,12 +121,12 @@ func TestNewInitData(t *testing.T) { AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, - BootstrapTokens: []v1.BootstrapToken{ + BootstrapTokens: []bootstraptokenv1.BootstrapToken{ { - Token: &v1.BootstrapTokenString{ID: "abcdef", Secret: "0123456789abcdef"}, + Token: &bootstraptokenv1.BootstrapTokenString{ID: "abcdef", Secret: "0123456789abcdef"}, Usages: []string{"signing", "authentication"}, TTL: &metav1.Duration{ - Duration: constants.DefaultTokenDuration, + Duration: bootstraptokenv1.DefaultTokenDuration, }, Groups: []string{"system:bootstrappers:kubeadm:default-node-token"}, }, diff --git a/cmd/kubeadm/app/cmd/options/token.go b/cmd/kubeadm/app/cmd/options/token.go index 19e24ab6615..4b01c130f62 100644 --- a/cmd/kubeadm/app/cmd/options/token.go +++ b/cmd/kubeadm/app/cmd/options/token.go @@ -26,13 +26,12 @@ import ( bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" - kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" ) // NewBootstrapTokenOptions creates a new BootstrapTokenOptions object with the default values func NewBootstrapTokenOptions() *BootstrapTokenOptions { bto := &BootstrapTokenOptions{&bootstraptokenv1.BootstrapToken{}, ""} - kubeadmapiv1.SetDefaults_BootstrapToken(bto.BootstrapToken) + bootstraptokenv1.SetDefaults_BootstrapToken(bto.BootstrapToken) return bto } @@ -69,7 +68,7 @@ func (bto *BootstrapTokenOptions) AddTTLFlagWithName(fs *pflag.FlagSet, flagName func (bto *BootstrapTokenOptions) AddUsagesFlag(fs *pflag.FlagSet) { fs.StringSliceVar( &bto.Usages, TokenUsages, bto.Usages, - fmt.Sprintf("Describes the ways in which this token can be used. You can pass --usages multiple times or provide a comma separated list of options. Valid options: [%s]", strings.Join(kubeadmconstants.DefaultTokenUsages, ",")), + fmt.Sprintf("Describes the ways in which this token can be used. You can pass --usages multiple times or provide a comma separated list of options. Valid options: [%s]", strings.Join(bootstraptokenv1.DefaultTokenUsages, ",")), ) } diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index ecf81aa55c6..62f08a61c3a 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -31,7 +31,6 @@ import ( "k8s.io/apimachinery/pkg/util/version" "k8s.io/apimachinery/pkg/util/wait" apimachineryversion "k8s.io/apimachinery/pkg/version" - bootstrapapi "k8s.io/cluster-bootstrap/token/api" componentversion "k8s.io/component-base/version" netutils "k8s.io/utils/net" ) @@ -243,10 +242,6 @@ const ( // The node subnet mask size must be no more than the pod subnet mask size + 16 PodSubnetNodeMaskMaxDiff = 16 - // DefaultTokenDuration specifies the default amount of time that a bootstrap token will be valid - // Default behaviour is 24 hours - DefaultTokenDuration = 24 * time.Hour - // DefaultCertTokenDuration specifies the default amount of time that the token used by upload certs will be valid // Default behaviour is 2 hours DefaultCertTokenDuration = 2 * time.Hour @@ -447,12 +442,6 @@ var ( Effect: v1.TaintEffectNoSchedule, } - // DefaultTokenUsages specifies the default functions a token will get - DefaultTokenUsages = bootstrapapi.KnownTokenUsages - - // DefaultTokenGroups specifies the default groups that this token will authenticate as when used for authentication - DefaultTokenGroups = []string{NodeBootstrapTokenAuthGroup} - // ControlPlaneComponents defines the control-plane component names ControlPlaneComponents = []string{KubeAPIServer, KubeControllerManager, KubeScheduler}