diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go index 870775251af..f14d9a6c717 100644 --- a/cmd/kubeadm/app/apis/kubeadm/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/types.go @@ -212,9 +212,9 @@ type NodeRegistrationOptions struct { // CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use CRISocket string - // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - // it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an - // empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. + // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, + // it will be defaulted with a control-plane taint for control-plane nodes. If you don't want to taint your control-plane + // node, set this field to an empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. Taints []v1.Taint // KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta2/doc.go b/cmd/kubeadm/app/apis/kubeadm/v1beta2/doc.go index be5ea5bbf9b..b28bfbbcf65 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta2/doc.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta2/doc.go @@ -172,7 +172,7 @@ limitations under the License. // criSocket: "unix:///var/run/dockershim.sock" // taints: // - key: "kubeadmNode" -// value: "master" +// value: "someValue" // effect: "NoSchedule" // kubeletExtraArgs: // v: 4 diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go b/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go index 61484b76277..cbce88907e3 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go @@ -201,9 +201,9 @@ type NodeRegistrationOptions struct { // CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use CRISocket string `json:"criSocket,omitempty"` - // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - // it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an - // empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. + // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, + // it will be defaulted with a control-plane taint for control-plane nodes. If you don't want to taint your control-plane + // node, set this field to an empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. Taints []v1.Taint `json:"taints"` // KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta3/doc.go b/cmd/kubeadm/app/apis/kubeadm/v1beta3/doc.go index 37a861885c9..f154f47a33c 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta3/doc.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta3/doc.go @@ -176,7 +176,7 @@ limitations under the License. // criSocket: "unix:///var/run/dockershim.sock" // taints: // - key: "kubeadmNode" -// value: "master" +// value: "someValue" // effect: "NoSchedule" // kubeletExtraArgs: // v: 4 diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta3/types.go b/cmd/kubeadm/app/apis/kubeadm/v1beta3/types.go index 765ec8c740e..dce38b8f692 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta3/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta3/types.go @@ -215,9 +215,9 @@ type NodeRegistrationOptions struct { // +optional CRISocket string `json:"criSocket,omitempty"` - // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - // it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an - // empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. + // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, + // it will be defaulted with a control-plane taint for control-plane nodes. If you don't want to taint your control-plane + // node, set this field to an empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration. Taints []corev1.Taint `json:"taints"` // KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file diff --git a/cmd/kubeadm/app/util/config/initconfiguration.go b/cmd/kubeadm/app/util/config/initconfiguration.go index 0b7917de168..0e2a61a7708 100644 --- a/cmd/kubeadm/app/util/config/initconfiguration.go +++ b/cmd/kubeadm/app/util/config/initconfiguration.go @@ -106,7 +106,7 @@ func SetNodeRegistrationDynamicDefaults(cfg *kubeadmapi.NodeRegistrationOptions, // Only if the slice is nil, we should append the control-plane taint. This allows the user to specify an empty slice for no default control-plane taint if controlPlaneTaint && cfg.Taints == nil { // TODO: https://github.com/kubernetes/kubeadm/issues/2200 - cfg.Taints = []v1.Taint{kubeadmconstants.OldControlPlaneTaint} + cfg.Taints = []v1.Taint{kubeadmconstants.OldControlPlaneTaint, kubeadmconstants.ControlPlaneTaint} } if cfg.CRISocket == "" { diff --git a/cmd/kubeadm/app/util/config/initconfiguration_test.go b/cmd/kubeadm/app/util/config/initconfiguration_test.go index 6672f294392..8378c663c93 100644 --- a/cmd/kubeadm/app/util/config/initconfiguration_test.go +++ b/cmd/kubeadm/app/util/config/initconfiguration_test.go @@ -116,17 +116,17 @@ func TestDefaultTaintsMarshaling(t *testing.T) { expectedTaintCnt int }{ { - desc: "Uninitialized nodeRegistration field produces a single taint (the master one)", + desc: "Uninitialized nodeRegistration field produces expected taints", cfg: kubeadmapiv1.InitConfiguration{ TypeMeta: metav1.TypeMeta{ APIVersion: kubeadmapiv1.SchemeGroupVersion.String(), Kind: constants.InitConfigurationKind, }, }, - expectedTaintCnt: 1, + expectedTaintCnt: 2, }, { - desc: "Uninitialized taints field produces a single taint (the master one)", + desc: "Uninitialized taints field produces expected taints", cfg: kubeadmapiv1.InitConfiguration{ TypeMeta: metav1.TypeMeta{ APIVersion: kubeadmapiv1.SchemeGroupVersion.String(), @@ -134,7 +134,7 @@ func TestDefaultTaintsMarshaling(t *testing.T) { }, NodeRegistration: kubeadmapiv1.NodeRegistrationOptions{}, }, - expectedTaintCnt: 1, + expectedTaintCnt: 2, }, { desc: "Forsing taints to an empty slice produces no taints",