diff --git a/cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go b/cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go index 5a0b1c5b9e5..344ffaffb6f 100644 --- a/cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go +++ b/cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go @@ -36,7 +36,7 @@ import ( // Funcs returns the fuzzer functions for the kubeadm apis. func Funcs(codecs runtimeserializer.CodecFactory) []interface{} { return []interface{}{ - func(obj *kubeadm.MasterConfiguration, c fuzz.Continue) { + func(obj *kubeadm.InitConfiguration, c fuzz.Continue) { c.FuzzNoCustom(obj) obj.KubernetesVersion = "v10" obj.API.BindPort = 20 diff --git a/cmd/kubeadm/app/apis/kubeadm/register.go b/cmd/kubeadm/app/apis/kubeadm/register.go index 72cdf410b9a..93d0280a360 100644 --- a/cmd/kubeadm/app/apis/kubeadm/register.go +++ b/cmd/kubeadm/app/apis/kubeadm/register.go @@ -46,7 +46,7 @@ func Resource(resource string) schema.GroupResource { func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &MasterConfiguration{}, + &InitConfiguration{}, &NodeConfiguration{}, ) return nil diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go index 3eaa5a6c955..971857323ec 100644 --- a/cmd/kubeadm/app/apis/kubeadm/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/types.go @@ -27,9 +27,9 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// MasterConfiguration contains a list of elements which make up master's +// InitConfiguration contains a list of elements which make up master's // configuration object. -type MasterConfiguration struct { +type InitConfiguration struct { metav1.TypeMeta // `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs. @@ -309,7 +309,7 @@ type NodeConfiguration struct { // It will override location with CI registry name in case user requests special // Kubernetes version from CI build area. // (See: kubeadmconstants.DefaultCIImageRepository) -func (cfg *MasterConfiguration) GetControlPlaneImageRepository() string { +func (cfg *InitConfiguration) GetControlPlaneImageRepository() string { if cfg.CIImageRepository != "" { return cfg.CIImageRepository } @@ -344,7 +344,7 @@ type AuditPolicyConfiguration struct { } // CommonConfiguration defines the list of common configuration elements and the getter -// methods that must exist for both the MasterConfiguration and NodeConfiguration objects. +// methods that must exist for both the InitConfiguration and NodeConfiguration objects. // This is used internally to deduplicate the kubeadm preflight checks. type CommonConfiguration interface { GetCRISocket() string @@ -352,21 +352,21 @@ type CommonConfiguration interface { GetKubernetesVersion() string } -// GetCRISocket will return the CRISocket that is defined for the MasterConfiguration. +// GetCRISocket will return the CRISocket that is defined for the InitConfiguration. // This is used internally to deduplicate the kubeadm preflight checks. -func (cfg *MasterConfiguration) GetCRISocket() string { +func (cfg *InitConfiguration) GetCRISocket() string { return cfg.NodeRegistration.CRISocket } -// GetNodeName will return the NodeName that is defined for the MasterConfiguration. +// GetNodeName will return the NodeName that is defined for the InitConfiguration. // This is used internally to deduplicate the kubeadm preflight checks. -func (cfg *MasterConfiguration) GetNodeName() string { +func (cfg *InitConfiguration) GetNodeName() string { return cfg.NodeRegistration.Name } -// GetKubernetesVersion will return the KubernetesVersion that is defined for the MasterConfiguration. +// GetKubernetesVersion will return the KubernetesVersion that is defined for the InitConfiguration. // This is used internally to deduplicate the kubeadm preflight checks. -func (cfg *MasterConfiguration) GetKubernetesVersion() string { +func (cfg *InitConfiguration) GetKubernetesVersion() string { return cfg.KubernetesVersion } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/conversion.go index a406319a508..ccf5bc33665 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/conversion.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/conversion.go @@ -26,8 +26,8 @@ import ( kubeproxyconfigv1alpha1 "k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig/v1alpha1" ) -func Convert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in *MasterConfiguration, out *kubeadm.MasterConfiguration, s conversion.Scope) error { - if err := autoConvert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in, out, s); err != nil { +func Convert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { + if err := autoConvert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s); err != nil { return err } @@ -53,8 +53,8 @@ func Convert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas return nil } -func Convert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in *kubeadm.MasterConfiguration, out *MasterConfiguration, s conversion.Scope) error { - if err := autoConvert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in, out, s); err != nil { +func Convert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { + if err := autoConvert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration(in, out, s); err != nil { return err } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go index f513ee29a9e..c8a6101d5f1 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go @@ -75,8 +75,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error { return RegisterDefaults(scheme) } -// SetDefaults_MasterConfiguration assigns default values to Master node -func SetDefaults_MasterConfiguration(obj *MasterConfiguration) { +// SetDefaults_InitConfiguration assigns default values to Master node +func SetDefaults_InitConfiguration(obj *InitConfiguration) { if obj.KubernetesVersion == "" { obj.KubernetesVersion = DefaultKubernetesVersion } @@ -114,7 +114,7 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) { } // SetDefaults_Etcd assigns default values for the Proxy -func SetDefaults_Etcd(obj *MasterConfiguration) { +func SetDefaults_Etcd(obj *InitConfiguration) { if obj.Etcd.External == nil && obj.Etcd.Local == nil { obj.Etcd.Local = &LocalEtcd{} } @@ -126,7 +126,7 @@ func SetDefaults_Etcd(obj *MasterConfiguration) { } // SetDefaults_ProxyConfiguration assigns default values for the Proxy -func SetDefaults_ProxyConfiguration(obj *MasterConfiguration) { +func SetDefaults_ProxyConfiguration(obj *InitConfiguration) { // IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/componentconfig/defaults.go // and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go. if obj.KubeProxy.Config == nil { @@ -174,7 +174,7 @@ func SetDefaults_NodeConfiguration(obj *NodeConfiguration) { } // SetDefaults_KubeletConfiguration assigns default values to kubelet -func SetDefaults_KubeletConfiguration(obj *MasterConfiguration) { +func SetDefaults_KubeletConfiguration(obj *InitConfiguration) { // IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/componentconfig/defaults.go // and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go. if obj.KubeletConfiguration.BaseConfig == nil { @@ -231,7 +231,7 @@ func SetDefaults_NodeRegistrationOptions(obj *NodeRegistrationOptions) { } // SetDefaults_AuditPolicyConfiguration sets default values for the AuditPolicyConfiguration -func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) { +func SetDefaults_AuditPolicyConfiguration(obj *InitConfiguration) { if obj.AuditPolicyConfiguration.LogDir == "" { obj.AuditPolicyConfiguration.LogDir = constants.StaticPodAuditPolicyLogDir } @@ -245,7 +245,7 @@ func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) { // 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 *MasterConfiguration) { +func SetDefaults_BootstrapTokens(obj *InitConfiguration) { if obj.BootstrapTokens == nil || len(obj.BootstrapTokens) == 0 { obj.BootstrapTokens = []BootstrapToken{{}} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/register.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/register.go index a5e15f9e83f..f80e17bd67a 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/register.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/register.go @@ -58,7 +58,7 @@ func Resource(resource string) schema.GroupResource { func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &MasterConfiguration{}, + &InitConfiguration{}, &NodeConfiguration{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go index 7af1f79bea3..2b2f6d62384 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go @@ -25,9 +25,9 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// MasterConfiguration contains a list of elements which make up master's +// InitConfiguration contains a list of elements which make up master's // configuration object. -type MasterConfiguration struct { +type InitConfiguration struct { metav1.TypeMeta `json:",inline"` // `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs. diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.conversion.go index 34e3f4fd9d6..58fe4aa11a4 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.conversion.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.conversion.go @@ -54,8 +54,8 @@ func RegisterConversions(scheme *runtime.Scheme) error { Convert_kubeadm_HostPathMount_To_v1alpha2_HostPathMount, Convert_v1alpha2_LocalEtcd_To_kubeadm_LocalEtcd, Convert_kubeadm_LocalEtcd_To_v1alpha2_LocalEtcd, - Convert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration, - Convert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration, + Convert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration, + Convert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration, Convert_v1alpha2_Networking_To_kubeadm_Networking, Convert_kubeadm_Networking_To_v1alpha2_Networking, Convert_v1alpha2_NodeConfiguration_To_kubeadm_NodeConfiguration, @@ -269,7 +269,7 @@ func Convert_kubeadm_LocalEtcd_To_v1alpha2_LocalEtcd(in *kubeadm.LocalEtcd, out return autoConvert_kubeadm_LocalEtcd_To_v1alpha2_LocalEtcd(in, out, s) } -func autoConvert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in *MasterConfiguration, out *kubeadm.MasterConfiguration, s conversion.Scope) error { +func autoConvert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { out.BootstrapTokens = *(*[]kubeadm.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) if err := Convert_v1alpha2_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { return err @@ -304,7 +304,7 @@ func autoConvert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in return nil } -func autoConvert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in *kubeadm.MasterConfiguration, out *MasterConfiguration, s conversion.Scope) error { +func autoConvert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { out.BootstrapTokens = *(*[]BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) if err := Convert_kubeadm_NodeRegistrationOptions_To_v1alpha2_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { return err diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.deepcopy.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.deepcopy.go index 710630867e5..e37b6bc911a 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.deepcopy.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.deepcopy.go @@ -260,7 +260,7 @@ func (in *LocalEtcd) DeepCopy() *LocalEtcd { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { +func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) { *out = *in out.TypeMeta = in.TypeMeta if in.BootstrapTokens != nil { @@ -328,18 +328,18 @@ func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterConfiguration. -func (in *MasterConfiguration) DeepCopy() *MasterConfiguration { +// 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(MasterConfiguration) + out := new(InitConfiguration) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MasterConfiguration) DeepCopyObject() runtime.Object { +func (in *InitConfiguration) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.defaults.go index 940e5621f8c..e5bdc810d80 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.defaults.go @@ -30,13 +30,13 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&MasterConfiguration{}, func(obj interface{}) { SetObjectDefaults_MasterConfiguration(obj.(*MasterConfiguration)) }) + scheme.AddTypeDefaultingFunc(&InitConfiguration{}, func(obj interface{}) { SetObjectDefaults_InitConfiguration(obj.(*InitConfiguration)) }) scheme.AddTypeDefaultingFunc(&NodeConfiguration{}, func(obj interface{}) { SetObjectDefaults_NodeConfiguration(obj.(*NodeConfiguration)) }) return nil } -func SetObjectDefaults_MasterConfiguration(in *MasterConfiguration) { - SetDefaults_MasterConfiguration(in) +func SetObjectDefaults_InitConfiguration(in *InitConfiguration) { + SetDefaults_InitConfiguration(in) for i := range in.BootstrapTokens { a := &in.BootstrapTokens[i] SetDefaults_BootstrapToken(a) diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go index 1ebe2966908..ad7d74f3603 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go @@ -28,8 +28,8 @@ import ( kubeproxyconfigv1alpha1 "k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig/v1alpha1" ) -func Convert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration(in *MasterConfiguration, out *kubeadm.MasterConfiguration, s conversion.Scope) error { - if err := autoConvert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration(in, out, s); err != nil { +func Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { + if err := autoConvert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s); err != nil { return err } @@ -60,7 +60,7 @@ func Convert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas return nil } -func defaultKubeProxyConfiguration(internalcfg *MasterConfiguration, obj *kubeproxyconfig.KubeProxyConfiguration) { +func defaultKubeProxyConfiguration(internalcfg *InitConfiguration, obj *kubeproxyconfig.KubeProxyConfiguration) { // NOTE: This code should be mirrored from cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go and cmd/kubeadm/app/componentconfig/defaults.go if obj.ClusterCIDR == "" && internalcfg.Networking.PodSubnet != "" { obj.ClusterCIDR = internalcfg.Networking.PodSubnet @@ -71,7 +71,7 @@ func defaultKubeProxyConfiguration(internalcfg *MasterConfiguration, obj *kubepr } } -func defaultKubeletConfiguration(internalcfg *MasterConfiguration, obj *kubeletconfig.KubeletConfiguration) { +func defaultKubeletConfiguration(internalcfg *InitConfiguration, obj *kubeletconfig.KubeletConfiguration) { // NOTE: This code should be mirrored from cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go and cmd/kubeadm/app/componentconfig/defaults.go if obj.StaticPodPath == "" { obj.StaticPodPath = DefaultManifestsDir diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/defaults.go index 4711ddc024f..930cd6fdf94 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/defaults.go @@ -67,8 +67,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error { return RegisterDefaults(scheme) } -// SetDefaults_MasterConfiguration assigns default values to Master node -func SetDefaults_MasterConfiguration(obj *MasterConfiguration) { +// SetDefaults_InitConfiguration assigns default values to Master node +func SetDefaults_InitConfiguration(obj *InitConfiguration) { if obj.KubernetesVersion == "" { obj.KubernetesVersion = DefaultKubernetesVersion } @@ -104,7 +104,7 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) { } // SetDefaults_Etcd assigns default values for the Proxy -func SetDefaults_Etcd(obj *MasterConfiguration) { +func SetDefaults_Etcd(obj *InitConfiguration) { if obj.Etcd.External == nil && obj.Etcd.Local == nil { obj.Etcd.Local = &LocalEtcd{} } @@ -152,7 +152,7 @@ func SetDefaults_NodeRegistrationOptions(obj *NodeRegistrationOptions) { } // SetDefaults_AuditPolicyConfiguration sets default values for the AuditPolicyConfiguration -func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) { +func SetDefaults_AuditPolicyConfiguration(obj *InitConfiguration) { if obj.AuditPolicyConfiguration.LogDir == "" { obj.AuditPolicyConfiguration.LogDir = constants.StaticPodAuditPolicyLogDir } @@ -166,7 +166,7 @@ func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) { // 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 *MasterConfiguration) { +func SetDefaults_BootstrapTokens(obj *InitConfiguration) { if obj.BootstrapTokens == nil || len(obj.BootstrapTokens) == 0 { obj.BootstrapTokens = []BootstrapToken{{}} diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/register.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/register.go index 6df066b3de5..4821f7bd37b 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/register.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/register.go @@ -58,7 +58,7 @@ func Resource(resource string) schema.GroupResource { func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &MasterConfiguration{}, + &InitConfiguration{}, &NodeConfiguration{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/types.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/types.go index 3504d384dda..5dcbf8d47f4 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/types.go @@ -23,9 +23,9 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// MasterConfiguration contains a list of elements which make up master's +// InitConfiguration contains a list of elements which make up master's // configuration object. -type MasterConfiguration struct { +type InitConfiguration struct { metav1.TypeMeta `json:",inline"` // `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs. diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.conversion.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.conversion.go index 2ea4d0f5a3e..3570d78c42a 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.conversion.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.conversion.go @@ -54,8 +54,8 @@ func RegisterConversions(scheme *runtime.Scheme) error { Convert_kubeadm_HostPathMount_To_v1alpha3_HostPathMount, Convert_v1alpha3_LocalEtcd_To_kubeadm_LocalEtcd, Convert_kubeadm_LocalEtcd_To_v1alpha3_LocalEtcd, - Convert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration, - Convert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration, + Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration, + Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration, Convert_v1alpha3_Networking_To_kubeadm_Networking, Convert_kubeadm_Networking_To_v1alpha3_Networking, Convert_v1alpha3_NodeConfiguration_To_kubeadm_NodeConfiguration, @@ -269,7 +269,7 @@ func Convert_kubeadm_LocalEtcd_To_v1alpha3_LocalEtcd(in *kubeadm.LocalEtcd, out return autoConvert_kubeadm_LocalEtcd_To_v1alpha3_LocalEtcd(in, out, s) } -func autoConvert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration(in *MasterConfiguration, out *kubeadm.MasterConfiguration, s conversion.Scope) error { +func autoConvert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error { out.BootstrapTokens = *(*[]kubeadm.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) if err := Convert_v1alpha3_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { return err @@ -302,7 +302,7 @@ func autoConvert_v1alpha3_MasterConfiguration_To_kubeadm_MasterConfiguration(in return nil } -func autoConvert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration(in *kubeadm.MasterConfiguration, out *MasterConfiguration, s conversion.Scope) error { +func autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { out.BootstrapTokens = *(*[]BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) if err := Convert_kubeadm_NodeRegistrationOptions_To_v1alpha3_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { return err @@ -337,9 +337,9 @@ func autoConvert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration(in return nil } -// Convert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration is an autogenerated conversion function. -func Convert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration(in *kubeadm.MasterConfiguration, out *MasterConfiguration, s conversion.Scope) error { - return autoConvert_kubeadm_MasterConfiguration_To_v1alpha3_MasterConfiguration(in, out, s) +// Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration is an autogenerated conversion function. +func Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { + return autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in, out, s) } func autoConvert_v1alpha3_Networking_To_kubeadm_Networking(in *Networking, out *kubeadm.Networking, s conversion.Scope) error { diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.deepcopy.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.deepcopy.go index 46171fbde1e..3171239482e 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.deepcopy.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.deepcopy.go @@ -216,7 +216,7 @@ func (in *LocalEtcd) DeepCopy() *LocalEtcd { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { +func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) { *out = *in out.TypeMeta = in.TypeMeta if in.BootstrapTokens != nil { @@ -282,18 +282,18 @@ func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterConfiguration. -func (in *MasterConfiguration) DeepCopy() *MasterConfiguration { +// 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(MasterConfiguration) + out := new(InitConfiguration) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MasterConfiguration) DeepCopyObject() runtime.Object { +func (in *InitConfiguration) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.defaults.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.defaults.go index 5454e5d95dc..e0fe7524781 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.defaults.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha3/zz_generated.defaults.go @@ -28,13 +28,13 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&MasterConfiguration{}, func(obj interface{}) { SetObjectDefaults_MasterConfiguration(obj.(*MasterConfiguration)) }) + scheme.AddTypeDefaultingFunc(&InitConfiguration{}, func(obj interface{}) { SetObjectDefaults_InitConfiguration(obj.(*InitConfiguration)) }) scheme.AddTypeDefaultingFunc(&NodeConfiguration{}, func(obj interface{}) { SetObjectDefaults_NodeConfiguration(obj.(*NodeConfiguration)) }) return nil } -func SetObjectDefaults_MasterConfiguration(in *MasterConfiguration) { - SetDefaults_MasterConfiguration(in) +func SetObjectDefaults_InitConfiguration(in *InitConfiguration) { + SetDefaults_InitConfiguration(in) for i := range in.BootstrapTokens { a := &in.BootstrapTokens[i] SetDefaults_BootstrapToken(a) diff --git a/cmd/kubeadm/app/apis/kubeadm/validation/validation.go b/cmd/kubeadm/app/apis/kubeadm/validation/validation.go index 9d965af8688..179b3f57e69 100644 --- a/cmd/kubeadm/app/apis/kubeadm/validation/validation.go +++ b/cmd/kubeadm/app/apis/kubeadm/validation/validation.go @@ -40,8 +40,8 @@ import ( "k8s.io/kubernetes/pkg/registry/core/service/ipallocator" ) -// ValidateMasterConfiguration validates master configuration and collects all encountered errors -func ValidateMasterConfiguration(c *kubeadm.MasterConfiguration) field.ErrorList { +// ValidateInitConfiguration validates master configuration and collects all encountered errors +func ValidateInitConfiguration(c *kubeadm.InitConfiguration) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, ValidateNetworking(&c.Networking, field.NewPath("networking"))...) allErrs = append(allErrs, ValidateCertSANs(c.APIServerCertSANs, field.NewPath("apiServerCertSANs"))...) diff --git a/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go b/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go index 00d0d34c4b3..fae40f5a054 100644 --- a/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go +++ b/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go @@ -219,17 +219,17 @@ func TestValidateIPNetFromString(t *testing.T) { func TestValidateAPIEndpoint(t *testing.T) { var tests = []struct { name string - s *kubeadm.MasterConfiguration + s *kubeadm.InitConfiguration expected bool }{ { name: "Missing configuration", - s: &kubeadm.MasterConfiguration{}, + s: &kubeadm.InitConfiguration{}, expected: false, }, { name: "Valid DNS ControlPlaneEndpoint (with port), AdvertiseAddress and default port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "cp.k8s.io:8081", AdvertiseAddress: "4.5.6.7", @@ -240,7 +240,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv4 ControlPlaneEndpoint (with port), AdvertiseAddress and default port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "1.2.3.4:8081", AdvertiseAddress: "4.5.6.7", @@ -251,7 +251,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv6 ControlPlaneEndpoint (with port), ControlPlaneEndpoint and port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "[2001:db7::1]:8081", AdvertiseAddress: "2001:db7::2", @@ -262,7 +262,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid DNS ControlPlaneEndpoint (without port), AdvertiseAddress and default port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "cp.k8s.io", AdvertiseAddress: "4.5.6.7", @@ -273,7 +273,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv4 ControlPlaneEndpoint (without port), AdvertiseAddress and default port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "1.2.3.4", AdvertiseAddress: "4.5.6.7", @@ -284,7 +284,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv6 ControlPlaneEndpoint (without port), ControlPlaneEndpoint and port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "2001:db7::1", AdvertiseAddress: "2001:db7::2", @@ -295,7 +295,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv4 AdvertiseAddress and default port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -305,7 +305,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Valid IPv6 AdvertiseAddress and port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "2001:db7::1", BindPort: 3446, @@ -315,7 +315,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid IPv4 AdvertiseAddress", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.34", BindPort: 6443, @@ -325,7 +325,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid IPv6 AdvertiseAddress", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "2001:db7:1", BindPort: 3446, @@ -335,7 +335,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid BindPort", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 0, @@ -345,7 +345,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid DNS ControlPlaneEndpoint", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "bad!!.k8s.io", }, @@ -354,7 +354,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid ipv4 ControlPlaneEndpoint", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "1..3.4", }, @@ -363,7 +363,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid ipv6 ControlPlaneEndpoint", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "1200::AB00:1234::2552:7777:1313", }, @@ -372,7 +372,7 @@ func TestValidateAPIEndpoint(t *testing.T) { }, { name: "Invalid ControlPlaneEndpoint port", - s: &kubeadm.MasterConfiguration{ + s: &kubeadm.InitConfiguration{ API: kubeadm.API{ ControlPlaneEndpoint: "1.2.3.4:0", }, @@ -393,17 +393,17 @@ func TestValidateAPIEndpoint(t *testing.T) { } } -func TestValidateMasterConfiguration(t *testing.T) { +func TestValidateInitConfiguration(t *testing.T) { nodename := "valid-nodename" var tests = []struct { name string - s *kubeadm.MasterConfiguration + s *kubeadm.InitConfiguration expected bool }{ {"invalid missing master configuration", - &kubeadm.MasterConfiguration{}, false}, + &kubeadm.InitConfiguration{}, false}, {"invalid missing token with IPv4 service subnet", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -416,7 +416,7 @@ func TestValidateMasterConfiguration(t *testing.T) { NodeRegistration: kubeadm.NodeRegistrationOptions{Name: nodename, CRISocket: "/some/path"}, }, false}, {"invalid missing token with IPv6 service subnet", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -429,7 +429,7 @@ func TestValidateMasterConfiguration(t *testing.T) { NodeRegistration: kubeadm.NodeRegistrationOptions{Name: nodename, CRISocket: "/some/path"}, }, false}, {"invalid missing node name", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -441,7 +441,7 @@ func TestValidateMasterConfiguration(t *testing.T) { CertificatesDir: "/some/other/cert/dir", }, false}, {"valid master configuration with incorrect IPv4 pod subnet", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -455,7 +455,7 @@ func TestValidateMasterConfiguration(t *testing.T) { NodeRegistration: kubeadm.NodeRegistrationOptions{Name: nodename, CRISocket: "/some/path"}, }, false}, {"valid master configuration with IPv4 service subnet", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, @@ -500,7 +500,7 @@ func TestValidateMasterConfiguration(t *testing.T) { NodeRegistration: kubeadm.NodeRegistrationOptions{Name: nodename, CRISocket: "/some/path"}, }, true}, {"valid master configuration using IPv6 service subnet", - &kubeadm.MasterConfiguration{ + &kubeadm.InitConfiguration{ API: kubeadm.API{ AdvertiseAddress: "1:2:3::4", BindPort: 3446, @@ -545,7 +545,7 @@ func TestValidateMasterConfiguration(t *testing.T) { }, true}, } for _, rt := range tests { - actual := ValidateMasterConfiguration(rt.s) + actual := ValidateInitConfiguration(rt.s) if (len(actual) == 0) != rt.expected { t.Errorf( "%s test case failed:\n\texpected: %t\n\t actual: %t", diff --git a/cmd/kubeadm/app/apis/kubeadm/zz_generated.deepcopy.go b/cmd/kubeadm/app/apis/kubeadm/zz_generated.deepcopy.go index d3e6d848f32..44124aace4d 100644 --- a/cmd/kubeadm/app/apis/kubeadm/zz_generated.deepcopy.go +++ b/cmd/kubeadm/app/apis/kubeadm/zz_generated.deepcopy.go @@ -244,7 +244,7 @@ func (in *LocalEtcd) DeepCopy() *LocalEtcd { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { +func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) { *out = *in out.TypeMeta = in.TypeMeta if in.BootstrapTokens != nil { @@ -311,18 +311,18 @@ func (in *MasterConfiguration) DeepCopyInto(out *MasterConfiguration) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterConfiguration. -func (in *MasterConfiguration) DeepCopy() *MasterConfiguration { +// 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(MasterConfiguration) + out := new(InitConfiguration) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MasterConfiguration) DeepCopyObject() runtime.Object { +func (in *InitConfiguration) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/cmd/kubeadm/app/cmd/config.go b/cmd/kubeadm/app/cmd/config.go index b477d70fbfd..3580694e0a1 100644 --- a/cmd/kubeadm/app/cmd/config.go +++ b/cmd/kubeadm/app/cmd/config.go @@ -47,7 +47,7 @@ import ( ) var ( - availableAPIObjects = []string{constants.MasterConfigurationKind, constants.NodeConfigurationKind} + availableAPIObjects = []string{constants.InitConfigurationKind, constants.NodeConfigurationKind} // sillyToken is only set statically to make kubeadm not randomize the token on every run sillyToken = kubeadmapiv1alpha3.BootstrapToken{ Token: &kubeadmapiv1alpha3.BootstrapTokenString{ @@ -69,7 +69,7 @@ func NewCmdConfig(out io.Writer) *cobra.Command { cluster. kubeadm CLI v1.8.0+ automatically creates this ConfigMap with the config used with 'kubeadm init', but if you initialized your cluster using kubeadm v1.7.x or lower, you must use the 'config upload' command to create this ConfigMap. This is required so that 'kubeadm upgrade' can configure your upgraded cluster correctly. - `), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap), + `), metav1.NamespaceSystem, constants.InitConfigurationConfigMap), // Without this callback, if a user runs just the "upload" // command without a subcommand, or with an invalid subcommand, // cobra will print usage information, but still exit cleanly. @@ -97,7 +97,7 @@ func NewCmdConfigPrintDefault(out io.Writer) *cobra.Command { Aliases: []string{"print-defaults"}, Short: "Print the default values for a kubeadm configuration object.", Long: fmt.Sprintf(dedent.Dedent(` - This command prints the default MasterConfiguration object that is used for 'kubeadm init' and 'kubeadm upgrade', + This command prints the default InitConfiguration object that is used for 'kubeadm init' and 'kubeadm upgrade', and the default NodeConfiguration object that is used for 'kubeadm join'. Note that sensitive values like the Bootstrap Token fields are replaced with silly values like %q in order to pass validation but @@ -125,8 +125,8 @@ func getDefaultAPIObjectBytes(apiObject string) ([]byte, error) { var internalcfg runtime.Object var err error switch apiObject { - case constants.MasterConfigurationKind: - internalcfg, err = configutil.ConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1alpha3.MasterConfiguration{ + case constants.InitConfigurationKind: + internalcfg, err = configutil.ConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1alpha3.InitConfiguration{ API: kubeadmapiv1alpha3.API{AdvertiseAddress: "1.2.3.4"}, BootstrapTokens: []kubeadmapiv1alpha3.BootstrapToken{sillyToken}, KubernetesVersion: fmt.Sprintf("v1.%d.0", constants.MinimumControlPlaneVersion.Minor()+1), @@ -215,7 +215,7 @@ func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command { Using this command, you can view the ConfigMap in the cluster where the configuration for kubeadm is located. The configuration is located in the %q namespace in the %q ConfigMap. - `), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap), + `), metav1.NamespaceSystem, constants.InitConfigurationConfigMap), Run: func(cmd *cobra.Command, args []string) { glog.V(1).Infoln("[config] retrieving ClientSet from file") client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile) @@ -240,7 +240,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co same config file before upgrading to v1.8 using 'kubeadm upgrade'. The configuration is located in the %q namespace in the %q ConfigMap. - `), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap), + `), metav1.NamespaceSystem, constants.InitConfigurationConfigMap), Run: func(cmd *cobra.Command, args []string) { if len(cfgPath) == 0 { kubeadmutil.CheckErr(fmt.Errorf("The --config flag is mandatory")) @@ -252,7 +252,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co // The default configuration is empty; everything should come from the file on disk glog.V(1).Infoln("[config] creating empty default configuration") - defaultcfg := &kubeadmapiv1alpha3.MasterConfiguration{} + defaultcfg := &kubeadmapiv1alpha3.InitConfiguration{} // Upload the configuration using the file; don't care about the defaultcfg really glog.V(1).Infof("[config] uploading configuration") err = uploadConfiguration(client, cfgPath, defaultcfg) @@ -265,7 +265,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co // NewCmdConfigUploadFromFlags returns cobra.Command for "kubeadm config upload from-flags" command func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} kubeadmscheme.Scheme.Default(cfg) var featureGatesString string @@ -279,7 +279,7 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C same flags before upgrading to v1.8 using 'kubeadm upgrade'. The configuration is located in the %q namespace in the %q ConfigMap. - `), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap), + `), metav1.NamespaceSystem, constants.InitConfigurationConfigMap), Run: func(cmd *cobra.Command, args []string) { var err error glog.V(1).Infoln("[config] creating new FeatureGates") @@ -305,17 +305,17 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C func RunConfigView(out io.Writer, client clientset.Interface) error { glog.V(1).Infoln("[config] getting the cluster configuration") - cfgConfigMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.MasterConfigurationConfigMap, metav1.GetOptions{}) + cfgConfigMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.InitConfigurationConfigMap, metav1.GetOptions{}) if err != nil { return err } // No need to append \n as that already exists in the ConfigMap - fmt.Fprintf(out, "%s", cfgConfigMap.Data[constants.MasterConfigurationConfigMapKey]) + fmt.Fprintf(out, "%s", cfgConfigMap.Data[constants.InitConfigurationConfigMapKey]) return nil } // uploadConfiguration handles the uploading of the configuration internally -func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg *kubeadmapiv1alpha3.MasterConfiguration) error { +func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg *kubeadmapiv1alpha3.InitConfiguration) error { // Default both statically and dynamically, convert to internal API type, and validate everything // First argument is unset here as we shouldn't load a config file from disk @@ -343,7 +343,7 @@ func NewCmdConfigImages(out io.Writer) *cobra.Command { // NewCmdConfigImagesPull returns the `kubeadm config images pull` command func NewCmdConfigImagesPull() *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} kubeadmscheme.Scheme.Default(cfg) var cfgPath, featureGatesString string var err error @@ -395,7 +395,7 @@ func (ip *ImagesPull) PullAll() error { // NewCmdConfigImagesList returns the "kubeadm config images list" command func NewCmdConfigImagesList(out io.Writer, mockK8sVersion *string) *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} kubeadmscheme.Scheme.Default(cfg) var cfgPath, featureGatesString string var err error @@ -423,7 +423,7 @@ func NewCmdConfigImagesList(out io.Writer, mockK8sVersion *string) *cobra.Comman } // NewImagesList returns the underlying struct for the "kubeadm config images list" command -func NewImagesList(cfgPath string, cfg *kubeadmapiv1alpha3.MasterConfiguration) (*ImagesList, error) { +func NewImagesList(cfgPath string, cfg *kubeadmapiv1alpha3.InitConfiguration) (*ImagesList, error) { internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg) if err != nil { return nil, fmt.Errorf("could not convert cfg to an internal cfg: %v", err) @@ -436,7 +436,7 @@ func NewImagesList(cfgPath string, cfg *kubeadmapiv1alpha3.MasterConfiguration) // ImagesList defines the struct used for "kubeadm config images list" type ImagesList struct { - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration } // Run runs the images command and writes the result to the io.Writer passed in @@ -450,7 +450,7 @@ func (i *ImagesList) Run(out io.Writer) error { } // AddImagesCommonConfigFlags adds the flags that configure kubeadm (and affect the images kubeadm will use) -func AddImagesCommonConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.MasterConfiguration, cfgPath *string, featureGatesString *string) { +func AddImagesCommonConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.InitConfiguration, cfgPath *string, featureGatesString *string) { flagSet.StringVar( &cfg.KubernetesVersion, "kubernetes-version", cfg.KubernetesVersion, `Choose a specific Kubernetes version for the control plane.`, @@ -461,6 +461,6 @@ func AddImagesCommonConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.M } // AddImagesPullFlags adds flags related to the `kubeadm config images pull` command -func AddImagesPullFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.MasterConfiguration) { +func AddImagesPullFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.InitConfiguration) { flagSet.StringVar(&cfg.NodeRegistration.CRISocket, "cri-socket-path", cfg.NodeRegistration.CRISocket, "Path to the CRI socket.") } diff --git a/cmd/kubeadm/app/cmd/config_test.go b/cmd/kubeadm/app/cmd/config_test.go index a6205260f4e..980e1ec723f 100644 --- a/cmd/kubeadm/app/cmd/config_test.go +++ b/cmd/kubeadm/app/cmd/config_test.go @@ -66,7 +66,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) { }, configContents: []byte(dedent.Dedent(` apiVersion: kubeadm.k8s.io/v1alpha3 - kind: MasterConfiguration + kind: InitConfiguration kubernetesVersion: v1.10.1 `)), }, @@ -78,7 +78,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) { }, configContents: []byte(dedent.Dedent(` apiVersion: kubeadm.k8s.io/v1alpha3 - kind: MasterConfiguration + kind: InitConfiguration kubernetesVersion: v1.11.0 featureGates: CoreDNS: True @@ -100,7 +100,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) { t.Fatalf("Failed writing a config file: %v", err) } - i, err := cmd.NewImagesList(configFilePath, &kubeadmapiv1alpha3.MasterConfiguration{ + i, err := cmd.NewImagesList(configFilePath, &kubeadmapiv1alpha3.InitConfiguration{ KubernetesVersion: dummyKubernetesVersion, }) if err != nil { @@ -127,19 +127,19 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) { func TestConfigImagesListRunWithoutPath(t *testing.T) { testcases := []struct { name string - cfg kubeadmapiv1alpha3.MasterConfiguration + cfg kubeadmapiv1alpha3.InitConfiguration expectedImages int }{ { name: "empty config", expectedImages: defaultNumberOfImages, - cfg: kubeadmapiv1alpha3.MasterConfiguration{ + cfg: kubeadmapiv1alpha3.InitConfiguration{ KubernetesVersion: dummyKubernetesVersion, }, }, { name: "external etcd configuration", - cfg: kubeadmapiv1alpha3.MasterConfiguration{ + cfg: kubeadmapiv1alpha3.InitConfiguration{ Etcd: kubeadmapiv1alpha3.Etcd{ External: &kubeadmapiv1alpha3.ExternalEtcd{ Endpoints: []string{"https://some.etcd.com:2379"}, @@ -151,7 +151,7 @@ func TestConfigImagesListRunWithoutPath(t *testing.T) { }, { name: "coredns enabled", - cfg: kubeadmapiv1alpha3.MasterConfiguration{ + cfg: kubeadmapiv1alpha3.InitConfiguration{ FeatureGates: map[string]bool{ features.CoreDNS: true, }, @@ -208,7 +208,7 @@ func TestImagesPull(t *testing.T) { func TestMigrate(t *testing.T) { cfg := []byte(dedent.Dedent(` apiVersion: kubeadm.k8s.io/v1alpha3 - kind: MasterConfiguration + kind: InitConfiguration kubernetesVersion: v1.10.0 `)) configFile, cleanup := tempConfig(t, cfg) diff --git a/cmd/kubeadm/app/cmd/init.go b/cmd/kubeadm/app/cmd/init.go index 146a018ace6..61d32454e0e 100644 --- a/cmd/kubeadm/app/cmd/init.go +++ b/cmd/kubeadm/app/cmd/init.go @@ -116,7 +116,7 @@ var ( // NewCmdInit returns "kubeadm init" command. func NewCmdInit(out io.Writer) *cobra.Command { - externalcfg := &kubeadmapiv1alpha3.MasterConfiguration{} + externalcfg := &kubeadmapiv1alpha3.InitConfiguration{} kubeadmscheme.Scheme.Default(externalcfg) var cfgPath string @@ -165,7 +165,7 @@ func NewCmdInit(out io.Writer) *cobra.Command { } // AddInitConfigFlags adds init flags bound to the config to the specified flagset -func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.MasterConfiguration, featureGatesString *string) { +func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha3.InitConfiguration, featureGatesString *string) { flagSet.StringVar( &cfg.API.AdvertiseAddress, "apiserver-advertise-address", cfg.API.AdvertiseAddress, "The IP address the API Server will advertise it's listening on. Specify '0.0.0.0' to use the address of the default network interface.", @@ -239,7 +239,7 @@ func AddInitOtherFlags(flagSet *flag.FlagSet, cfgPath *string, skipPreFlight, sk } // NewInit validates given arguments and instantiates Init struct with provided information. -func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha3.MasterConfiguration, ignorePreflightErrors sets.String, skipTokenPrint, dryRun bool) (*Init, error) { +func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha3.InitConfiguration, ignorePreflightErrors sets.String, skipTokenPrint, dryRun bool) (*Init, error) { // Either use the config file if specified, or convert the defaults in the external to an internal cfg representation cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, externalcfg) @@ -276,7 +276,7 @@ func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha3.MasterConfiguration // Init defines struct used by "kubeadm init" command type Init struct { - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration skipTokenPrint bool dryRun bool ignorePreflightErrors sets.String @@ -548,7 +548,7 @@ func printJoinCommand(out io.Writer, adminKubeConfigPath, token string, skipToke } // createClient creates a clientset.Interface object -func createClient(cfg *kubeadmapi.MasterConfiguration, dryRun bool) (clientset.Interface, error) { +func createClient(cfg *kubeadmapi.InitConfiguration, dryRun bool) (clientset.Interface, error) { if dryRun { // If we're dry-running; we should create a faked client that answers some GETs in order to be able to do the full init flow and just logs the rest of requests dryRunGetter := apiclient.NewInitDryRunGetter(cfg.NodeRegistration.Name, cfg.Networking.ServiceSubnet) diff --git a/cmd/kubeadm/app/cmd/options/token.go b/cmd/kubeadm/app/cmd/options/token.go index 3b6fdcfa5de..3f24df96ce6 100644 --- a/cmd/kubeadm/app/cmd/options/token.go +++ b/cmd/kubeadm/app/cmd/options/token.go @@ -35,7 +35,7 @@ func NewBootstrapTokenOptions() *BootstrapTokenOptions { } // BootstrapTokenOptions is a wrapper struct for adding bootstrap token-related flags to a FlagSet -// and applying the parsed flags to a MasterConfiguration object later at runtime +// and applying the parsed flags to a InitConfiguration object later at runtime // TODO: In the future, we might want to group the flags in a better way than adding them all individually like this type BootstrapTokenOptions struct { *kubeadmapiv1alpha3.BootstrapToken @@ -87,9 +87,9 @@ func (bto *BootstrapTokenOptions) AddDescriptionFlag(fs *pflag.FlagSet) { ) } -// ApplyTo applies the values set internally in the BootstrapTokenOptions object to a MasterConfiguration object at runtime +// ApplyTo applies the values set internally in the BootstrapTokenOptions object to a InitConfiguration object at runtime // If --token was specified in the CLI (as a string), it's parsed and validated before it's added to the BootstrapToken object. -func (bto *BootstrapTokenOptions) ApplyTo(cfg *kubeadmapiv1alpha3.MasterConfiguration) error { +func (bto *BootstrapTokenOptions) ApplyTo(cfg *kubeadmapiv1alpha3.InitConfiguration) error { if len(bto.TokenStr) > 0 { var err error bto.Token, err = kubeadmapiv1alpha3.NewBootstrapTokenString(bto.TokenStr) diff --git a/cmd/kubeadm/app/cmd/phases/addons.go b/cmd/kubeadm/app/cmd/phases/addons.go index 0bcba265e5b..9a3fa07119c 100644 --- a/cmd/kubeadm/app/cmd/phases/addons.go +++ b/cmd/kubeadm/app/cmd/phases/addons.go @@ -74,9 +74,9 @@ func NewCmdAddon() *cobra.Command { } // EnsureAllAddons installs all addons to a Kubernetes cluster -func EnsureAllAddons(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func EnsureAllAddons(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { - addonActions := []func(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error{ + addonActions := []func(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error{ dnsaddon.EnsureDNSAddon, proxyaddon.EnsureProxyAddon, } @@ -94,7 +94,7 @@ func EnsureAllAddons(cfg *kubeadmapi.MasterConfiguration, client clientset.Inter // getAddonsSubCommands returns sub commands for addons phase func getAddonsSubCommands() []*cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // Default values for the cobra help text kubeadmscheme.Scheme.Default(cfg) @@ -106,7 +106,7 @@ func getAddonsSubCommands() []*cobra.Command { short string long string examples string - cmdFunc func(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error + cmdFunc func(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error }{ { use: "all", @@ -164,7 +164,7 @@ func getAddonsSubCommands() []*cobra.Command { } // runAddonsCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters) -func runAddonsCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error, cfg *kubeadmapiv1alpha3.MasterConfiguration, kubeConfigFile *string, cfgPath *string, featureGatesString *string) func(cmd *cobra.Command, args []string) { +func runAddonsCmdFunc(cmdFunc func(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error, cfg *kubeadmapiv1alpha3.InitConfiguration, kubeConfigFile *string, cfgPath *string, featureGatesString *string) func(cmd *cobra.Command, args []string) { // the following statement build a clousure that wraps a call to a cmdFunc, binding // the function itself with the specific parameters of each sub command. @@ -181,7 +181,7 @@ func runAddonsCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration, client c kubeadmutil.CheckErr(err) } - internalcfg := &kubeadmapi.MasterConfiguration{} + internalcfg := &kubeadmapi.InitConfiguration{} kubeadmscheme.Scheme.Convert(cfg, internalcfg, nil) client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile) kubeadmutil.CheckErr(err) diff --git a/cmd/kubeadm/app/cmd/phases/bootstraptoken.go b/cmd/kubeadm/app/cmd/phases/bootstraptoken.go index 365314ad70d..53fbd6e57a2 100644 --- a/cmd/kubeadm/app/cmd/phases/bootstraptoken.go +++ b/cmd/kubeadm/app/cmd/phases/bootstraptoken.go @@ -107,7 +107,7 @@ func NewCmdBootstrapToken() *cobra.Command { // NewSubCmdBootstrapTokenAll returns the Cobra command for running the token all sub-phase func NewSubCmdBootstrapTokenAll(kubeConfigFile *string) *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ // KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid // the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig KubernetesVersion: "v1.10.0", @@ -174,7 +174,7 @@ func NewSubCmdBootstrapTokenAll(kubeConfigFile *string) *cobra.Command { // NewSubCmdBootstrapToken returns the Cobra command for running the create token phase func NewSubCmdBootstrapToken(kubeConfigFile *string) *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ // KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid // the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig KubernetesVersion: "v1.10.0", @@ -306,7 +306,7 @@ func addGenericFlags(flagSet *pflag.FlagSet, cfgPath *string, skipTokenPrint *bo ) } -func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha3.MasterConfiguration, skipTokenPrint bool) error { +func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha3.InitConfiguration, skipTokenPrint bool) error { // This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg) diff --git a/cmd/kubeadm/app/cmd/phases/certs.go b/cmd/kubeadm/app/cmd/phases/certs.go index 579877eb7b1..c7391506e16 100644 --- a/cmd/kubeadm/app/cmd/phases/certs.go +++ b/cmd/kubeadm/app/cmd/phases/certs.go @@ -148,7 +148,7 @@ func NewCmdCerts() *cobra.Command { // getCertsSubCommands returns sub commands for certs phase func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // This is used for unit testing only... // If we wouldn't set this to something, the code would dynamically look up the version from the internet @@ -168,7 +168,7 @@ func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command { short string long string examples string - cmdFunc func(cfg *kubeadmapi.MasterConfiguration) error + cmdFunc func(cfg *kubeadmapi.InitConfiguration) error }{ { use: "all", @@ -272,7 +272,7 @@ func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command { } // runCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters) -func runCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration) error, cfgPath *string, cfg *kubeadmapiv1alpha3.MasterConfiguration) func(cmd *cobra.Command, args []string) { +func runCmdFunc(cmdFunc func(cfg *kubeadmapi.InitConfiguration) error, cfgPath *string, cfg *kubeadmapiv1alpha3.InitConfiguration) func(cmd *cobra.Command, args []string) { // the following statement build a closure that wraps a call to a cmdFunc, binding // the function itself with the specific parameters of each sub command. diff --git a/cmd/kubeadm/app/cmd/phases/certs_test.go b/cmd/kubeadm/app/cmd/phases/certs_test.go index 32b90027479..28374032e98 100644 --- a/cmd/kubeadm/app/cmd/phases/certs_test.go +++ b/cmd/kubeadm/app/cmd/phases/certs_test.go @@ -253,12 +253,12 @@ func TestSubCmdCertsCreateFilesWithConfigFile(t *testing.T) { certdir := tmpdir - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, CertificatesDir: certdir, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, } - configPath := testutil.SetupMasterConfigurationFile(t, tmpdir, cfg) + configPath := testutil.SetupInitConfigurationFile(t, tmpdir, cfg) // executes given sub commands for _, subCmdName := range test.subCmds { diff --git a/cmd/kubeadm/app/cmd/phases/controlplane.go b/cmd/kubeadm/app/cmd/phases/controlplane.go index 79819489bb0..a5f2363f98f 100644 --- a/cmd/kubeadm/app/cmd/phases/controlplane.go +++ b/cmd/kubeadm/app/cmd/phases/controlplane.go @@ -79,7 +79,7 @@ func NewCmdControlplane() *cobra.Command { // getControlPlaneSubCommands returns sub commands for Controlplane phase func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // This is used for unit testing only... // If we wouldn't set this to something, the code would dynamically look up the version from the internet @@ -99,7 +99,7 @@ func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobr short string long string examples string - cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error + cmdFunc func(outDir string, cfg *kubeadmapi.InitConfiguration) error }{ { use: "all", @@ -169,7 +169,7 @@ func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobr } // runCmdControlPlane creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters) -func runCmdControlPlane(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, featureGatesString *string, cfg *kubeadmapiv1alpha3.MasterConfiguration) func(cmd *cobra.Command, args []string) { +func runCmdControlPlane(cmdFunc func(outDir string, cfg *kubeadmapi.InitConfiguration) error, outDir, cfgPath *string, featureGatesString *string, cfg *kubeadmapiv1alpha3.InitConfiguration) func(cmd *cobra.Command, args []string) { // the following statement build a closure that wraps a call to a cmdFunc, binding // the function itself with the specific parameters of each sub command. diff --git a/cmd/kubeadm/app/cmd/phases/etcd.go b/cmd/kubeadm/app/cmd/phases/etcd.go index ab325b4e93c..02c2ef0fc64 100644 --- a/cmd/kubeadm/app/cmd/phases/etcd.go +++ b/cmd/kubeadm/app/cmd/phases/etcd.go @@ -61,7 +61,7 @@ func NewCmdEtcd() *cobra.Command { // getEtcdSubCommands returns sub commands for etcd phase func getEtcdSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // This is used for unit testing only... // If we wouldn't set this to something, the code would dynamically look up the version from the internet @@ -81,7 +81,7 @@ func getEtcdSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Comman short string long string examples string - cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error + cmdFunc func(outDir string, cfg *kubeadmapi.InitConfiguration) error }{ use: "local", short: "Generates the static Pod manifest file for a local, single-node etcd instance", diff --git a/cmd/kubeadm/app/cmd/phases/kubeconfig.go b/cmd/kubeadm/app/cmd/phases/kubeconfig.go index ce6e89fa963..351a1adcac6 100644 --- a/cmd/kubeadm/app/cmd/phases/kubeconfig.go +++ b/cmd/kubeadm/app/cmd/phases/kubeconfig.go @@ -90,7 +90,7 @@ func NewCmdKubeConfig(out io.Writer) *cobra.Command { // getKubeConfigSubCommands returns sub commands for kubeconfig phase func getKubeConfigSubCommands(out io.Writer, outDir, defaultKubernetesVersion string) []*cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // This is used for unit testing only... // If we wouldn't set this to something, the code would dynamically look up the version from the internet @@ -111,7 +111,7 @@ func getKubeConfigSubCommands(out io.Writer, outDir, defaultKubernetesVersion st short string long string examples string - cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error + cmdFunc func(outDir string, cfg *kubeadmapi.InitConfiguration) error }{ { use: "all", @@ -149,7 +149,7 @@ func getKubeConfigSubCommands(out io.Writer, outDir, defaultKubernetesVersion st short: "Outputs a kubeconfig file for an additional user", long: userKubeconfigLongDesc, examples: userKubeconfigExample, - cmdFunc: func(outDir string, cfg *kubeadmapi.MasterConfiguration) error { + cmdFunc: func(outDir string, cfg *kubeadmapi.InitConfiguration) error { if clientName == "" { return fmt.Errorf("missing required argument --client-name") } diff --git a/cmd/kubeadm/app/cmd/phases/kubeconfig_test.go b/cmd/kubeadm/app/cmd/phases/kubeconfig_test.go index f74538a6aab..3a39a8a0d6d 100644 --- a/cmd/kubeadm/app/cmd/phases/kubeconfig_test.go +++ b/cmd/kubeadm/app/cmd/phases/kubeconfig_test.go @@ -276,12 +276,12 @@ func TestKubeConfigSubCommandsThatCreateFilesWithConfigFile(t *testing.T) { } // Adds a master configuration file - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, CertificatesDir: pkidir, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, } - cfgPath := testutil.SetupMasterConfigurationFile(t, tmpdir, cfg) + cfgPath := testutil.SetupInitConfigurationFile(t, tmpdir, cfg) // Get subcommands working in the temporary directory subCmds := getKubeConfigSubCommands(nil, tmpdir, phaseTestK8sVersion) diff --git a/cmd/kubeadm/app/cmd/phases/kubelet.go b/cmd/kubeadm/app/cmd/phases/kubelet.go index 170575edf44..7e200f71bb2 100644 --- a/cmd/kubeadm/app/cmd/phases/kubelet.go +++ b/cmd/kubeadm/app/cmd/phases/kubelet.go @@ -39,12 +39,12 @@ import ( var ( kubeletWriteEnvFileLongDesc = normalizer.LongDesc(` Writes an environment file with flags that should be passed to the kubelet executing on the master or node. - This --config flag can either consume a MasterConfiguration object or a NodeConfiguration one, as this + This --config flag can either consume a InitConfiguration object or a NodeConfiguration one, as this function is used for both "kubeadm init" and "kubeadm join". ` + cmdutil.AlphaDisclaimer) kubeletWriteEnvFileExample = normalizer.Examples(` - # Writes a dynamic environment file with kubelet flags from a MasterConfiguration file. + # Writes a dynamic environment file with kubelet flags from a InitConfiguration file. kubeadm alpha phase kubelet write-env-file --config masterconfig.yaml # Writes a dynamic environment file with kubelet flags from a NodeConfiguration file. @@ -52,7 +52,7 @@ var ( `) kubeletConfigUploadLongDesc = normalizer.LongDesc(` - Uploads kubelet configuration extracted from the kubeadm MasterConfiguration object to a ConfigMap + Uploads kubelet configuration extracted from the kubeadm InitConfiguration object to a ConfigMap of the form kubelet-config-1.X in the cluster, where X is the minor version of the current (API Server) Kubernetes version. ` + cmdutil.AlphaDisclaimer) @@ -115,7 +115,7 @@ func NewCmdKubelet() *cobra.Command { return cmd } -// NewCmdKubeletWriteEnvFile calls cobra.Command for writing the dynamic kubelet env file based on a MasterConfiguration or NodeConfiguration object +// NewCmdKubeletWriteEnvFile calls cobra.Command for writing the dynamic kubelet env file based on a InitConfiguration or NodeConfiguration object func NewCmdKubeletWriteEnvFile() *cobra.Command { var cfgPath string @@ -146,7 +146,7 @@ func RunKubeletWriteEnvFile(cfgPath string) error { var registerWithTaints bool switch cfg := internalcfg.(type) { - case *kubeadmapi.MasterConfiguration: + case *kubeadmapi.InitConfiguration: nodeRegistrationObj = &cfg.NodeRegistration featureGates = cfg.FeatureGates registerWithTaints = false @@ -186,7 +186,7 @@ func NewCmdKubeletConfigUpload() *cobra.Command { cmd := &cobra.Command{ Use: "upload", - Short: "Uploads kubelet configuration to a ConfigMap based on a kubeadm MasterConfiguration file.", + Short: "Uploads kubelet configuration to a ConfigMap based on a kubeadm InitConfiguration file.", Long: kubeletConfigUploadLongDesc, Example: kubeletConfigUploadExample, Run: func(cmd *cobra.Command, args []string) { @@ -195,7 +195,7 @@ func NewCmdKubeletConfigUpload() *cobra.Command { } // This call returns the ready-to-use configuration based on the configuration file - internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) kubeadmutil.CheckErr(err) client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile) @@ -260,7 +260,7 @@ func NewCmdKubeletConfigWriteToDisk() *cobra.Command { } // This call returns the ready-to-use configuration based on the configuration file - internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) kubeadmutil.CheckErr(err) err = kubeletphase.WriteConfigToDisk(internalcfg.ComponentConfigs.Kubelet, constants.KubeletRunDirectory) diff --git a/cmd/kubeadm/app/cmd/phases/markmaster.go b/cmd/kubeadm/app/cmd/phases/markmaster.go index 22435cd452a..dd569365d10 100644 --- a/cmd/kubeadm/app/cmd/phases/markmaster.go +++ b/cmd/kubeadm/app/cmd/phases/markmaster.go @@ -47,7 +47,7 @@ var ( // NewCmdMarkMaster returns the Cobra command for running the mark-master phase func NewCmdMarkMaster() *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ // KubernetesVersion is not used by mark master, but we set this explicitly to avoid // the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig KubernetesVersion: "v1.10.0", diff --git a/cmd/kubeadm/app/cmd/phases/preflight.go b/cmd/kubeadm/app/cmd/phases/preflight.go index bba2b5fce6d..3acaf81c477 100644 --- a/cmd/kubeadm/app/cmd/phases/preflight.go +++ b/cmd/kubeadm/app/cmd/phases/preflight.go @@ -69,7 +69,7 @@ func NewCmdPreFlightMaster() *cobra.Command { Long: masterPreflightLongDesc, Example: masterPreflightExample, Run: func(cmd *cobra.Command, args []string) { - cfg := &kubeadmapi.MasterConfiguration{} + cfg := &kubeadmapi.InitConfiguration{} err := preflight.RunInitMasterChecks(utilsexec.New(), cfg, sets.NewString()) kubeadmutil.CheckErr(err) }, diff --git a/cmd/kubeadm/app/cmd/phases/selfhosting.go b/cmd/kubeadm/app/cmd/phases/selfhosting.go index 5c83853cfc0..6176e08ddd8 100644 --- a/cmd/kubeadm/app/cmd/phases/selfhosting.go +++ b/cmd/kubeadm/app/cmd/phases/selfhosting.go @@ -70,7 +70,7 @@ func NewCmdSelfhosting() *cobra.Command { // getSelfhostingSubCommand returns sub commands for Selfhosting phase func getSelfhostingSubCommand() *cobra.Command { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{} + cfg := &kubeadmapiv1alpha3.InitConfiguration{} // Default values for the cobra help text kubeadmscheme.Scheme.Default(cfg) diff --git a/cmd/kubeadm/app/cmd/phases/uploadconfig.go b/cmd/kubeadm/app/cmd/phases/uploadconfig.go index 76424d0333d..e496a1b0799 100644 --- a/cmd/kubeadm/app/cmd/phases/uploadconfig.go +++ b/cmd/kubeadm/app/cmd/phases/uploadconfig.go @@ -38,7 +38,7 @@ var ( This enables correct configuration of system components and a seamless user experience when upgrading. Alternatively, you can use kubeadm config. - `+cmdutil.AlphaDisclaimer), kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem) + `+cmdutil.AlphaDisclaimer), kubeadmconstants.InitConfigurationConfigMap, metav1.NamespaceSystem) uploadConfigExample = normalizer.Examples(` # uploads the configuration of your cluster @@ -62,7 +62,7 @@ func NewCmdUploadConfig() *cobra.Command { client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile) kubeadmutil.CheckErr(err) - defaultcfg := &kubeadmapiv1alpha3.MasterConfiguration{} + defaultcfg := &kubeadmapiv1alpha3.InitConfiguration{} internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg) kubeadmutil.CheckErr(err) diff --git a/cmd/kubeadm/app/cmd/phases/util.go b/cmd/kubeadm/app/cmd/phases/util.go index cfa8813ef3d..1886be311b9 100644 --- a/cmd/kubeadm/app/cmd/phases/util.go +++ b/cmd/kubeadm/app/cmd/phases/util.go @@ -27,7 +27,7 @@ import ( ) // runCmdPhase creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters) -func runCmdPhase(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, cfg *kubeadmapiv1alpha3.MasterConfiguration) func(cmd *cobra.Command, args []string) { +func runCmdPhase(cmdFunc func(outDir string, cfg *kubeadmapi.InitConfiguration) error, outDir, cfgPath *string, cfg *kubeadmapiv1alpha3.InitConfiguration) func(cmd *cobra.Command, args []string) { // the following statement build a closure that wraps a call to a cmdFunc, binding // the function itself with the specific parameters of each sub command. diff --git a/cmd/kubeadm/app/cmd/token.go b/cmd/kubeadm/app/cmd/token.go index ebe64c0c6fc..d3f99cb541d 100644 --- a/cmd/kubeadm/app/cmd/token.go +++ b/cmd/kubeadm/app/cmd/token.go @@ -89,7 +89,7 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command { tokenCmd.PersistentFlags().BoolVar(&dryRun, "dry-run", dryRun, "Whether to enable dry-run mode or not") - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ // KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid // the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig KubernetesVersion: "v1.10.0", @@ -214,7 +214,7 @@ func NewCmdTokenGenerate(out io.Writer) *cobra.Command { } // RunCreateToken generates a new bootstrap token and stores it as a secret on the server. -func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha3.MasterConfiguration, printJoinCommand bool, kubeConfigFile string) error { +func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha3.InitConfiguration, printJoinCommand bool, kubeConfigFile string) error { // This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags glog.V(1).Infoln("[token] loading configurations") internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg) diff --git a/cmd/kubeadm/app/cmd/token_test.go b/cmd/kubeadm/app/cmd/token_test.go index 15418803620..692e8ba4f30 100644 --- a/cmd/kubeadm/app/cmd/token_test.go +++ b/cmd/kubeadm/app/cmd/token_test.go @@ -178,7 +178,7 @@ func TestRunCreateToken(t *testing.T) { t.Fatalf("token couldn't be parsed for testing: %v", err) } - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ // KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid // the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig diff --git a/cmd/kubeadm/app/cmd/upgrade/apply.go b/cmd/kubeadm/app/cmd/upgrade/apply.go index 0778a179ffa..de8ba60ca96 100644 --- a/cmd/kubeadm/app/cmd/upgrade/apply.go +++ b/cmd/kubeadm/app/cmd/upgrade/apply.go @@ -90,7 +90,7 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command { // If the version is specified in config file, pick up that value. if flags.cfgPath != "" { glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath) - cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) kubeadmutil.CheckErr(err) if cfg.KubernetesVersion != "" { @@ -261,7 +261,7 @@ func EnforceVersionPolicies(flags *applyFlags, versionGetter upgrade.VersionGett } // PerformControlPlaneUpgrade actually performs the upgrade procedure for the cluster of your type (self-hosted or static-pod-hosted) -func PerformControlPlaneUpgrade(flags *applyFlags, client clientset.Interface, waiter apiclient.Waiter, internalcfg *kubeadmapi.MasterConfiguration) error { +func PerformControlPlaneUpgrade(flags *applyFlags, client clientset.Interface, waiter apiclient.Waiter, internalcfg *kubeadmapi.InitConfiguration) error { // Check if the cluster is self-hosted and act accordingly glog.V(1).Infoln("checking if cluster is self-hosted") @@ -284,14 +284,14 @@ func PerformControlPlaneUpgrade(flags *applyFlags, client clientset.Interface, w return PerformStaticPodUpgrade(client, waiter, internalcfg, flags.etcdUpgrade) } -// GetPathManagerForUpgrade returns a path manager properly configured for the given MasterConfiguration. -func GetPathManagerForUpgrade(internalcfg *kubeadmapi.MasterConfiguration, etcdUpgrade bool) (upgrade.StaticPodPathManager, error) { +// GetPathManagerForUpgrade returns a path manager properly configured for the given InitConfiguration. +func GetPathManagerForUpgrade(internalcfg *kubeadmapi.InitConfiguration, etcdUpgrade bool) (upgrade.StaticPodPathManager, error) { isHAEtcd := etcdutil.CheckConfigurationIsHA(&internalcfg.Etcd) return upgrade.NewKubeStaticPodPathManagerUsingTempDirs(constants.GetStaticPodDirectory(), true, etcdUpgrade && !isHAEtcd) } // PerformStaticPodUpgrade performs the upgrade of the control plane components for a static pod hosted cluster -func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter, internalcfg *kubeadmapi.MasterConfiguration, etcdUpgrade bool) error { +func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter, internalcfg *kubeadmapi.InitConfiguration, etcdUpgrade bool) error { pathManager, err := GetPathManagerForUpgrade(internalcfg, etcdUpgrade) if err != nil { return err @@ -302,7 +302,7 @@ func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter } // DryRunStaticPodUpgrade fakes an upgrade of the control plane -func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.MasterConfiguration) error { +func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.InitConfiguration) error { dryRunManifestDir, err := constants.CreateTempDirForKubeadm("kubeadm-upgrade-dryrun") if err != nil { diff --git a/cmd/kubeadm/app/cmd/upgrade/apply_test.go b/cmd/kubeadm/app/cmd/upgrade/apply_test.go index a7cd2394b5f..28ac1759bfe 100644 --- a/cmd/kubeadm/app/cmd/upgrade/apply_test.go +++ b/cmd/kubeadm/app/cmd/upgrade/apply_test.go @@ -153,7 +153,7 @@ func TestSetImplicitFlags(t *testing.T) { func TestGetPathManagerForUpgrade(t *testing.T) { - haEtcd := &kubeadmapi.MasterConfiguration{ + haEtcd := &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ External: &kubeadmapi.ExternalEtcd{ Endpoints: []string{"10.100.0.1:2379", "10.100.0.2:2379", "10.100.0.3:2379"}, @@ -161,11 +161,11 @@ func TestGetPathManagerForUpgrade(t *testing.T) { }, } - noHAEtcd := &kubeadmapi.MasterConfiguration{} + noHAEtcd := &kubeadmapi.InitConfiguration{} tests := []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration etcdUpgrade bool shouldDeleteEtcd bool }{ diff --git a/cmd/kubeadm/app/cmd/upgrade/common.go b/cmd/kubeadm/app/cmd/upgrade/common.go index ec5ffbd7762..1f366c44a2e 100644 --- a/cmd/kubeadm/app/cmd/upgrade/common.go +++ b/cmd/kubeadm/app/cmd/upgrade/common.go @@ -44,7 +44,7 @@ import ( // TODO - Restructure or rename upgradeVariables type upgradeVariables struct { client clientset.Interface - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration versionGetter upgrade.VersionGetter waiter apiclient.Waiter } @@ -67,7 +67,7 @@ func enforceRequirements(flags *applyPlanFlags, dryRun bool, newK8sVersion strin cfg, err := configutil.FetchConfigFromFileOrCluster(client, os.Stdout, "upgrade/config", flags.cfgPath) if err != nil { if apierrors.IsNotFound(err) { - fmt.Printf("[upgrade/config] In order to upgrade, a ConfigMap called %q in the %s namespace must exist.\n", constants.MasterConfigurationConfigMap, metav1.NamespaceSystem) + fmt.Printf("[upgrade/config] In order to upgrade, a ConfigMap called %q in the %s namespace must exist.\n", constants.InitConfigurationConfigMap, metav1.NamespaceSystem) fmt.Println("[upgrade/config] Without this information, 'kubeadm upgrade' won't know how to configure your upgraded cluster.") fmt.Println("") fmt.Println("[upgrade/config] Next steps:") @@ -75,7 +75,7 @@ func enforceRequirements(flags *applyPlanFlags, dryRun bool, newK8sVersion strin fmt.Printf("\t- OPTION 2: Run 'kubeadm config upload from-file' and specify the same config file you passed to 'kubeadm init' when you created your master.\n") fmt.Printf("\t- OPTION 3: Pass a config file to 'kubeadm upgrade' using the --config flag.\n") fmt.Println("") - err = fmt.Errorf("the ConfigMap %q in the %s namespace used for getting configuration information was not found", constants.MasterConfigurationConfigMap, metav1.NamespaceSystem) + err = fmt.Errorf("the ConfigMap %q in the %s namespace used for getting configuration information was not found", constants.InitConfigurationConfigMap, metav1.NamespaceSystem) } return nil, fmt.Errorf("[upgrade/config] FATAL: %v", err) } @@ -109,7 +109,7 @@ func enforceRequirements(flags *applyPlanFlags, dryRun bool, newK8sVersion strin } // printConfiguration prints the external version of the API to yaml -func printConfiguration(cfg *kubeadmapi.MasterConfiguration, w io.Writer) { +func printConfiguration(cfg *kubeadmapi.InitConfiguration, w io.Writer) { // Short-circuit if cfg is nil, so we can safely get the value of the pointer below if cfg == nil { return diff --git a/cmd/kubeadm/app/cmd/upgrade/common_test.go b/cmd/kubeadm/app/cmd/upgrade/common_test.go index d01b13e7d7d..236767baf2b 100644 --- a/cmd/kubeadm/app/cmd/upgrade/common_test.go +++ b/cmd/kubeadm/app/cmd/upgrade/common_test.go @@ -25,7 +25,7 @@ import ( func TestPrintConfiguration(t *testing.T) { var tests = []struct { - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration buf *bytes.Buffer expectedBytes []byte }{ @@ -34,7 +34,7 @@ func TestPrintConfiguration(t *testing.T) { expectedBytes: []byte(""), }, { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.1", Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ @@ -57,7 +57,7 @@ func TestPrintConfiguration(t *testing.T) { dataDir: /some/path image: "" imageRepository: "" - kind: MasterConfiguration + kind: InitConfiguration kubernetesVersion: v1.7.1 networking: dnsDomain: "" @@ -68,7 +68,7 @@ func TestPrintConfiguration(t *testing.T) { `), }, { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.1", Networking: kubeadmapi.Networking{ ServiceSubnet: "10.96.0.1/12", @@ -97,7 +97,7 @@ func TestPrintConfiguration(t *testing.T) { - https://one-etcd-instance:2379 keyFile: "" imageRepository: "" - kind: MasterConfiguration + kind: InitConfiguration kubernetesVersion: v1.7.1 networking: dnsDomain: "" diff --git a/cmd/kubeadm/app/cmd/upgrade/diff.go b/cmd/kubeadm/app/cmd/upgrade/diff.go index a604c8bcbc1..c0223fedb93 100644 --- a/cmd/kubeadm/app/cmd/upgrade/diff.go +++ b/cmd/kubeadm/app/cmd/upgrade/diff.go @@ -79,7 +79,7 @@ func runDiff(flags *diffFlags, args []string) error { // If the version is specified in config file, pick up that value. glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath) - cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) if err != nil { return err } diff --git a/cmd/kubeadm/app/cmd/upgrade/plan.go b/cmd/kubeadm/app/cmd/upgrade/plan.go index 3d5893a1522..e15dc4393b5 100644 --- a/cmd/kubeadm/app/cmd/upgrade/plan.go +++ b/cmd/kubeadm/app/cmd/upgrade/plan.go @@ -63,7 +63,7 @@ func NewCmdPlan(apf *applyPlanFlags) *cobra.Command { // If the version is specified in config file, pick up that value. if flags.cfgPath != "" { glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath) - cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) kubeadmutil.CheckErr(err) if cfg.KubernetesVersion != "" { diff --git a/cmd/kubeadm/app/componentconfigs/defaults.go b/cmd/kubeadm/app/componentconfigs/defaults.go index d9c5607e98b..419f5faaf1b 100644 --- a/cmd/kubeadm/app/componentconfigs/defaults.go +++ b/cmd/kubeadm/app/componentconfigs/defaults.go @@ -33,7 +33,7 @@ const ( ) // DefaultKubeProxyConfiguration assigns default values for the kube-proxy ComponentConfig -func DefaultKubeProxyConfiguration(internalcfg *kubeadmapi.MasterConfiguration) { +func DefaultKubeProxyConfiguration(internalcfg *kubeadmapi.InitConfiguration) { // IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go // and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go. TODO: Remove this requirement when v1alpha2 is removed. externalproxycfg := &kubeproxyconfigv1alpha1.KubeProxyConfiguration{} @@ -62,7 +62,7 @@ func DefaultKubeProxyConfiguration(internalcfg *kubeadmapi.MasterConfiguration) } // DefaultKubeletConfiguration assigns default values for the kubelet ComponentConfig -func DefaultKubeletConfiguration(internalcfg *kubeadmapi.MasterConfiguration) { +func DefaultKubeletConfiguration(internalcfg *kubeadmapi.InitConfiguration) { // IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go // and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go. TODO: Remove this requirement when v1alpha2 is removed. externalkubeletcfg := &kubeletconfigv1beta1.KubeletConfiguration{} diff --git a/cmd/kubeadm/app/componentconfigs/registrations.go b/cmd/kubeadm/app/componentconfigs/registrations.go index 994b12020a0..7718d80ba83 100644 --- a/cmd/kubeadm/app/componentconfigs/registrations.go +++ b/cmd/kubeadm/app/componentconfigs/registrations.go @@ -38,15 +38,15 @@ type Registration struct { // AddToSchemeFuncs are a set of functions that register APIs to the scheme AddToSchemeFuncs []AddToSchemeFunc // DefaulterFunc is a function that based on the internal kubeadm configuration defaults the ComponentConfig struct - DefaulterFunc func(*kubeadmapi.MasterConfiguration) + DefaulterFunc func(*kubeadmapi.InitConfiguration) // ValidateFunc is a function that should validate the ComponentConfig type embedded in the internal kubeadm config struct - ValidateFunc func(*kubeadmapi.MasterConfiguration, *field.Path) field.ErrorList + ValidateFunc func(*kubeadmapi.InitConfiguration, *field.Path) field.ErrorList // EmptyValue holds a pointer to an empty struct of the internal ComponentConfig type EmptyValue runtime.Object // GetFromInternalConfig returns the pointer to the ComponentConfig API object from the internal kubeadm config struct - GetFromInternalConfig func(*kubeadmapi.MasterConfiguration) (runtime.Object, bool) + GetFromInternalConfig func(*kubeadmapi.InitConfiguration) (runtime.Object, bool) // SetToInternalConfig sets the pointer to a ComponentConfig API object embedded in the internal kubeadm config struct - SetToInternalConfig func(runtime.Object, *kubeadmapi.MasterConfiguration) bool + SetToInternalConfig func(runtime.Object, *kubeadmapi.InitConfiguration) bool } // Marshal marshals obj to bytes for the current Registration @@ -89,10 +89,10 @@ var Known Registrations = map[RegistrationKind]Registration{ DefaulterFunc: DefaultKubeProxyConfiguration, ValidateFunc: ValidateKubeProxyConfiguration, EmptyValue: &kubeproxyconfig.KubeProxyConfiguration{}, - GetFromInternalConfig: func(cfg *kubeadmapi.MasterConfiguration) (runtime.Object, bool) { + GetFromInternalConfig: func(cfg *kubeadmapi.InitConfiguration) (runtime.Object, bool) { return cfg.ComponentConfigs.KubeProxy, cfg.ComponentConfigs.KubeProxy != nil }, - SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.MasterConfiguration) bool { + SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.InitConfiguration) bool { kubeproxyConfig, ok := obj.(*kubeproxyconfig.KubeProxyConfiguration) if ok { cfg.ComponentConfigs.KubeProxy = kubeproxyConfig @@ -106,10 +106,10 @@ var Known Registrations = map[RegistrationKind]Registration{ DefaulterFunc: DefaultKubeletConfiguration, ValidateFunc: ValidateKubeletConfiguration, EmptyValue: &kubeletconfig.KubeletConfiguration{}, - GetFromInternalConfig: func(cfg *kubeadmapi.MasterConfiguration) (runtime.Object, bool) { + GetFromInternalConfig: func(cfg *kubeadmapi.InitConfiguration) (runtime.Object, bool) { return cfg.ComponentConfigs.Kubelet, cfg.ComponentConfigs.Kubelet != nil }, - SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.MasterConfiguration) bool { + SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.InitConfiguration) bool { kubeletConfig, ok := obj.(*kubeletconfig.KubeletConfiguration) if ok { cfg.ComponentConfigs.Kubelet = kubeletConfig @@ -132,14 +132,14 @@ func (rs *Registrations) AddToScheme(scheme *runtime.Scheme) error { } // Default applies to the ComponentConfig defaults to the internal kubeadm API type -func (rs *Registrations) Default(internalcfg *kubeadmapi.MasterConfiguration) { +func (rs *Registrations) Default(internalcfg *kubeadmapi.InitConfiguration) { for _, registration := range *rs { registration.DefaulterFunc(internalcfg) } } // Validate validates the ComponentConfig parts of the internal kubeadm API type -func (rs *Registrations) Validate(internalcfg *kubeadmapi.MasterConfiguration) field.ErrorList { +func (rs *Registrations) Validate(internalcfg *kubeadmapi.InitConfiguration) field.ErrorList { allErrs := field.ErrorList{} for kind, registration := range *rs { allErrs = append(allErrs, registration.ValidateFunc(internalcfg, field.NewPath(string(kind)))...) diff --git a/cmd/kubeadm/app/componentconfigs/validation.go b/cmd/kubeadm/app/componentconfigs/validation.go index d15f6f8b9ec..2aa508a8962 100644 --- a/cmd/kubeadm/app/componentconfigs/validation.go +++ b/cmd/kubeadm/app/componentconfigs/validation.go @@ -24,7 +24,7 @@ import ( ) // ValidateKubeProxyConfiguration validates proxy configuration and collects all encountered errors -func ValidateKubeProxyConfiguration(internalcfg *kubeadmapi.MasterConfiguration, _ *field.Path) field.ErrorList { +func ValidateKubeProxyConfiguration(internalcfg *kubeadmapi.InitConfiguration, _ *field.Path) field.ErrorList { allErrs := field.ErrorList{} if internalcfg.ComponentConfigs.KubeProxy == nil { return allErrs @@ -33,7 +33,7 @@ func ValidateKubeProxyConfiguration(internalcfg *kubeadmapi.MasterConfiguration, } // ValidateKubeletConfiguration validates kubelet configuration and collects all encountered errors -func ValidateKubeletConfiguration(internalcfg *kubeadmapi.MasterConfiguration, fldPath *field.Path) field.ErrorList { +func ValidateKubeletConfiguration(internalcfg *kubeadmapi.InitConfiguration, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} if internalcfg.ComponentConfigs.Kubelet == nil { return allErrs diff --git a/cmd/kubeadm/app/componentconfigs/validation_test.go b/cmd/kubeadm/app/componentconfigs/validation_test.go index 8e76614f4e4..56dc02b5ad3 100644 --- a/cmd/kubeadm/app/componentconfigs/validation_test.go +++ b/cmd/kubeadm/app/componentconfigs/validation_test.go @@ -30,12 +30,12 @@ import ( func TestValidateKubeProxyConfiguration(t *testing.T) { var tests = []struct { - masterConfig *kubeadm.MasterConfiguration + masterConfig *kubeadm.InitConfiguration msg string expectErr bool }{ { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "192.168.59.103", @@ -66,7 +66,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: false, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ // only BindAddress is invalid @@ -99,7 +99,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: true, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "10.10.12.11", @@ -132,7 +132,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: true, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "10.10.12.11", @@ -165,7 +165,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: true, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "10.10.12.11", @@ -198,7 +198,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: true, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "10.10.12.11", @@ -231,7 +231,7 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { expectErr: true, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{ BindAddress: "10.10.12.11", @@ -277,11 +277,11 @@ func TestValidateKubeProxyConfiguration(t *testing.T) { func TestValidateKubeletConfiguration(t *testing.T) { var tests = []struct { - masterConfig *kubeadm.MasterConfiguration + masterConfig *kubeadm.InitConfiguration expectErr bool }{ { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ Kubelet: &kubeletconfig.KubeletConfiguration{ CgroupsPerQOS: true, @@ -312,7 +312,7 @@ func TestValidateKubeletConfiguration(t *testing.T) { expectErr: false, }, { - masterConfig: &kubeadm.MasterConfiguration{ + masterConfig: &kubeadm.InitConfiguration{ ComponentConfigs: kubeadm.ComponentConfigs{ Kubelet: &kubeletconfig.KubeletConfiguration{ CgroupsPerQOS: false, diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index f23ae929c32..16ef56e7575 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -186,11 +186,11 @@ const ( // init/join time for use later. kubeadm annotates the node object with this information AnnotationKubeadmCRISocket = "kubeadm.alpha.kubernetes.io/cri-socket" - // MasterConfigurationConfigMap specifies in what ConfigMap in the kube-system namespace the `kubeadm init` configuration should be stored - MasterConfigurationConfigMap = "kubeadm-config" + // InitConfigurationConfigMap specifies in what ConfigMap in the kube-system namespace the `kubeadm init` configuration should be stored + InitConfigurationConfigMap = "kubeadm-config" - // MasterConfigurationConfigMapKey specifies in what ConfigMap key the master configuration should be stored - MasterConfigurationConfigMapKey = "MasterConfiguration" + // InitConfigurationConfigMapKey specifies in what ConfigMap key the master configuration should be stored + InitConfigurationConfigMapKey = "InitConfiguration" // KubeletBaseConfigurationConfigMapPrefix specifies in what ConfigMap in the kube-system namespace the initial remote configuration of kubelet should be stored KubeletBaseConfigurationConfigMapPrefix = "kubelet-config-" @@ -286,10 +286,10 @@ const ( // CoreDNSVersion is the version of CoreDNS to be deployed if it is used CoreDNSVersion = "1.1.3" - // MasterConfigurationKind is the string kind value for the MasterConfiguration struct - MasterConfigurationKind = "MasterConfiguration" + // InitConfigurationKind is the string kind value for the InitConfiguration struct + InitConfigurationKind = "InitConfiguration" - // NodeConfigurationKind is the string kind value for the MasterConfiguration struct + // NodeConfigurationKind is the string kind value for the InitConfiguration struct NodeConfigurationKind = "NodeConfiguration" // YAMLDocumentSeparator is the separator for YAML documents diff --git a/cmd/kubeadm/app/images/images.go b/cmd/kubeadm/app/images/images.go index 0b700a539eb..c98ddedcced 100644 --- a/cmd/kubeadm/app/images/images.go +++ b/cmd/kubeadm/app/images/images.go @@ -37,14 +37,14 @@ func GetGenericArchImage(prefix, image, tag string) string { } // GetKubeControlPlaneImageNoOverride generates and returns the image for the core Kubernetes components ignoring the unified control plane image -func GetKubeControlPlaneImageNoOverride(image string, cfg *kubeadmapi.MasterConfiguration) string { +func GetKubeControlPlaneImageNoOverride(image string, cfg *kubeadmapi.InitConfiguration) string { repoPrefix := cfg.GetControlPlaneImageRepository() kubernetesImageTag := kubeadmutil.KubernetesVersionToImageTag(cfg.KubernetesVersion) return GetGenericArchImage(repoPrefix, image, kubernetesImageTag) } // GetKubeControlPlaneImage generates and returns the image for the core Kubernetes components or returns the unified control plane image if specified -func GetKubeControlPlaneImage(image string, cfg *kubeadmapi.MasterConfiguration) string { +func GetKubeControlPlaneImage(image string, cfg *kubeadmapi.InitConfiguration) string { if cfg.UnifiedControlPlaneImage != "" { return cfg.UnifiedControlPlaneImage } @@ -52,7 +52,7 @@ func GetKubeControlPlaneImage(image string, cfg *kubeadmapi.MasterConfiguration) } // GetEtcdImage generates and returns the image for etcd or returns cfg.Etcd.Local.Image if specified -func GetEtcdImage(cfg *kubeadmapi.MasterConfiguration) string { +func GetEtcdImage(cfg *kubeadmapi.InitConfiguration) string { if cfg.Etcd.Local != nil && cfg.Etcd.Local.Image != "" { return cfg.Etcd.Local.Image } @@ -65,7 +65,7 @@ func GetEtcdImage(cfg *kubeadmapi.MasterConfiguration) string { } // GetAllImages returns a list of container images kubeadm expects to use on a control plane node -func GetAllImages(cfg *kubeadmapi.MasterConfiguration) []string { +func GetAllImages(cfg *kubeadmapi.InitConfiguration) []string { imgs := []string{} imgs = append(imgs, GetKubeControlPlaneImage(constants.KubeAPIServer, cfg)) imgs = append(imgs, GetKubeControlPlaneImage(constants.KubeControllerManager, cfg)) diff --git a/cmd/kubeadm/app/images/images_test.go b/cmd/kubeadm/app/images/images_test.go index 3da101d7d8d..3fa82714659 100644 --- a/cmd/kubeadm/app/images/images_test.go +++ b/cmd/kubeadm/app/images/images_test.go @@ -49,13 +49,13 @@ func TestGetKubeControlPlaneImageNoOverride(t *testing.T) { var tests = []struct { image string expected string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration }{ { // UnifiedControlPlaneImage should be ignored by GetKubeImage image: constants.KubeAPIServer, expected: GetGenericArchImage(gcrPrefix, "kube-apiserver", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ UnifiedControlPlaneImage: "nooverride", ImageRepository: gcrPrefix, KubernetesVersion: testversion, @@ -64,7 +64,7 @@ func TestGetKubeControlPlaneImageNoOverride(t *testing.T) { { image: constants.KubeAPIServer, expected: GetGenericArchImage(gcrPrefix, "kube-apiserver", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -72,7 +72,7 @@ func TestGetKubeControlPlaneImageNoOverride(t *testing.T) { { image: constants.KubeControllerManager, expected: GetGenericArchImage(gcrPrefix, "kube-controller-manager", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -80,7 +80,7 @@ func TestGetKubeControlPlaneImageNoOverride(t *testing.T) { { image: constants.KubeScheduler, expected: GetGenericArchImage(gcrPrefix, "kube-scheduler", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -102,18 +102,18 @@ func TestGetKubeControlPlaneImage(t *testing.T) { var tests = []struct { image string expected string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration }{ { expected: "override", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ UnifiedControlPlaneImage: "override", }, }, { image: constants.KubeAPIServer, expected: GetGenericArchImage(gcrPrefix, "kube-apiserver", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -121,7 +121,7 @@ func TestGetKubeControlPlaneImage(t *testing.T) { { image: constants.KubeControllerManager, expected: GetGenericArchImage(gcrPrefix, "kube-controller-manager", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -129,7 +129,7 @@ func TestGetKubeControlPlaneImage(t *testing.T) { { image: constants.KubeScheduler, expected: GetGenericArchImage(gcrPrefix, "kube-scheduler", expected), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -150,11 +150,11 @@ func TestGetKubeControlPlaneImage(t *testing.T) { func TestGetEtcdImage(t *testing.T) { var tests = []struct { expected string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration }{ { expected: "override", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ Image: "override", @@ -164,7 +164,7 @@ func TestGetEtcdImage(t *testing.T) { }, { expected: GetGenericArchImage(gcrPrefix, "etcd", constants.DefaultEtcdVersion), - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, }, @@ -185,26 +185,26 @@ func TestGetEtcdImage(t *testing.T) { func TestGetAllImages(t *testing.T) { testcases := []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expect string }{ { name: "defined CIImageRepository", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ CIImageRepository: "test.repo", }, expect: "test.repo", }, { name: "undefined CIImagerRepository should contain the default image prefix", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ImageRepository: "real.repo", }, expect: "real.repo", }, { name: "test that etcd is returned when it is not external", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{}, }, diff --git a/cmd/kubeadm/app/phases/addons/dns/dns.go b/cmd/kubeadm/app/phases/addons/dns/dns.go index 50c2577e149..87b620e8767 100644 --- a/cmd/kubeadm/app/phases/addons/dns/dns.go +++ b/cmd/kubeadm/app/phases/addons/dns/dns.go @@ -70,14 +70,14 @@ func DeployedDNSAddon(client clientset.Interface) (string, string, error) { } // EnsureDNSAddon creates the kube-dns or CoreDNS addon -func EnsureDNSAddon(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func EnsureDNSAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { if features.Enabled(cfg.FeatureGates, features.CoreDNS) { return coreDNSAddon(cfg, client) } return kubeDNSAddon(cfg, client) } -func kubeDNSAddon(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func kubeDNSAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { if err := CreateServiceAccount(client); err != nil { return err } @@ -150,7 +150,7 @@ func createKubeDNSAddon(deploymentBytes, serviceBytes []byte, client clientset.I return createDNSService(kubednsService, serviceBytes, client) } -func coreDNSAddon(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func coreDNSAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { // Get the YAML manifest coreDNSDeploymentBytes, err := kubeadmutil.ParseTemplate(CoreDNSDeployment, struct{ ImageRepository, MasterTaintKey, Version string }{ ImageRepository: cfg.ImageRepository, diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy.go b/cmd/kubeadm/app/phases/addons/proxy/proxy.go index 0762aa7877b..3db1d91cd67 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy.go @@ -45,7 +45,7 @@ const ( ) // EnsureProxyAddon creates the kube-proxy addons -func EnsureProxyAddon(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func EnsureProxyAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { if err := CreateServiceAccount(client); err != nil { return fmt.Errorf("error when creating kube-proxy service account: %v", err) } diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go index 41675f25e28..94c077113c2 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go @@ -174,7 +174,7 @@ func TestEnsureProxyAddon(t *testing.T) { // Create a fake client and set up default test configuration client := clientsetfake.NewSimpleClientset() // TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs - masterConfig := &kubeadmapiv1alpha3.MasterConfiguration{ + masterConfig := &kubeadmapiv1alpha3.InitConfiguration{ API: kubeadmapiv1alpha3.API{ AdvertiseAddress: "1.2.3.4", BindPort: 1234, diff --git a/cmd/kubeadm/app/phases/certs/certs.go b/cmd/kubeadm/app/phases/certs/certs.go index 14a3d43bbe8..e4cbb54735c 100644 --- a/cmd/kubeadm/app/phases/certs/certs.go +++ b/cmd/kubeadm/app/phases/certs/certs.go @@ -33,9 +33,9 @@ import ( // CreatePKIAssets will create and write to disk all PKI assets necessary to establish the control plane. // If the PKI assets already exists in the target folder, they are used only if evaluated equal; otherwise an error is returned. -func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) error { +func CreatePKIAssets(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating PKI assets") - certActions := []func(cfg *kubeadmapi.MasterConfiguration) error{ + certActions := []func(cfg *kubeadmapi.InitConfiguration) error{ CreateCACertAndKeyFiles, CreateAPIServerCertAndKeyFiles, CreateAPIServerKubeletClientCertAndKeyFiles, @@ -43,7 +43,7 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) error { CreateFrontProxyCACertAndKeyFiles, CreateFrontProxyClientCertAndKeyFiles, } - etcdCertActions := []func(cfg *kubeadmapi.MasterConfiguration) error{ + etcdCertActions := []func(cfg *kubeadmapi.InitConfiguration) error{ CreateEtcdCACertAndKeyFiles, CreateEtcdServerCertAndKeyFiles, CreateEtcdPeerCertAndKeyFiles, @@ -69,7 +69,7 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) error { // CreateCACertAndKeyFiles create a new self signed cluster CA certificate and key files. // If the CA certificate and key files already exists in the target folder, they are used only if evaluated equal; otherwise an error is returned. -func CreateCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateCACertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("create a new self signed cluster CA certificate and key files") caCert, caKey, err := NewCACertAndKey() if err != nil { @@ -87,7 +87,7 @@ func CreateCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { // CreateAPIServerCertAndKeyFiles create a new certificate and key files for the apiserver. // If the apiserver certificate and key files already exists in the target folder, they are used only if evaluated equal; otherwise an error is returned. // It assumes the cluster CA certificate and key files exist in the CertificatesDir. -func CreateAPIServerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateAPIServerCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new certificate and key files for the apiserver") caCert, caKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName) if err != nil { @@ -111,7 +111,7 @@ func CreateAPIServerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { // CreateAPIServerKubeletClientCertAndKeyFiles create a new certificate for kubelets calling apiserver. // If the apiserver-kubelet-client certificate and key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned. // It assumes the cluster CA certificate and key files exist in the CertificatesDir. -func CreateAPIServerKubeletClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateAPIServerKubeletClientCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new certificate for kubelets calling apiserver") caCert, caKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName) if err != nil { @@ -136,7 +136,7 @@ func CreateAPIServerKubeletClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfigura // The etcd CA and client certs are used to secure communication between etcd peers and connections to etcd from the API server. // This is a separate CA, so that kubernetes client identities cannot connect to etcd directly or peer with the etcd cluster. // If the etcd CA certificate and key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned. -func CreateEtcdCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateEtcdCACertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a self signed etcd CA certificate and key files") etcdCACert, etcdCAKey, err := NewEtcdCACertAndKey() if err != nil { @@ -154,7 +154,7 @@ func CreateEtcdCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { // CreateEtcdServerCertAndKeyFiles create a new certificate and key file for etcd. // If the etcd serving certificate and key file already exist in the target folder, they are used only if evaluated equal; otherwise an error is returned. // It assumes the etcd CA certificate and key file exist in the CertificatesDir -func CreateEtcdServerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateEtcdServerCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new server certificate and key files for etcd") etcdCACert, etcdCAKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.EtcdCACertAndKeyBaseName) if err != nil { @@ -178,7 +178,7 @@ func CreateEtcdServerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error // CreateEtcdPeerCertAndKeyFiles create a new certificate and key file for etcd peering. // If the etcd peer certificate and key file already exist in the target folder, they are used only if evaluated equal; otherwise an error is returned. // It assumes the etcd CA certificate and key file exist in the CertificatesDir -func CreateEtcdPeerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateEtcdPeerCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new certificate and key files for etcd peering") etcdCACert, etcdCAKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.EtcdCACertAndKeyBaseName) if err != nil { @@ -202,7 +202,7 @@ func CreateEtcdPeerCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { // CreateEtcdHealthcheckClientCertAndKeyFiles create a new client certificate for liveness probes to healthcheck etcd // If the etcd-healthcheck-client certificate and key file already exist in the target folder, they are used only if evaluated equal; otherwise an error is returned. // It assumes the etcd CA certificate and key file exist in the CertificatesDir -func CreateEtcdHealthcheckClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateEtcdHealthcheckClientCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { etcdCACert, etcdCAKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.EtcdCACertAndKeyBaseName) if err != nil { @@ -226,7 +226,7 @@ func CreateEtcdHealthcheckClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfigurat // CreateAPIServerEtcdClientCertAndKeyFiles create a new client certificate for the apiserver calling etcd // If the apiserver-etcd-client certificate and key file already exist in the target folder, they are used only if evaluated equal; otherwise an error is returned. // It assumes the etcd CA certificate and key file exist in the CertificatesDir -func CreateAPIServerEtcdClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateAPIServerEtcdClientCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new client certificate for the apiserver calling etcd") etcdCACert, etcdCAKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.EtcdCACertAndKeyBaseName) if err != nil { @@ -249,7 +249,7 @@ func CreateAPIServerEtcdClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguratio // CreateServiceAccountKeyAndPublicKeyFiles create a new public/private key files for signing service account users. // If the sa public/private key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned. -func CreateServiceAccountKeyAndPublicKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateServiceAccountKeyAndPublicKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new public/private key files for signing service account users") saSigningKey, err := NewServiceAccountSigningKey() if err != nil { @@ -268,7 +268,7 @@ func CreateServiceAccountKeyAndPublicKeyFiles(cfg *kubeadmapi.MasterConfiguratio // without the client cert; This is a separate CA, so that front proxy identities cannot hit the API and normal client certs cannot be used // as front proxies. // If the front proxy CA certificate and key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned. -func CreateFrontProxyCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateFrontProxyCACertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a self signed front proxy CA certificate and key files") frontProxyCACert, frontProxyCAKey, err := NewFrontProxyCACertAndKey() if err != nil { @@ -286,7 +286,7 @@ func CreateFrontProxyCACertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) erro // CreateFrontProxyClientCertAndKeyFiles create a new certificate for proxy server client. // If the front-proxy-client certificate and key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned. // It assumes the front proxy CA certificate and key files exist in the CertificatesDir. -func CreateFrontProxyClientCertAndKeyFiles(cfg *kubeadmapi.MasterConfiguration) error { +func CreateFrontProxyClientCertAndKeyFiles(cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a new certificate for proxy server client") frontProxyCACert, frontProxyCAKey, err := loadCertificateAuthority(cfg.CertificatesDir, kubeadmconstants.FrontProxyCACertAndKeyBaseName) if err != nil { @@ -319,7 +319,7 @@ func NewCACertAndKey() (*x509.Certificate, *rsa.PrivateKey, error) { } // NewAPIServerCertAndKey generate certificate for apiserver, signed by the given CA. -func NewAPIServerCertAndKey(cfg *kubeadmapi.MasterConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { +func NewAPIServerCertAndKey(cfg *kubeadmapi.InitConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { altNames, err := pkiutil.GetAPIServerAltNames(cfg) if err != nil { @@ -367,7 +367,7 @@ func NewEtcdCACertAndKey() (*x509.Certificate, *rsa.PrivateKey, error) { } // NewEtcdServerCertAndKey generate certificate for etcd, signed by the given CA. -func NewEtcdServerCertAndKey(cfg *kubeadmapi.MasterConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { +func NewEtcdServerCertAndKey(cfg *kubeadmapi.InitConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { altNames, err := pkiutil.GetEtcdAltNames(cfg) if err != nil { @@ -392,7 +392,7 @@ func NewEtcdServerCertAndKey(cfg *kubeadmapi.MasterConfiguration, caCert *x509.C } // NewEtcdPeerCertAndKey generate certificate for etcd peering, signed by the given CA. -func NewEtcdPeerCertAndKey(cfg *kubeadmapi.MasterConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { +func NewEtcdPeerCertAndKey(cfg *kubeadmapi.InitConfiguration, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey, error) { altNames, err := pkiutil.GetEtcdPeerAltNames(cfg) if err != nil { @@ -624,7 +624,7 @@ type certKeyLocation struct { // UsingExternalCA determines whether the user is relying on an external CA. We currently implicitly determine this is the case // when both the CA Cert and the front proxy CA Cert are present but the CA Key and front proxy CA Key are not. // This allows us to, e.g., skip generating certs or not start the csr signing controller. -func UsingExternalCA(cfg *kubeadmapi.MasterConfiguration) (bool, error) { +func UsingExternalCA(cfg *kubeadmapi.InitConfiguration) (bool, error) { if err := validateCACert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, "", "CA"}); err != nil { return false, err diff --git a/cmd/kubeadm/app/phases/certs/certs_test.go b/cmd/kubeadm/app/phases/certs/certs_test.go index f3db29c11c6..ca630029128 100644 --- a/cmd/kubeadm/app/phases/certs/certs_test.go +++ b/cmd/kubeadm/app/phases/certs/certs_test.go @@ -272,7 +272,7 @@ func TestNewAPIServerCertAndKey(t *testing.T) { advertiseAddresses := []string{"1.2.3.4", "1:2:3::4"} for _, addr := range advertiseAddresses { - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: addr}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: hostname}, @@ -323,7 +323,7 @@ func TestNewEtcdServerCertAndKey(t *testing.T) { proxy := "user-etcd-proxy" proxyIP := "10.10.10.100" - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ NodeRegistration: kubeadmapi.NodeRegistrationOptions{ Name: "etcd-server-cert", }, @@ -359,7 +359,7 @@ func TestNewEtcdPeerCertAndKey(t *testing.T) { advertiseAddresses := []string{"1.2.3.4", "1:2:3::4"} for _, addr := range advertiseAddresses { - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: addr}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: hostname}, Etcd: kubeadmapi.Etcd{ @@ -460,17 +460,17 @@ func TestNewFrontProxyClientCertAndKey(t *testing.T) { func TestUsingExternalCA(t *testing.T) { tests := []struct { - setupFuncs []func(cfg *kubeadmapi.MasterConfiguration) error + setupFuncs []func(cfg *kubeadmapi.InitConfiguration) error expected bool }{ { - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreatePKIAssets, }, expected: false, }, { - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreatePKIAssets, deleteCAKey, deleteFrontProxyCAKey, @@ -483,7 +483,7 @@ func TestUsingExternalCA(t *testing.T) { dir := testutil.SetupTempDir(t) defer os.RemoveAll(dir) - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-hostname"}, @@ -506,14 +506,14 @@ func TestValidateMethods(t *testing.T) { tests := []struct { name string - setupFuncs []func(cfg *kubeadmapi.MasterConfiguration) error + setupFuncs []func(cfg *kubeadmapi.InitConfiguration) error validateFunc func(l certKeyLocation) error loc certKeyLocation expectedSuccess bool }{ { name: "validateCACert", - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreateCACertAndKeyFiles, }, validateFunc: validateCACert, @@ -522,7 +522,7 @@ func TestValidateMethods(t *testing.T) { }, { name: "validateCACertAndKey (files present)", - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreateCACertAndKeyFiles, }, validateFunc: validateCACertAndKey, @@ -531,7 +531,7 @@ func TestValidateMethods(t *testing.T) { }, { name: "validateCACertAndKey (key missing)", - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreatePKIAssets, deleteCAKey, }, @@ -541,7 +541,7 @@ func TestValidateMethods(t *testing.T) { }, { name: "validateSignedCert", - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreateCACertAndKeyFiles, CreateAPIServerCertAndKeyFiles, }, @@ -551,7 +551,7 @@ func TestValidateMethods(t *testing.T) { }, { name: "validatePrivatePublicKey", - setupFuncs: []func(cfg *kubeadmapi.MasterConfiguration) error{ + setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreateServiceAccountKeyAndPublicKeyFiles, }, validateFunc: validatePrivatePublicKey, @@ -566,7 +566,7 @@ func TestValidateMethods(t *testing.T) { defer os.RemoveAll(dir) test.loc.pkiDir = dir - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-hostname"}, @@ -590,14 +590,14 @@ func TestValidateMethods(t *testing.T) { } } -func deleteCAKey(cfg *kubeadmapi.MasterConfiguration) error { +func deleteCAKey(cfg *kubeadmapi.InitConfiguration) error { if err := os.Remove(filepath.Join(cfg.CertificatesDir, kubeadmconstants.CAKeyName)); err != nil { return fmt.Errorf("failed removing %s: %v", kubeadmconstants.CAKeyName, err) } return nil } -func deleteFrontProxyCAKey(cfg *kubeadmapi.MasterConfiguration) error { +func deleteFrontProxyCAKey(cfg *kubeadmapi.InitConfiguration) error { if err := os.Remove(filepath.Join(cfg.CertificatesDir, kubeadmconstants.FrontProxyCAKeyName)); err != nil { return fmt.Errorf("failed removing %s: %v", kubeadmconstants.FrontProxyCAKeyName, err) } @@ -607,8 +607,8 @@ func deleteFrontProxyCAKey(cfg *kubeadmapi.MasterConfiguration) error { func TestCreateCertificateFilesMethods(t *testing.T) { var tests = []struct { - setupFunc func(cfg *kubeadmapi.MasterConfiguration) error - createFunc func(cfg *kubeadmapi.MasterConfiguration) error + setupFunc func(cfg *kubeadmapi.InitConfiguration) error + createFunc func(cfg *kubeadmapi.InitConfiguration) error expectedFiles []string externalEtcd bool }{ @@ -698,7 +698,7 @@ func TestCreateCertificateFilesMethods(t *testing.T) { tmpdir := testutil.SetupTempDir(t) defer os.RemoveAll(tmpdir) - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Etcd: kubeadmapi.Etcd{Local: &kubeadmapi.LocalEtcd{}}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, diff --git a/cmd/kubeadm/app/phases/certs/doc.go b/cmd/kubeadm/app/phases/certs/doc.go index 6f9801fd513..eea475c910c 100644 --- a/cmd/kubeadm/app/phases/certs/doc.go +++ b/cmd/kubeadm/app/phases/certs/doc.go @@ -21,7 +21,7 @@ package certs PHASE: CERTIFICATES INPUTS: - From MasterConfiguration + From InitConfiguration .API.AdvertiseAddress is an optional parameter that can be passed for an extra addition to the SAN IPs .APIServerCertSANs is an optional parameter for adding DNS names and IPs to the API Server serving cert SAN .Etcd.Local.ServerCertSANs is an optional parameter for adding DNS names and IPs to the etcd serving cert SAN diff --git a/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go b/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go index e1d456b395f..eb55d45aa36 100644 --- a/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go +++ b/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go @@ -254,7 +254,7 @@ func pathForPublicKey(pkiPath, name string) string { } // GetAPIServerAltNames builds an AltNames object for to be used when generating apiserver certificate -func GetAPIServerAltNames(cfg *kubeadmapi.MasterConfiguration) (*certutil.AltNames, error) { +func GetAPIServerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) { // advertise address advertiseAddress := net.ParseIP(cfg.API.AdvertiseAddress) if advertiseAddress == nil { @@ -309,7 +309,7 @@ func GetAPIServerAltNames(cfg *kubeadmapi.MasterConfiguration) (*certutil.AltNam // `localhost` is included in the SAN since this is the interface the etcd static pod listens on. // Hostname and `API.AdvertiseAddress` are excluded since etcd does not listen on this interface by default. // The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.ServerCertSANs`. -func GetEtcdAltNames(cfg *kubeadmapi.MasterConfiguration) (*certutil.AltNames, error) { +func GetEtcdAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) { // create AltNames with defaults DNSNames/IPs altNames := &certutil.AltNames{ DNSNames: []string{cfg.NodeRegistration.Name, "localhost"}, @@ -327,7 +327,7 @@ func GetEtcdAltNames(cfg *kubeadmapi.MasterConfiguration) (*certutil.AltNames, e // `localhost` is excluded from the SAN since etcd will not refer to itself as a peer. // Hostname and `API.AdvertiseAddress` are included if the user chooses to promote the single node etcd cluster into a multi-node one. // The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.PeerCertSANs`. -func GetEtcdPeerAltNames(cfg *kubeadmapi.MasterConfiguration) (*certutil.AltNames, error) { +func GetEtcdPeerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) { // advertise address advertiseAddress := net.ParseIP(cfg.API.AdvertiseAddress) if advertiseAddress == nil { diff --git a/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers_test.go b/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers_test.go index cc2a5cb3790..46358cc85e7 100644 --- a/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers_test.go +++ b/cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers_test.go @@ -439,13 +439,13 @@ func TestGetAPIServerAltNames(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expectedDNSNames []string expectedIPAddresses []string }{ { name: "ControlPlaneEndpoint DNS", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", ControlPlaneEndpoint: "api.k8s.io:6443"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-hostname"}, @@ -456,7 +456,7 @@ func TestGetAPIServerAltNames(t *testing.T) { }, { name: "ControlPlaneEndpoint IP", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", ControlPlaneEndpoint: "4.5.6.7:6443"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-hostname"}, @@ -506,7 +506,7 @@ func TestGetAPIServerAltNames(t *testing.T) { func TestGetEtcdAltNames(t *testing.T) { proxy := "user-etcd-proxy" proxyIP := "10.10.10.100" - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ServerCertSANs: []string{ @@ -560,7 +560,7 @@ func TestGetEtcdPeerAltNames(t *testing.T) { proxy := "user-etcd-proxy" proxyIP := "10.10.10.100" advertiseIP := "1.2.3.4" - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: advertiseIP}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: hostname}, Etcd: kubeadmapi.Etcd{ diff --git a/cmd/kubeadm/app/phases/controlplane/manifests.go b/cmd/kubeadm/app/phases/controlplane/manifests.go index 3f1fce4196e..8ad4ddbbcff 100644 --- a/cmd/kubeadm/app/phases/controlplane/manifests.go +++ b/cmd/kubeadm/app/phases/controlplane/manifests.go @@ -40,32 +40,32 @@ import ( ) // CreateInitStaticPodManifestFiles will write all static pod manifest files needed to bring up the control plane. -func CreateInitStaticPodManifestFiles(manifestDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateInitStaticPodManifestFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("[controlplane] creating static pod files") return createStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeControllerManager, kubeadmconstants.KubeScheduler) } // CreateAPIServerStaticPodManifestFile will write APIserver static pod manifest file. -func CreateAPIServerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateAPIServerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating APIserver static pod files") return createStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeAPIServer) } // CreateControllerManagerStaticPodManifestFile will write controller manager static pod manifest file. -func CreateControllerManagerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateControllerManagerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating controller manager static pod files") return createStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeControllerManager) } // CreateSchedulerStaticPodManifestFile will write scheduler static pod manifest file. -func CreateSchedulerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateSchedulerStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating scheduler static pod files") return createStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeScheduler) } -// GetStaticPodSpecs returns all staticPodSpecs actualized to the context of the current MasterConfiguration +// GetStaticPodSpecs returns all staticPodSpecs actualized to the context of the current InitConfiguration // NB. this methods holds the information about how kubeadm creates static pod manifests. -func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.Version) map[string]v1.Pod { +func GetStaticPodSpecs(cfg *kubeadmapi.InitConfiguration, k8sVersion *version.Version) map[string]v1.Pod { // Get the required hostpath mounts mounts := getHostPathVolumesForTheControlPlane(cfg) @@ -106,14 +106,14 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version. } // createStaticPodFiles creates all the requested static pod files. -func createStaticPodFiles(manifestDir string, cfg *kubeadmapi.MasterConfiguration, componentNames ...string) error { +func createStaticPodFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration, componentNames ...string) error { // TODO: Move the "pkg/util/version".Version object into the internal API instead of always parsing the string k8sVersion, err := version.ParseSemantic(cfg.KubernetesVersion) if err != nil { return err } - // gets the StaticPodSpecs, actualized for the current MasterConfiguration + // gets the StaticPodSpecs, actualized for the current InitConfiguration glog.V(1).Infoln("[controlplane] getting StaticPodSpecs") specs := GetStaticPodSpecs(cfg, k8sVersion) @@ -137,7 +137,7 @@ func createStaticPodFiles(manifestDir string, cfg *kubeadmapi.MasterConfiguratio } // getAPIServerCommand builds the right API server command from the given config object and version -func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration) []string { +func getAPIServerCommand(cfg *kubeadmapi.InitConfiguration) []string { defaultArguments := map[string]string{ "advertise-address": cfg.API.AdvertiseAddress, "insecure-port": "0", @@ -274,7 +274,7 @@ func calcNodeCidrSize(podSubnet string) string { } // getControllerManagerCommand builds the right controller manager command from the given config object and version -func getControllerManagerCommand(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.Version) []string { +func getControllerManagerCommand(cfg *kubeadmapi.InitConfiguration, k8sVersion *version.Version) []string { defaultArguments := map[string]string{ "address": "127.0.0.1", "leader-elect": "true", @@ -310,7 +310,7 @@ func getControllerManagerCommand(cfg *kubeadmapi.MasterConfiguration, k8sVersion } // getSchedulerCommand builds the right scheduler command from the given config object and version -func getSchedulerCommand(cfg *kubeadmapi.MasterConfiguration) []string { +func getSchedulerCommand(cfg *kubeadmapi.InitConfiguration) []string { defaultArguments := map[string]string{ "address": "127.0.0.1", "leader-elect": "true", diff --git a/cmd/kubeadm/app/phases/controlplane/manifests_test.go b/cmd/kubeadm/app/phases/controlplane/manifests_test.go index c7bab62fc0b..3e7c115645a 100644 --- a/cmd/kubeadm/app/phases/controlplane/manifests_test.go +++ b/cmd/kubeadm/app/phases/controlplane/manifests_test.go @@ -45,7 +45,7 @@ const ( func TestGetStaticPodSpecs(t *testing.T) { // Creates a Master Configuration - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.9.0", } @@ -89,7 +89,7 @@ func TestGetStaticPodSpecs(t *testing.T) { func TestCreateStaticPodFilesAndWrappers(t *testing.T) { var tests = []struct { - createStaticPodFunction func(outDir string, cfg *kubeadmapi.MasterConfiguration) error + createStaticPodFunction func(outDir string, cfg *kubeadmapi.InitConfiguration) error expectedFiles []string }{ { // CreateInitStaticPodManifestFiles @@ -117,7 +117,7 @@ func TestCreateStaticPodFilesAndWrappers(t *testing.T) { defer os.RemoveAll(tmpdir) // Creates a Master Configuration - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.9.0", } @@ -141,12 +141,12 @@ func TestCreateStaticPodFilesAndWrappers(t *testing.T) { func TestGetAPIServerCommand(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expected []string }{ { name: "testing defaults", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -183,7 +183,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "ignores the audit policy if the feature gate is not enabled", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "4.3.2.1"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -225,7 +225,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "ipv6 advertise address", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -262,7 +262,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "an external etcd with custom ca, certs and keys", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, FeatureGates: map[string]bool{features.HighAvailability: true}, @@ -309,7 +309,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "an insecure etcd", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, Etcd: kubeadmapi.Etcd{ @@ -348,7 +348,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "auditing and HA are enabled with a custom log max age of 0", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, FeatureGates: map[string]bool{features.HighAvailability: true, features.Auditing: true}, @@ -393,7 +393,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "ensure the DynamicKubelet flag gets passed through", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -432,7 +432,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "test APIServerExtraArgs works as expected", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -480,7 +480,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "authorization-mode extra-args ABAC", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -520,7 +520,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "insecure-port extra-args", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -560,7 +560,7 @@ func TestGetAPIServerCommand(t *testing.T) { }, { name: "authorization-mode extra-args Webhook", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -633,12 +633,12 @@ func removeCommon(left, right []string) []string { func TestGetControllerManagerCommand(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expected []string }{ { name: "custom certs dir", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ CertificatesDir: testCertsDir, KubernetesVersion: "v1.7.0", }, @@ -657,7 +657,7 @@ func TestGetControllerManagerCommand(t *testing.T) { }, { name: "custom cloudprovider", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Networking: kubeadmapi.Networking{PodSubnet: "10.0.1.15/16"}, CertificatesDir: testCertsDir, KubernetesVersion: "v1.7.0", @@ -680,7 +680,7 @@ func TestGetControllerManagerCommand(t *testing.T) { }, { name: "custom extra-args", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Networking: kubeadmapi.Networking{PodSubnet: "10.0.1.15/16"}, ControllerManagerExtraArgs: map[string]string{"node-cidr-mask-size": "20"}, CertificatesDir: testCertsDir, @@ -704,7 +704,7 @@ func TestGetControllerManagerCommand(t *testing.T) { }, { name: "custom IPv6 networking", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Networking: kubeadmapi.Networking{PodSubnet: "2001:db8::/64"}, CertificatesDir: testCertsDir, KubernetesVersion: "v1.7.0", @@ -817,13 +817,13 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { tests := []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration caKeyPresent bool expectedArgFunc func(dir string) []string }{ { name: "caKeyPresent-false", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.0", API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -847,7 +847,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { }, { name: "caKeyPresent true", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.0", API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -904,12 +904,12 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { func TestGetSchedulerCommand(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expected []string }{ { name: "scheduler defaults", - cfg: &kubeadmapi.MasterConfiguration{}, + cfg: &kubeadmapi.InitConfiguration{}, expected: []string{ "kube-scheduler", "--address=127.0.0.1", diff --git a/cmd/kubeadm/app/phases/controlplane/volumes.go b/cmd/kubeadm/app/phases/controlplane/volumes.go index 9237d2c108a..85f3ef8da13 100644 --- a/cmd/kubeadm/app/phases/controlplane/volumes.go +++ b/cmd/kubeadm/app/phases/controlplane/volumes.go @@ -43,7 +43,7 @@ const ( var caCertsExtraVolumePaths = []string{"/etc/pki", "/usr/share/ca-certificates", "/usr/local/share/ca-certificates", "/etc/ca-certificates"} // getHostPathVolumesForTheControlPlane gets the required hostPath volumes and mounts for the control plane -func getHostPathVolumesForTheControlPlane(cfg *kubeadmapi.MasterConfiguration) controlPlaneHostPathMounts { +func getHostPathVolumesForTheControlPlane(cfg *kubeadmapi.InitConfiguration) controlPlaneHostPathMounts { hostPathDirectoryOrCreate := v1.HostPathDirectoryOrCreate hostPathFileOrCreate := v1.HostPathFileOrCreate hostPathFile := v1.HostPathFile diff --git a/cmd/kubeadm/app/phases/controlplane/volumes_test.go b/cmd/kubeadm/app/phases/controlplane/volumes_test.go index 492dc16ab02..088c1b5c87d 100644 --- a/cmd/kubeadm/app/phases/controlplane/volumes_test.go +++ b/cmd/kubeadm/app/phases/controlplane/volumes_test.go @@ -502,13 +502,13 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) { ReadOnly: true, } var tests = []struct { - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration vol map[string]map[string]v1.Volume volMount map[string]map[string]v1.VolumeMount }{ { // Should ignore files in /etc/ssl/certs - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ CertificatesDir: testCertsDir, Etcd: kubeadmapi.Etcd{}, FeatureGates: map[string]bool{features.Auditing: true}, @@ -522,7 +522,7 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) { }, { // Should ignore files in /etc/ssl/certs and in CertificatesDir - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ CertificatesDir: testCertsDir, Etcd: kubeadmapi.Etcd{ External: &kubeadmapi.ExternalEtcd{ diff --git a/cmd/kubeadm/app/phases/etcd/local.go b/cmd/kubeadm/app/phases/etcd/local.go index 8183f351055..a1271fbf713 100644 --- a/cmd/kubeadm/app/phases/etcd/local.go +++ b/cmd/kubeadm/app/phases/etcd/local.go @@ -36,9 +36,9 @@ const ( ) // CreateLocalEtcdStaticPodManifestFile will write local etcd static pod manifest file. -func CreateLocalEtcdStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateLocalEtcdStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating local etcd static pod manifest file") - // gets etcd StaticPodSpec, actualized for the current MasterConfiguration + // gets etcd StaticPodSpec, actualized for the current InitConfiguration spec := GetEtcdPodSpec(cfg) // writes etcd StaticPod to disk if err := staticpodutil.WriteStaticPodToDisk(kubeadmconstants.Etcd, manifestDir, spec); err != nil { @@ -49,9 +49,9 @@ func CreateLocalEtcdStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.Ma return nil } -// GetEtcdPodSpec returns the etcd static Pod actualized to the context of the current MasterConfiguration +// GetEtcdPodSpec returns the etcd static Pod actualized to the context of the current InitConfiguration // NB. GetEtcdPodSpec methods holds the information about how kubeadm creates etcd static pod manifests. -func GetEtcdPodSpec(cfg *kubeadmapi.MasterConfiguration) v1.Pod { +func GetEtcdPodSpec(cfg *kubeadmapi.InitConfiguration) v1.Pod { pathType := v1.HostPathDirectoryOrCreate etcdMounts := map[string]v1.Volume{ etcdVolumeName: staticpodutil.NewVolume(etcdVolumeName, cfg.Etcd.Local.DataDir, &pathType), @@ -75,7 +75,7 @@ func GetEtcdPodSpec(cfg *kubeadmapi.MasterConfiguration) v1.Pod { } // getEtcdCommand builds the right etcd command from the given config object -func getEtcdCommand(cfg *kubeadmapi.MasterConfiguration) []string { +func getEtcdCommand(cfg *kubeadmapi.InitConfiguration) []string { defaultArguments := map[string]string{ "name": cfg.GetNodeName(), "listen-client-urls": "https://127.0.0.1:2379", diff --git a/cmd/kubeadm/app/phases/etcd/local_test.go b/cmd/kubeadm/app/phases/etcd/local_test.go index 83f5f45ad41..e77adf7e84a 100644 --- a/cmd/kubeadm/app/phases/etcd/local_test.go +++ b/cmd/kubeadm/app/phases/etcd/local_test.go @@ -32,7 +32,7 @@ import ( func TestGetEtcdPodSpec(t *testing.T) { // Creates a Master Configuration - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.0", Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ @@ -58,7 +58,7 @@ func TestCreateLocalEtcdStaticPodManifestFile(t *testing.T) { defer os.RemoveAll(tmpdir) // Creates a Master Configuration - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.7.0", Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ @@ -82,11 +82,11 @@ func TestCreateLocalEtcdStaticPodManifestFile(t *testing.T) { func TestGetEtcdCommand(t *testing.T) { var tests = []struct { - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expected []string }{ { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ NodeRegistration: kubeadmapi.NodeRegistrationOptions{ Name: "foo", }, @@ -117,7 +117,7 @@ func TestGetEtcdCommand(t *testing.T) { }, }, { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ NodeRegistration: kubeadmapi.NodeRegistrationOptions{ Name: "bar", }, @@ -152,7 +152,7 @@ func TestGetEtcdCommand(t *testing.T) { }, }, { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ NodeRegistration: kubeadmapi.NodeRegistrationOptions{ Name: "wombat", }, diff --git a/cmd/kubeadm/app/phases/kubeconfig/doc.go b/cmd/kubeadm/app/phases/kubeconfig/doc.go index ec5194eaab9..30c3885c558 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/doc.go +++ b/cmd/kubeadm/app/phases/kubeconfig/doc.go @@ -21,7 +21,7 @@ package kubeconfig PHASE: KUBECONFIG INPUTS: - From MasterConfiguration + From InitConfiguration The Master API Server endpoint (AdvertiseAddress + BindPort) is required so the KubeConfig file knows where to find the master The KubernetesDir path is required for knowing where to put the KubeConfig files The PKIPath is required for knowing where all certificates should be stored diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go index 6a21c8f772d..725683fec03 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go @@ -61,7 +61,7 @@ type kubeConfigSpec struct { // CreateInitKubeConfigFiles will create and write to disk all kubeconfig files necessary in the kubeadm init phase // to establish the control plane, including also the admin kubeconfig file. // If kubeconfig files already exists, they are used only if evaluated equal; otherwise an error is returned. -func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating all kubeconfig files") return createKubeConfigFiles( outDir, @@ -75,37 +75,37 @@ func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.MasterConfiguratio // CreateAdminKubeConfigFile create a kubeconfig file for the admin to use and for kubeadm itself. // If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned. -func CreateAdminKubeConfigFile(outDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateAdminKubeConfigFile(outDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("create a kubeconfig file for the admin and for kubeadm itself") return createKubeConfigFiles(outDir, cfg, kubeadmconstants.AdminKubeConfigFileName) } // CreateKubeletKubeConfigFile create a kubeconfig file for the Kubelet to use. // If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned. -func CreateKubeletKubeConfigFile(outDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateKubeletKubeConfigFile(outDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating a kubeconfig file for the Kubelet") return createKubeConfigFiles(outDir, cfg, kubeadmconstants.KubeletKubeConfigFileName) } // CreateControllerManagerKubeConfigFile create a kubeconfig file for the ControllerManager to use. // If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned. -func CreateControllerManagerKubeConfigFile(outDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateControllerManagerKubeConfigFile(outDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating kubeconfig file for the ControllerManager") return createKubeConfigFiles(outDir, cfg, kubeadmconstants.ControllerManagerKubeConfigFileName) } // CreateSchedulerKubeConfigFile create a create a kubeconfig file for the Scheduler to use. // If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned. -func CreateSchedulerKubeConfigFile(outDir string, cfg *kubeadmapi.MasterConfiguration) error { +func CreateSchedulerKubeConfigFile(outDir string, cfg *kubeadmapi.InitConfiguration) error { glog.V(1).Infoln("creating kubeconfig file for Scheduler") return createKubeConfigFiles(outDir, cfg, kubeadmconstants.SchedulerKubeConfigFileName) } // createKubeConfigFiles creates all the requested kubeconfig files. // If kubeconfig files already exists, they are used only if evaluated equal; otherwise an error is returned. -func createKubeConfigFiles(outDir string, cfg *kubeadmapi.MasterConfiguration, kubeConfigFileNames ...string) error { +func createKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration, kubeConfigFileNames ...string) error { - // gets the KubeConfigSpecs, actualized for the current MasterConfiguration + // gets the KubeConfigSpecs, actualized for the current InitConfiguration specs, err := getKubeConfigSpecs(cfg) if err != nil { return err @@ -133,9 +133,9 @@ func createKubeConfigFiles(outDir string, cfg *kubeadmapi.MasterConfiguration, k return nil } -// getKubeConfigSpecs returns all KubeConfigSpecs actualized to the context of the current MasterConfiguration +// getKubeConfigSpecs returns all KubeConfigSpecs actualized to the context of the current InitConfiguration // NB. this methods holds the information about how kubeadm creates kubeconfig files. -func getKubeConfigSpecs(cfg *kubeadmapi.MasterConfiguration) (map[string]*kubeConfigSpec, error) { +func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConfigSpec, error) { caCert, caKey, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName) if err != nil { @@ -271,9 +271,9 @@ func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmda } // WriteKubeConfigWithClientCert writes a kubeconfig file - with a client certificate as authentication info - to the given writer. -func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.MasterConfiguration, clientName string, organizations []string) error { +func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.InitConfiguration, clientName string, organizations []string) error { - // creates the KubeConfigSpecs, actualized for the current MasterConfiguration + // creates the KubeConfigSpecs, actualized for the current InitConfiguration caCert, caKey, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName) if err != nil { return fmt.Errorf("couldn't create a kubeconfig; the CA files couldn't be loaded: %v", err) @@ -298,9 +298,9 @@ func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.MasterConfigur } // WriteKubeConfigWithToken writes a kubeconfig file - with a token as client authentication info - to the given writer. -func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.MasterConfiguration, clientName, token string) error { +func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.InitConfiguration, clientName, token string) error { - // creates the KubeConfigSpecs, actualized for the current MasterConfiguration + // creates the KubeConfigSpecs, actualized for the current InitConfiguration caCert, _, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName) if err != nil { return fmt.Errorf("couldn't create a kubeconfig; the CA files couldn't be loaded: %v", err) diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go index ced29c30e3f..925dc32fe26 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go @@ -46,7 +46,7 @@ func TestGetKubeConfigSpecsFailsIfCADoesntExists(t *testing.T) { defer os.RemoveAll(tmpdir) // Creates a Master Configuration pointing to the pkidir folder - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ CertificatesDir: tmpdir, } @@ -65,7 +65,7 @@ func TestGetKubeConfigSpecs(t *testing.T) { pkidir := testutil.SetupPkiDirWithCertificateAuthorithy(t, tmpdir) // Creates Master Configurations pointing to the pkidir folder - cfgs := []*kubeadmapi.MasterConfiguration{ + cfgs := []*kubeadmapi.InitConfiguration{ { API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, CertificatesDir: pkidir, @@ -145,7 +145,7 @@ func TestGetKubeConfigSpecs(t *testing.T) { t.Errorf("getKubeConfigSpecs for %s Organizations is %v, expected %v", assertion.kubeConfigFile, spec.ClientCertAuth.Organizations, assertion.organizations) } - // Asserts MasterConfiguration values injected into spec + // Asserts InitConfiguration values injected into spec masterEndpoint, err := kubeadmutil.GetMasterEndpoint(&cfg.API) if err != nil { t.Error(err) @@ -252,12 +252,12 @@ func TestCreateKubeConfigFileIfNotExists(t *testing.T) { func TestCreateKubeconfigFilesAndWrappers(t *testing.T) { var tests = []struct { - createKubeConfigFunction func(outDir string, cfg *kubeadmapi.MasterConfiguration) error + createKubeConfigFunction func(outDir string, cfg *kubeadmapi.InitConfiguration) error expectedFiles []string expectedError bool }{ { // Test createKubeConfigFiles fails for unknown kubeconfig is requested - createKubeConfigFunction: func(outDir string, cfg *kubeadmapi.MasterConfiguration) error { + createKubeConfigFunction: func(outDir string, cfg *kubeadmapi.InitConfiguration) error { return createKubeConfigFiles(outDir, cfg, "unknown.conf") }, expectedError: true, @@ -298,7 +298,7 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) { pkidir := testutil.SetupPkiDirWithCertificateAuthorithy(t, tmpdir) // Creates a Master Configuration pointing to the pkidir folder - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, CertificatesDir: pkidir, } @@ -326,7 +326,7 @@ func TestWriteKubeConfigFailsIfCADoesntExists(t *testing.T) { defer os.RemoveAll(tmpdir) // Creates a Master Configuration pointing to the tmpdir folder - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ CertificatesDir: tmpdir, } @@ -371,7 +371,7 @@ func TestWriteKubeConfig(t *testing.T) { } // Creates a Master Configuration pointing to the pkidir folder - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, CertificatesDir: pkidir, } diff --git a/cmd/kubeadm/app/phases/kubelet/config.go b/cmd/kubeadm/app/phases/kubelet/config.go index f927f4d2c5f..63d8a7c6bab 100644 --- a/cmd/kubeadm/app/phases/kubelet/config.go +++ b/cmd/kubeadm/app/phases/kubelet/config.go @@ -49,7 +49,7 @@ func WriteConfigToDisk(kubeletConfig *kubeletconfig.KubeletConfiguration, kubele // CreateConfigMap creates a ConfigMap with the generic kubelet configuration. // Used at "kubeadm init" and "kubeadm upgrade" time -func CreateConfigMap(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +func CreateConfigMap(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { k8sVersion, err := version.ParseSemantic(cfg.KubernetesVersion) if err != nil { diff --git a/cmd/kubeadm/app/phases/kubelet/config_test.go b/cmd/kubeadm/app/phases/kubelet/config_test.go index 47697892050..769ae290028 100644 --- a/cmd/kubeadm/app/phases/kubelet/config_test.go +++ b/cmd/kubeadm/app/phases/kubelet/config_test.go @@ -32,7 +32,7 @@ import ( func TestCreateConfigMap(t *testing.T) { nodeName := "fake-node" client := fake.NewSimpleClientset() - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: nodeName}, KubernetesVersion: "v1.11.0", ComponentConfigs: kubeadmapi.ComponentConfigs{ diff --git a/cmd/kubeadm/app/phases/kubelet/flags.go b/cmd/kubeadm/app/phases/kubelet/flags.go index cc07e6f2721..252e6be84c2 100644 --- a/cmd/kubeadm/app/phases/kubelet/flags.go +++ b/cmd/kubeadm/app/phases/kubelet/flags.go @@ -62,7 +62,7 @@ func WriteKubeletDynamicEnvFile(nodeRegOpts *kubeadmapi.NodeRegistrationOptions, return writeKubeletFlagBytesToDisk([]byte(envFileContent), kubeletDir) } -// buildKubeletArgMap takes a MasterConfiguration object and builds based on that a string-string map with flags +// buildKubeletArgMap takes a InitConfiguration object and builds based on that a string-string map with flags // that should be given to the local kubelet daemon. func buildKubeletArgMap(opts kubeletFlagsOpts) map[string]string { kubeletFlags := map[string]string{} diff --git a/cmd/kubeadm/app/phases/selfhosting/selfhosting.go b/cmd/kubeadm/app/phases/selfhosting/selfhosting.go index c5f2aa218fa..362029695ea 100644 --- a/cmd/kubeadm/app/phases/selfhosting/selfhosting.go +++ b/cmd/kubeadm/app/phases/selfhosting/selfhosting.go @@ -56,7 +56,7 @@ const ( // 8. In order to avoid race conditions, we have to make sure that static pod is deleted correctly before we continue // Otherwise, there is a race condition when we proceed without kubelet having restarted the API server correctly and the next .Create call flakes // 9. Do that for the kube-apiserver, kube-controller-manager and kube-scheduler in a loop -func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.MasterConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool) error { +func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool) error { glog.V(1).Infoln("creating self hosted control plane") // Adjust the timeout slightly to something self-hosting specific waiter.SetTimeout(selfHostingWaitTimeout) diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade.go b/cmd/kubeadm/app/phases/upgrade/postupgrade.go index cd625623f09..b5a8829d55c 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade.go @@ -50,7 +50,7 @@ var expiry = 180 * 24 * time.Hour // PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do // Note that the markmaster phase is left out, not needed, and no token is created as that doesn't belong to the upgrade -func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.MasterConfiguration, newK8sVer *version.Version, dryRun bool) error { +func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, newK8sVer *version.Version, dryRun bool) error { errs := []error{} // Upload currently used configuration to the cluster @@ -70,7 +70,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.MasterC errs = append(errs, err) } - // Annotate the node with the crisocket information, sourced either from the MasterConfiguration struct or + // Annotate the node with the crisocket information, sourced either from the InitConfiguration struct or // --cri-socket. // TODO: In the future we want to use something more official like NodeStatus or similar for detecting this properly if err := patchnodephase.AnnotateCRISocket(client, cfg.NodeRegistration.Name, cfg.NodeRegistration.CRISocket); err != nil { @@ -127,7 +127,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.MasterC return errors.NewAggregate(errs) } -func removeOldDNSDeploymentIfAnotherDNSIsUsed(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface, dryRun bool) error { +func removeOldDNSDeploymentIfAnotherDNSIsUsed(cfg *kubeadmapi.InitConfiguration, client clientset.Interface, dryRun bool) error { return apiclient.TryRunCommand(func() error { installedDeploymentName := kubeadmconstants.KubeDNS deploymentToDelete := kubeadmconstants.CoreDNS @@ -158,7 +158,7 @@ func removeOldDNSDeploymentIfAnotherDNSIsUsed(cfg *kubeadmapi.MasterConfiguratio }, 10) } -func upgradeToSelfHosting(client clientset.Interface, cfg *kubeadmapi.MasterConfiguration, dryRun bool) error { +func upgradeToSelfHosting(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, dryRun bool) error { if features.Enabled(cfg.FeatureGates, features.SelfHosting) && !IsControlPlaneSelfHosted(client) { waiter := getWaiter(dryRun, client) @@ -172,7 +172,7 @@ func upgradeToSelfHosting(client clientset.Interface, cfg *kubeadmapi.MasterConf return nil } -func backupAPIServerCertIfNeeded(cfg *kubeadmapi.MasterConfiguration, dryRun bool) error { +func backupAPIServerCertIfNeeded(cfg *kubeadmapi.InitConfiguration, dryRun bool) error { certAndKeyDir := kubeadmapiv1alpha3.DefaultCertificatesDir shouldBackup, err := shouldBackupAPIServerCertAndKey(certAndKeyDir) if err != nil { @@ -198,7 +198,7 @@ func backupAPIServerCertIfNeeded(cfg *kubeadmapi.MasterConfiguration, dryRun boo return certsphase.CreateAPIServerCertAndKeyFiles(cfg) } -func writeKubeletConfigFiles(client clientset.Interface, cfg *kubeadmapi.MasterConfiguration, newK8sVer *version.Version, dryRun bool) error { +func writeKubeletConfigFiles(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, newK8sVer *version.Version, dryRun bool) error { kubeletDir, err := getKubeletDir(dryRun) if err != nil { // The error here should never occur in reality, would only be thrown if /tmp doesn't exist on the machine. diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go b/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go index c25387e8eca..7ed1db8f42a 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go @@ -130,7 +130,7 @@ func TestRollbackFiles(t *testing.T) { } func TestShouldBackupAPIServerCertAndKey(t *testing.T) { - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "1.2.3.4"}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "test-node"}, diff --git a/cmd/kubeadm/app/phases/upgrade/prepull.go b/cmd/kubeadm/app/phases/upgrade/prepull.go index f875cd5eae3..5f872cf01c4 100644 --- a/cmd/kubeadm/app/phases/upgrade/prepull.go +++ b/cmd/kubeadm/app/phases/upgrade/prepull.go @@ -44,12 +44,12 @@ type Prepuller interface { // DaemonSetPrepuller makes sure the control plane images are available on all masters type DaemonSetPrepuller struct { client clientset.Interface - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration waiter apiclient.Waiter } // NewDaemonSetPrepuller creates a new instance of the DaemonSetPrepuller struct -func NewDaemonSetPrepuller(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.MasterConfiguration) *DaemonSetPrepuller { +func NewDaemonSetPrepuller(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.InitConfiguration) *DaemonSetPrepuller { return &DaemonSetPrepuller{ client: client, cfg: cfg, diff --git a/cmd/kubeadm/app/phases/upgrade/selfhosted.go b/cmd/kubeadm/app/phases/upgrade/selfhosted.go index 385a2a30a47..efd37af0876 100644 --- a/cmd/kubeadm/app/phases/upgrade/selfhosted.go +++ b/cmd/kubeadm/app/phases/upgrade/selfhosted.go @@ -81,7 +81,7 @@ type controlPlaneComponentResources struct { // -> Backup component v1 is Deleted // 5. Wait for Self-Hosted component v2 Running to become active // 6. Repeat for all control plane components -func SelfHostedControlPlane(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.Version) error { +func SelfHostedControlPlane(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.InitConfiguration, k8sVersion *version.Version) error { // Adjust the timeout slightly to something self-hosting specific waiter.SetTimeout(selfHostingWaitTimeout) @@ -158,7 +158,7 @@ func SelfHostedControlPlane(client clientset.Interface, waiter apiclient.Waiter, } // BuildUpgradedDaemonSetsFromConfig takes a config object and the current version and returns the DaemonSet objects to post to the master -func BuildUpgradedDaemonSetsFromConfig(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.Version) map[string]*apps.DaemonSet { +func BuildUpgradedDaemonSetsFromConfig(cfg *kubeadmapi.InitConfiguration, k8sVersion *version.Version) map[string]*apps.DaemonSet { // Here the map of different mutators to use for the control plane's podspec is stored mutators := selfhosting.GetMutatorsFromFeatureGates(cfg.FeatureGates) // Get the new PodSpecs to use diff --git a/cmd/kubeadm/app/phases/upgrade/staticpods.go b/cmd/kubeadm/app/phases/upgrade/staticpods.go index 9055a4e64b3..d96e94c8c5d 100644 --- a/cmd/kubeadm/app/phases/upgrade/staticpods.go +++ b/cmd/kubeadm/app/phases/upgrade/staticpods.go @@ -161,7 +161,7 @@ func (spm *KubeStaticPodPathManager) CleanupDirs() error { return nil } -func upgradeComponent(component string, waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.MasterConfiguration, beforePodHash string, recoverManifests map[string]string, isTLSUpgrade bool) error { +func upgradeComponent(component string, waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.InitConfiguration, beforePodHash string, recoverManifests map[string]string, isTLSUpgrade bool) error { // Special treatment is required for etcd case, when rollbackOldManifests should roll back etcd // manifests only for the case when component is Etcd recoverEtcd := false @@ -257,7 +257,7 @@ func upgradeComponent(component string, waiter apiclient.Waiter, pathMgr StaticP } // performEtcdStaticPodUpgrade performs upgrade of etcd, it returns bool which indicates fatal error or not and the actual error. -func performEtcdStaticPodUpgrade(waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.MasterConfiguration, recoverManifests map[string]string, isTLSUpgrade bool, oldEtcdClient, newEtcdClient etcdutil.ClusterInterrogator) (bool, error) { +func performEtcdStaticPodUpgrade(waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.InitConfiguration, recoverManifests map[string]string, isTLSUpgrade bool, oldEtcdClient, newEtcdClient etcdutil.ClusterInterrogator) (bool, error) { // Add etcd static pod spec only if external etcd is not configured if cfg.Etcd.External != nil { return false, fmt.Errorf("external etcd detected, won't try to change any etcd state") @@ -404,7 +404,7 @@ func performEtcdStaticPodUpgrade(waiter apiclient.Waiter, pathMgr StaticPodPathM } // StaticPodControlPlane upgrades a static pod-hosted control plane -func StaticPodControlPlane(waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.MasterConfiguration, etcdUpgrade bool, oldEtcdClient, newEtcdClient etcdutil.ClusterInterrogator) error { +func StaticPodControlPlane(waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.InitConfiguration, etcdUpgrade bool, oldEtcdClient, newEtcdClient etcdutil.ClusterInterrogator) error { recoverManifests := map[string]string{} var isTLSUpgrade bool var isExternalEtcd bool @@ -509,7 +509,7 @@ func rollbackOldManifests(oldManifests map[string]string, origErr error, pathMgr // rollbackEtcdData rolls back the the content of etcd folder if something went wrong. // When the folder contents are successfully rolled back, nil is returned, otherwise an error is returned. -func rollbackEtcdData(cfg *kubeadmapi.MasterConfiguration, pathMgr StaticPodPathManager) error { +func rollbackEtcdData(cfg *kubeadmapi.InitConfiguration, pathMgr StaticPodPathManager) error { backupEtcdDir := pathMgr.BackupEtcdDir() runningEtcdDir := cfg.Etcd.Local.DataDir diff --git a/cmd/kubeadm/app/phases/upgrade/staticpods_test.go b/cmd/kubeadm/app/phases/upgrade/staticpods_test.go index 354455be774..4f0ec82aa73 100644 --- a/cmd/kubeadm/app/phases/upgrade/staticpods_test.go +++ b/cmd/kubeadm/app/phases/upgrade/staticpods_test.go @@ -47,7 +47,7 @@ const ( testConfiguration = ` apiVersion: kubeadm.k8s.io/v1alpha3 -kind: MasterConfiguration +kind: InitConfiguration api: advertiseAddress: 1.2.3.4 bindPort: 6443 @@ -421,7 +421,7 @@ func TestStaticPodControlPlane(t *testing.T) { } // Initialize PKI minus any etcd certificates to simulate etcd PKI upgrade - certActions := []func(cfg *kubeadmapi.MasterConfiguration) error{ + certActions := []func(cfg *kubeadmapi.InitConfiguration) error{ certsphase.CreateCACertAndKeyFiles, certsphase.CreateAPIServerCertAndKeyFiles, certsphase.CreateAPIServerKubeletClientCertAndKeyFiles, @@ -514,9 +514,9 @@ func getAPIServerHash(dir string) (string, error) { } // TODO: Make this test function use the rest of the "official" API machinery helper funcs we have inside of kubeadm -func getConfig(version, certsDir, etcdDataDir string) (*kubeadmapi.MasterConfiguration, error) { - externalcfg := &kubeadmapiv1alpha3.MasterConfiguration{} - internalcfg := &kubeadmapi.MasterConfiguration{} +func getConfig(version, certsDir, etcdDataDir string) (*kubeadmapi.InitConfiguration, error) { + externalcfg := &kubeadmapiv1alpha3.InitConfiguration{} + internalcfg := &kubeadmapi.InitConfiguration{} if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(fmt.Sprintf(testConfiguration, certsDir, etcdDataDir, version)), externalcfg); err != nil { return nil, fmt.Errorf("unable to decode config: %v", err) } diff --git a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go index 76752c2183b..ae1b17b6846 100644 --- a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go +++ b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig.go @@ -28,10 +28,10 @@ import ( configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config" ) -// UploadConfiguration saves the MasterConfiguration used for later reference (when upgrading for instance) -func UploadConfiguration(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { +// UploadConfiguration saves the InitConfiguration used for later reference (when upgrading for instance) +func UploadConfiguration(cfg *kubeadmapi.InitConfiguration, client clientset.Interface) error { - fmt.Printf("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem) + fmt.Printf("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.InitConfigurationConfigMap, metav1.NamespaceSystem) // We don't want to mutate the cfg itself, so create a copy of it using .DeepCopy of it first cfgToUpload := cfg.DeepCopy() @@ -55,11 +55,11 @@ func UploadConfiguration(cfg *kubeadmapi.MasterConfiguration, client clientset.I return apiclient.CreateOrUpdateConfigMap(client, &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: kubeadmconstants.MasterConfigurationConfigMap, + Name: kubeadmconstants.InitConfigurationConfigMap, Namespace: metav1.NamespaceSystem, }, Data: map[string]string{ - kubeadmconstants.MasterConfigurationConfigMapKey: string(cfgYaml), + kubeadmconstants.InitConfigurationConfigMapKey: string(cfgYaml), }, }) } diff --git a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go index f88cf0063de..0ca33efc5f2 100644 --- a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go +++ b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go @@ -62,7 +62,7 @@ func TestUploadConfiguration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t2 *testing.T) { - cfg := &kubeadmapi.MasterConfiguration{ + cfg := &kubeadmapi.InitConfiguration{ KubernetesVersion: "v1.10.3", BootstrapTokens: []kubeadmapi.BootstrapToken{ { @@ -98,16 +98,16 @@ func TestUploadConfiguration(t *testing.T) { } } if tt.verifyResult { - masterCfg, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(kubeadmconstants.MasterConfigurationConfigMap, metav1.GetOptions{}) + masterCfg, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(kubeadmconstants.InitConfigurationConfigMap, metav1.GetOptions{}) if err != nil { t2.Fatalf("Fail to query ConfigMap error = %v", err) } - configData := masterCfg.Data[kubeadmconstants.MasterConfigurationConfigMapKey] + configData := masterCfg.Data[kubeadmconstants.InitConfigurationConfigMapKey] if configData == "" { t2.Fatalf("Fail to find ConfigMap key") } - decodedCfg := &kubeadmapi.MasterConfiguration{} + decodedCfg := &kubeadmapi.InitConfiguration{} if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(configData), decodedCfg); err != nil { t2.Fatalf("unable to decode config from bytes: %v", err) } diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index 381c9208f48..88dfbba76b4 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -849,7 +849,7 @@ func (i ImagePullCheck) Check() (warnings, errors []error) { } // RunInitMasterChecks executes all individual, applicable to Master node checks. -func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.MasterConfiguration, ignorePreflightErrors sets.String) error { +func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.String) error { // First, check if we're root separately from the other preflight checks and fail fast if err := RunRootCheckOnly(ignorePreflightErrors); err != nil { return err @@ -1001,7 +1001,7 @@ func RunRootCheckOnly(ignorePreflightErrors sets.String) error { } // RunPullImagesCheck will pull images kubeadm needs if the are not found on the system -func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.MasterConfiguration, ignorePreflightErrors sets.String) error { +func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.String) error { criInterfacer, err := images.NewCRInterfacer(execer, cfg.GetCRISocket()) if err != nil { return err diff --git a/cmd/kubeadm/app/preflight/checks_test.go b/cmd/kubeadm/app/preflight/checks_test.go index f6908c7c3e0..6b32143dfda 100644 --- a/cmd/kubeadm/app/preflight/checks_test.go +++ b/cmd/kubeadm/app/preflight/checks_test.go @@ -185,38 +185,38 @@ func (pfct preflightCheckTest) Check() (warning, errors []error) { func TestRunInitMasterChecks(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration expected bool }{ {name: "Test valid advertised address", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "foo"}, }, expected: false, }, { name: "Test CA file exists if specfied", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CAFile: "/foo"}}, }, expected: false, }, { name: "Test Cert file exists if specfied", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CertFile: "/foo"}}, }, expected: false, }, { name: "Test Key file exists if specfied", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CertFile: "/foo"}}, }, expected: false, }, { - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{AdvertiseAddress: "2001:1234::1:15"}, }, expected: false, diff --git a/cmd/kubeadm/app/util/config/cluster.go b/cmd/kubeadm/app/util/config/cluster.go index 369bba9610c..c7c37d559be 100644 --- a/cmd/kubeadm/app/util/config/cluster.go +++ b/cmd/kubeadm/app/util/config/cluster.go @@ -31,7 +31,7 @@ import ( // TODO: Add unit tests for this file // FetchConfigFromFileOrCluster fetches configuration required for upgrading your cluster from a file (which has precedence) or a ConfigMap in the cluster -func FetchConfigFromFileOrCluster(client clientset.Interface, w io.Writer, logPrefix, cfgPath string) (*kubeadmapi.MasterConfiguration, error) { +func FetchConfigFromFileOrCluster(client clientset.Interface, w io.Writer, logPrefix, cfgPath string) (*kubeadmapi.InitConfiguration, error) { // Load the configuration from a file or the cluster configBytes, err := loadConfigurationBytes(client, w, logPrefix, cfgPath) if err != nil { @@ -52,15 +52,15 @@ func loadConfigurationBytes(client clientset.Interface, w io.Writer, logPrefix, fmt.Fprintf(w, "[%s] Reading configuration from the cluster...\n", logPrefix) - configMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.MasterConfigurationConfigMap, metav1.GetOptions{}) + configMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.InitConfigurationConfigMap, metav1.GetOptions{}) if apierrors.IsNotFound(err) { // Return the apierror directly so the caller of this function can know what type of error occurred and act based on that return []byte{}, err } else if err != nil { - return []byte{}, fmt.Errorf("an unexpected error happened when trying to get the ConfigMap %q in the %s namespace: %v", constants.MasterConfigurationConfigMap, metav1.NamespaceSystem, err) + return []byte{}, fmt.Errorf("an unexpected error happened when trying to get the ConfigMap %q in the %s namespace: %v", constants.InitConfigurationConfigMap, metav1.NamespaceSystem, err) } // TODO: Load the kube-proxy and kubelet ComponentConfig ConfigMaps here as different YAML documents and append to the byte slice - fmt.Fprintf(w, "[%s] FYI: You can look at this config file with 'kubectl -n %s get cm %s -oyaml'\n", logPrefix, metav1.NamespaceSystem, constants.MasterConfigurationConfigMap) - return []byte(configMap.Data[constants.MasterConfigurationConfigMapKey]), nil + fmt.Fprintf(w, "[%s] FYI: You can look at this config file with 'kubectl -n %s get cm %s -oyaml'\n", logPrefix, metav1.NamespaceSystem, constants.InitConfigurationConfigMap) + return []byte(configMap.Data[constants.InitConfigurationConfigMapKey]), nil } diff --git a/cmd/kubeadm/app/util/config/common.go b/cmd/kubeadm/app/util/config/common.go index f1efb8f0301..5ed571eb409 100644 --- a/cmd/kubeadm/app/util/config/common.go +++ b/cmd/kubeadm/app/util/config/common.go @@ -32,7 +32,7 @@ import ( "k8s.io/kubernetes/pkg/util/version" ) -// AnyConfigFileAndDefaultsToInternal reads either a MasterConfiguration or NodeConfiguration and unmarshals it +// AnyConfigFileAndDefaultsToInternal reads either a InitConfiguration or NodeConfiguration and unmarshals it func AnyConfigFileAndDefaultsToInternal(cfgPath string) (runtime.Object, error) { b, err := ioutil.ReadFile(cfgPath) if err != nil { @@ -44,9 +44,9 @@ func AnyConfigFileAndDefaultsToInternal(cfgPath string) (runtime.Object, error) return nil, err } - // First, check if the gvk list has MasterConfiguration and in that case try to unmarshal it - if kubeadmutil.GroupVersionKindsHasMasterConfiguration(gvks) { - return ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.MasterConfiguration{}) + // First, check if the gvk list has InitConfiguration and in that case try to unmarshal it + if kubeadmutil.GroupVersionKindsHasInitConfiguration(gvks) { + return ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.InitConfiguration{}) } if kubeadmutil.GroupVersionKindsHasNodeConfiguration(gvks) { return NodeConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.NodeConfiguration{}) @@ -54,11 +54,11 @@ func AnyConfigFileAndDefaultsToInternal(cfgPath string) (runtime.Object, error) return nil, fmt.Errorf("didn't recognize types with GroupVersionKind: %v", gvks) } -// MarshalKubeadmConfigObject marshals an Object registered in the kubeadm scheme. If the object is a MasterConfiguration, some extra logic is run +// MarshalKubeadmConfigObject marshals an Object registered in the kubeadm scheme. If the object is a InitConfiguration, some extra logic is run func MarshalKubeadmConfigObject(obj runtime.Object) ([]byte, error) { switch internalcfg := obj.(type) { - case *kubeadmapi.MasterConfiguration: - return MarshalMasterConfigurationToBytes(internalcfg, kubeadmapiv1alpha3.SchemeGroupVersion) + case *kubeadmapi.InitConfiguration: + return MarshalInitConfigurationToBytes(internalcfg, kubeadmapiv1alpha3.SchemeGroupVersion) default: return kubeadmutil.MarshalToYamlForCodecs(obj, kubeadmapiv1alpha3.SchemeGroupVersion, kubeadmscheme.Codecs) } @@ -93,7 +93,7 @@ func DetectUnsupportedVersion(b []byte) error { // NormalizeKubernetesVersion resolves version labels, sets alternative // image registry if requested for CI builds, and validates minimal // version that kubeadm SetInitDynamicDefaultssupports. -func NormalizeKubernetesVersion(cfg *kubeadmapi.MasterConfiguration) error { +func NormalizeKubernetesVersion(cfg *kubeadmapi.InitConfiguration) error { // Requested version is automatic CI build, thus use KubernetesCI Image Repository for core images if kubeadmutil.KubernetesIsCIVersion(cfg.KubernetesVersion) { cfg.CIImageRepository = constants.DefaultCIImageRepository diff --git a/cmd/kubeadm/app/util/config/common_test.go b/cmd/kubeadm/app/util/config/common_test.go index e7029e3f8de..93031e10710 100644 --- a/cmd/kubeadm/app/util/config/common_test.go +++ b/cmd/kubeadm/app/util/config/common_test.go @@ -27,7 +27,7 @@ import ( var files = map[string][]byte{ "Master_v1alpha1": []byte(` apiVersion: kubeadm.k8s.io/v1alpha1 -kind: MasterConfiguration +kind: InitConfiguration `), "Node_v1alpha1": []byte(` apiVersion: kubeadm.k8s.io/v1alpha1 @@ -35,7 +35,7 @@ kind: NodeConfiguration `), "Master_v1alpha3": []byte(` apiVersion: kubeadm.k8s.io/v1alpha3 -kind: MasterConfiguration +kind: InitConfiguration `), "Node_v1alpha3": []byte(` apiVersion: kubeadm.k8s.io/v1alpha3 @@ -138,7 +138,7 @@ func TestLowercaseSANs(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ APIServerCertSANs: test.in, } diff --git a/cmd/kubeadm/app/util/config/masterconfig.go b/cmd/kubeadm/app/util/config/masterconfig.go index a4092f12d25..b9713e8f385 100644 --- a/cmd/kubeadm/app/util/config/masterconfig.go +++ b/cmd/kubeadm/app/util/config/masterconfig.go @@ -41,8 +41,8 @@ import ( nodeutil "k8s.io/kubernetes/pkg/util/node" ) -// SetInitDynamicDefaults checks and sets configuration values for the MasterConfiguration object -func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error { +// SetInitDynamicDefaults checks and sets configuration values for the InitConfiguration object +func SetInitDynamicDefaults(cfg *kubeadmapi.InitConfiguration) error { // Default all the embedded ComponentConfig structs componentconfigs.Known.Default(cfg) @@ -109,8 +109,8 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error { // Then the external, versioned configuration is defaulted and converted to the internal type. // Right thereafter, the configuration is defaulted again with dynamic values (like IP addresses of a machine, etc) // Lastly, the internal config is validated and returned. -func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *kubeadmapiv1alpha3.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) { - internalcfg := &kubeadmapi.MasterConfiguration{} +func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *kubeadmapiv1alpha3.InitConfiguration) (*kubeadmapi.InitConfiguration, error) { + internalcfg := &kubeadmapi.InitConfiguration{} if cfgPath != "" { // Loads configuration from config file, if provided @@ -134,9 +134,9 @@ func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg * // BytesToInternalConfig converts a byte slice to an internal, defaulted and validated configuration object. // The byte slice may contain one or many different YAML documents. These YAML documents are parsed one-by-one -// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal MasterConfiguration struct -func BytesToInternalConfig(b []byte) (*kubeadmapi.MasterConfiguration, error) { - internalcfg := &kubeadmapi.MasterConfiguration{} +// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal InitConfiguration struct +func BytesToInternalConfig(b []byte) (*kubeadmapi.InitConfiguration, error) { + internalcfg := &kubeadmapi.InitConfiguration{} decodedObjs := map[componentconfigs.RegistrationKind]runtime.Object{} masterConfigFound := false @@ -163,7 +163,7 @@ func BytesToInternalConfig(b []byte) (*kubeadmapi.MasterConfiguration, error) { continue } - if gvk.Kind == kubeadmconstants.MasterConfigurationKind { + if gvk.Kind == kubeadmconstants.InitConfigurationKind { if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), fileContent, internalcfg); err != nil { return nil, err } @@ -173,9 +173,9 @@ func BytesToInternalConfig(b []byte) (*kubeadmapi.MasterConfiguration, error) { fmt.Printf("[config] WARNING: Ignored YAML document with GroupVersionKind %v\n", gvk) } - // Just as an extra safety check, don't proceed if a MasterConfiguration object wasn't found + // Just as an extra safety check, don't proceed if a InitConfiguration object wasn't found if !masterConfigFound { - return nil, fmt.Errorf("no MasterConfiguration kind was found in the YAML file") + return nil, fmt.Errorf("no InitConfiguration kind was found in the YAML file") } // Save the loaded ComponentConfig objects in the internalcfg object @@ -194,22 +194,22 @@ func BytesToInternalConfig(b []byte) (*kubeadmapi.MasterConfiguration, error) { return defaultAndValidate(internalcfg) } -func defaultAndValidate(cfg *kubeadmapi.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) { +func defaultAndValidate(cfg *kubeadmapi.InitConfiguration) (*kubeadmapi.InitConfiguration, error) { // Applies dynamic defaults to settings not provided with flags if err := SetInitDynamicDefaults(cfg); err != nil { return nil, err } // Validates cfg (flags/configs + defaults + dynamic defaults) - if err := validation.ValidateMasterConfiguration(cfg).ToAggregate(); err != nil { + if err := validation.ValidateInitConfiguration(cfg).ToAggregate(); err != nil { return nil, err } return cfg, nil } -func defaultedInternalConfig() *kubeadmapi.MasterConfiguration { - externalcfg := &kubeadmapiv1alpha3.MasterConfiguration{} - internalcfg := &kubeadmapi.MasterConfiguration{} +func defaultedInternalConfig() *kubeadmapi.InitConfiguration { + externalcfg := &kubeadmapiv1alpha3.InitConfiguration{} + internalcfg := &kubeadmapi.InitConfiguration{} kubeadmscheme.Scheme.Default(externalcfg) kubeadmscheme.Scheme.Convert(externalcfg, internalcfg, nil) @@ -219,9 +219,9 @@ func defaultedInternalConfig() *kubeadmapi.MasterConfiguration { return internalcfg } -// MarshalMasterConfigurationToBytes marshals the internal MasterConfiguration object to bytes. It writes the embedded +// MarshalInitConfigurationToBytes marshals the internal InitConfiguration object to bytes. It writes the embedded // ComponentConfiguration objects out as separate YAML documents -func MarshalMasterConfigurationToBytes(cfg *kubeadmapi.MasterConfiguration, gv schema.GroupVersion) ([]byte, error) { +func MarshalInitConfigurationToBytes(cfg *kubeadmapi.InitConfiguration, gv schema.GroupVersion) ([]byte, error) { masterbytes, err := kubeadmutil.MarshalToYamlForCodecs(cfg, gv, kubeadmscheme.Codecs) if err != nil { return []byte{}, err diff --git a/cmd/kubeadm/app/util/config/masterconfig_test.go b/cmd/kubeadm/app/util/config/masterconfig_test.go index c53efbb4698..f35f9f158dd 100644 --- a/cmd/kubeadm/app/util/config/masterconfig_test.go +++ b/cmd/kubeadm/app/util/config/masterconfig_test.go @@ -101,7 +101,7 @@ func TestConfigFileAndDefaultsToInternalConfig(t *testing.T) { for _, rt := range tests { t.Run(rt.name, func(t2 *testing.T) { - internalcfg, err := ConfigFileAndDefaultsToInternalConfig(rt.in, &kubeadmapiv1alpha3.MasterConfiguration{}) + internalcfg, err := ConfigFileAndDefaultsToInternalConfig(rt.in, &kubeadmapiv1alpha3.InitConfiguration{}) if err != nil { if rt.expectedErr { return @@ -109,7 +109,7 @@ func TestConfigFileAndDefaultsToInternalConfig(t *testing.T) { t2.Fatalf("couldn't unmarshal test data: %v", err) } - actual, err := MarshalMasterConfigurationToBytes(internalcfg, rt.groupVersion) + actual, err := MarshalInitConfigurationToBytes(internalcfg, rt.groupVersion) if err != nil { t2.Fatalf("couldn't marshal internal object: %v", err) } diff --git a/cmd/kubeadm/app/util/etcd/etcd.go b/cmd/kubeadm/app/util/etcd/etcd.go index 3470da6b5c9..4b11bcb42b8 100644 --- a/cmd/kubeadm/app/util/etcd/etcd.go +++ b/cmd/kubeadm/app/util/etcd/etcd.go @@ -218,7 +218,7 @@ func (c Client) WaitForClusterAvailable(delay time.Duration, retries int, retryI return false, fmt.Errorf("timeout waiting for etcd cluster to be available") } -// CheckConfigurationIsHA returns true if the given MasterConfiguration etcd block appears to be an HA configuration. +// CheckConfigurationIsHA returns true if the given InitConfiguration etcd block appears to be an HA configuration. func CheckConfigurationIsHA(cfg *kubeadmapi.Etcd) bool { return cfg.External != nil && len(cfg.External.Endpoints) > 1 } diff --git a/cmd/kubeadm/app/util/marshal.go b/cmd/kubeadm/app/util/marshal.go index 94c80416e23..b66e3d655f4 100644 --- a/cmd/kubeadm/app/util/marshal.go +++ b/cmd/kubeadm/app/util/marshal.go @@ -147,9 +147,9 @@ func GroupVersionKindsHasKind(gvks []schema.GroupVersionKind, kind string) bool return false } -// GroupVersionKindsHasMasterConfiguration returns whether the following gvk slice contains a MasterConfiguration object -func GroupVersionKindsHasMasterConfiguration(gvks []schema.GroupVersionKind) bool { - return GroupVersionKindsHasKind(gvks, constants.MasterConfigurationKind) +// GroupVersionKindsHasInitConfiguration returns whether the following gvk slice contains a InitConfiguration object +func GroupVersionKindsHasInitConfiguration(gvks []schema.GroupVersionKind) bool { + return GroupVersionKindsHasKind(gvks, constants.InitConfigurationKind) } // GroupVersionKindsHasNodeConfiguration returns whether the following gvk slice contains a NodeConfiguration object diff --git a/cmd/kubeadm/app/util/marshal_test.go b/cmd/kubeadm/app/util/marshal_test.go index a06ff9f6162..d5737ce4732 100644 --- a/cmd/kubeadm/app/util/marshal_test.go +++ b/cmd/kubeadm/app/util/marshal_test.go @@ -109,9 +109,9 @@ func TestMarshalUnmarshalYaml(t *testing.T) { } func TestMarshalUnmarshalToYamlForCodecs(t *testing.T) { - cfg := &kubeadmapiv1alpha3.MasterConfiguration{ + cfg := &kubeadmapiv1alpha3.InitConfiguration{ TypeMeta: metav1.TypeMeta{ - Kind: "MasterConfiguration", + Kind: "InitConfiguration", APIVersion: kubeadmapiv1alpha3.SchemeGroupVersion.String(), }, API: kubeadmapiv1alpha3.API{ @@ -133,36 +133,36 @@ func TestMarshalUnmarshalToYamlForCodecs(t *testing.T) { }, } - kubeadmapiv1alpha3.SetDefaults_MasterConfiguration(cfg) + kubeadmapiv1alpha3.SetDefaults_InitConfiguration(cfg) scheme := runtime.NewScheme() kubeadmapiv1alpha3.AddToScheme(scheme) codecs := serializer.NewCodecFactory(scheme) bytes, err := MarshalToYamlForCodecs(cfg, kubeadmapiv1alpha3.SchemeGroupVersion, codecs) if err != nil { - t.Fatalf("unexpected error marshalling MasterConfiguration: %v", err) + t.Fatalf("unexpected error marshalling InitConfiguration: %v", err) } t.Logf("\n%s", bytes) obj, err := UnmarshalFromYamlForCodecs(bytes, kubeadmapiv1alpha3.SchemeGroupVersion, codecs) if err != nil { - t.Fatalf("unexpected error unmarshalling MasterConfiguration: %v", err) + t.Fatalf("unexpected error unmarshalling InitConfiguration: %v", err) } - cfg2, ok := obj.(*kubeadmapiv1alpha3.MasterConfiguration) + cfg2, ok := obj.(*kubeadmapiv1alpha3.InitConfiguration) if !ok || cfg2 == nil { - t.Fatal("did not get MasterConfiguration back") + t.Fatal("did not get InitConfiguration back") } if !reflect.DeepEqual(*cfg, *cfg2) { t.Errorf("expected %v, got %v", *cfg, *cfg2) } } -// {{MasterConfiguration kubeadm.k8s.io/v1alpha3} [{ nil [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4200ad2c0 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes} -// {{MasterConfiguration kubeadm.k8s.io/v1alpha3} [{ &Duration{Duration:24h0m0s,} [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4205c5260 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204dd82c} map[] kubernetes} +// {{InitConfiguration kubeadm.k8s.io/v1alpha3} [{ nil [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4200ad2c0 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes} +// {{InitConfiguration kubeadm.k8s.io/v1alpha3} [{ &Duration{Duration:24h0m0s,} [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4205c5260 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204dd82c} map[] kubernetes} -// {{MasterConfiguration kubeadm.k8s.io/v1alpha3} [{abcdef.abcdef0123456789 nil [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42012ca80 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes} -// {{MasterConfiguration kubeadm.k8s.io/v1alpha3} [{abcdef.abcdef0123456789 &Duration{Duration:24h0m0s,} [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42039d1a0 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204fef3c} map[] kubernetes} +// {{InitConfiguration kubeadm.k8s.io/v1alpha3} [{abcdef.abcdef0123456789 nil [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42012ca80 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes} +// {{InitConfiguration kubeadm.k8s.io/v1alpha3} [{abcdef.abcdef0123456789 &Duration{Duration:24h0m0s,} [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42039d1a0 } {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204fef3c} map[] kubernetes} func TestSplitYAMLDocuments(t *testing.T) { var tests = []struct { @@ -339,7 +339,7 @@ func TestGroupVersionKindsHasKind(t *testing.T) { } } -func TestGroupVersionKindsHasMasterConfiguration(t *testing.T) { +func TestGroupVersionKindsHasInitConfiguration(t *testing.T) { var tests = []struct { name string gvks []schema.GroupVersionKind @@ -347,17 +347,17 @@ func TestGroupVersionKindsHasMasterConfiguration(t *testing.T) { expected bool }{ { - name: "NoMasterConfiguration", + name: "NoInitConfiguration", gvks: []schema.GroupVersionKind{ {Group: "foo.k8s.io", Version: "v1", Kind: "Foo"}, }, expected: false, }, { - name: "MasterConfigurationFound", + name: "InitConfigurationFound", gvks: []schema.GroupVersionKind{ {Group: "foo.k8s.io", Version: "v1", Kind: "Foo"}, - {Group: "bar.k8s.io", Version: "v2", Kind: "MasterConfiguration"}, + {Group: "bar.k8s.io", Version: "v2", Kind: "InitConfiguration"}, }, expected: true, }, @@ -366,9 +366,9 @@ func TestGroupVersionKindsHasMasterConfiguration(t *testing.T) { for _, rt := range tests { t.Run(rt.name, func(t2 *testing.T) { - actual := GroupVersionKindsHasMasterConfiguration(rt.gvks) + actual := GroupVersionKindsHasInitConfiguration(rt.gvks) if rt.expected != actual { - t2.Errorf("expected gvks has MasterConfiguration: %t\n\tactual: %t\n", rt.expected, actual) + t2.Errorf("expected gvks has InitConfiguration: %t\n\tactual: %t\n", rt.expected, actual) } }) } diff --git a/cmd/kubeadm/app/util/staticpod/utils.go b/cmd/kubeadm/app/util/staticpod/utils.go index 76d2ecb326d..5943247dfa5 100644 --- a/cmd/kubeadm/app/util/staticpod/utils.go +++ b/cmd/kubeadm/app/util/staticpod/utils.go @@ -82,7 +82,7 @@ func ComponentResources(cpu string) v1.ResourceRequirements { } // ComponentProbe is a helper function building a ready v1.Probe object from some simple parameters -func ComponentProbe(cfg *kubeadmapi.MasterConfiguration, componentName string, port int, path string, scheme v1.URIScheme) *v1.Probe { +func ComponentProbe(cfg *kubeadmapi.InitConfiguration, componentName string, port int, path string, scheme v1.URIScheme) *v1.Probe { return &v1.Probe{ Handler: v1.Handler{ HTTPGet: &v1.HTTPGetAction{ @@ -99,7 +99,7 @@ func ComponentProbe(cfg *kubeadmapi.MasterConfiguration, componentName string, p } // EtcdProbe is a helper function for building a shell-based, etcdctl v1.Probe object to healthcheck etcd -func EtcdProbe(cfg *kubeadmapi.MasterConfiguration, componentName string, port int, certsDir string, CACertName string, CertName string, KeyName string) *v1.Probe { +func EtcdProbe(cfg *kubeadmapi.InitConfiguration, componentName string, port int, certsDir string, CACertName string, CertName string, KeyName string) *v1.Probe { tlsFlags := fmt.Sprintf("--cacert=%[1]s/%[2]s --cert=%[1]s/%[3]s --key=%[1]s/%[4]s", certsDir, CACertName, CertName, KeyName) // etcd pod is alive if a linearizable get succeeds. cmd := fmt.Sprintf("ETCDCTL_API=3 etcdctl --endpoints=https://[%s]:%d %s get foo", GetProbeAddress(cfg, componentName), port, tlsFlags) @@ -218,7 +218,7 @@ func ReadStaticPodFromDisk(manifestPath string) (*v1.Pod, error) { // GetProbeAddress returns an IP address or 127.0.0.1 to use for liveness probes // in static pod manifests. -func GetProbeAddress(cfg *kubeadmapi.MasterConfiguration, componentName string) string { +func GetProbeAddress(cfg *kubeadmapi.InitConfiguration, componentName string) string { switch { case componentName == kubeadmconstants.KubeAPIServer: // In the case of a self-hosted deployment, the initial host on which kubeadm --init is run, diff --git a/cmd/kubeadm/app/util/staticpod/utils_test.go b/cmd/kubeadm/app/util/staticpod/utils_test.go index 815e8434d89..7200def0ea2 100644 --- a/cmd/kubeadm/app/util/staticpod/utils_test.go +++ b/cmd/kubeadm/app/util/staticpod/utils_test.go @@ -46,7 +46,7 @@ func TestComponentResources(t *testing.T) { func TestComponentProbe(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration component string port int path string @@ -55,7 +55,7 @@ func TestComponentProbe(t *testing.T) { }{ { name: "default apiserver advertise address with http", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{ AdvertiseAddress: "", }, @@ -68,7 +68,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "default apiserver advertise address with http", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{ AdvertiseAddress: "1.2.3.4", }, @@ -84,7 +84,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "default apiserver advertise address with https", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{ AdvertiseAddress: "", }, @@ -97,7 +97,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid ipv4 apiserver advertise address with http", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{ AdvertiseAddress: "1.2.3.4", }, @@ -110,7 +110,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid ipv6 apiserver advertise address with http", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ API: kubeadmapi.API{ AdvertiseAddress: "2001:db8::1", }, @@ -123,7 +123,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid IPv4 controller-manager probe", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ControllerManagerExtraArgs: map[string]string{"address": "1.2.3.4"}, }, component: kubeadmconstants.KubeControllerManager, @@ -134,7 +134,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid IPv6 controller-manager probe", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ ControllerManagerExtraArgs: map[string]string{"address": "2001:db8::1"}, }, component: kubeadmconstants.KubeControllerManager, @@ -145,7 +145,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid IPv4 scheduler probe", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ SchedulerExtraArgs: map[string]string{"address": "1.2.3.4"}, }, component: kubeadmconstants.KubeScheduler, @@ -156,7 +156,7 @@ func TestComponentProbe(t *testing.T) { }, { name: "valid IPv6 scheduler probe", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ SchedulerExtraArgs: map[string]string{"address": "2001:db8::1"}, }, component: kubeadmconstants.KubeScheduler, @@ -194,7 +194,7 @@ func TestComponentProbe(t *testing.T) { func TestEtcdProbe(t *testing.T) { var tests = []struct { name string - cfg *kubeadmapi.MasterConfiguration + cfg *kubeadmapi.InitConfiguration component string port int certsDir string @@ -205,7 +205,7 @@ func TestEtcdProbe(t *testing.T) { }{ { name: "valid etcd probe using listen-client-urls IPv4 addresses", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -223,7 +223,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid etcd probe using listen-client-urls unspecified IPv6 address", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -241,7 +241,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid etcd probe using listen-client-urls unspecified IPv6 address 2", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -259,7 +259,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid etcd probe using listen-client-urls unspecified IPv6 address 3", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -277,7 +277,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid etcd probe using listen-client-urls unspecified IPv4 address", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -295,7 +295,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid etcd probe using listen-client-urls IPv6 addresses", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ @@ -313,7 +313,7 @@ func TestEtcdProbe(t *testing.T) { }, { name: "valid IPv4 etcd probe using hostname for listen-client-urls", - cfg: &kubeadmapi.MasterConfiguration{ + cfg: &kubeadmapi.InitConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ ExtraArgs: map[string]string{ diff --git a/cmd/kubeadm/test/util.go b/cmd/kubeadm/test/util.go index ab177dbc8ef..c6487a02563 100644 --- a/cmd/kubeadm/test/util.go +++ b/cmd/kubeadm/test/util.go @@ -42,10 +42,10 @@ func SetupTempDir(t *testing.T) string { return tmpdir } -// SetupMasterConfigurationFile is a utility function for kubeadm testing that writes a master configuration file +// SetupInitConfigurationFile is a utility function for kubeadm testing that writes a master configuration file // into /config subfolder of a given temporary directory. // The function returns the path of the created master configuration file. -func SetupMasterConfigurationFile(t *testing.T, tmpdir string, cfg *kubeadmapi.MasterConfiguration) string { +func SetupInitConfigurationFile(t *testing.T, tmpdir string, cfg *kubeadmapi.InitConfiguration) string { cfgPath := filepath.Join(tmpdir, "config/masterconfig.yaml") if err := os.MkdirAll(filepath.Dir(cfgPath), os.FileMode(0755)); err != nil { @@ -54,7 +54,7 @@ func SetupMasterConfigurationFile(t *testing.T, tmpdir string, cfg *kubeadmapi.M cfgTemplate := template.Must(template.New("init").Parse(dedent.Dedent(` apiVersion: kubeadm.k8s.io/v1alpha3 - kind: MasterConfiguration + kind: InitConfiguration certificatesDir: {{.CertificatesDir}} api: advertiseAddress: {{.API.AdvertiseAddress}}