From 7d898d974f2353b5984deb4ad42347726205696a Mon Sep 17 00:00:00 2001 From: Jim Gauld Date: Wed, 12 Oct 2022 14:00:19 -0400 Subject: [PATCH 3/5] Revert "kubeadm: apply the new "control-plane" taint on CP nodes" This reverts commit 370031cadac6240e49e7b30a644d19735b7d3338. --- cmd/kubeadm/app/apis/kubeadm/types.go | 6 +++--- cmd/kubeadm/app/apis/kubeadm/v1beta2/doc.go | 2 +- cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go | 6 +++--- cmd/kubeadm/app/apis/kubeadm/v1beta3/doc.go | 2 +- cmd/kubeadm/app/apis/kubeadm/v1beta3/types.go | 6 +++--- cmd/kubeadm/app/util/config/initconfiguration.go | 2 +- cmd/kubeadm/app/util/config/initconfiguration_test.go | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go index d49256908e7..55d1fd9a06f 100644 --- a/cmd/kubeadm/app/apis/kubeadm/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/types.go @@ -218,9 +218,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, - // 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 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 []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 64ae2bb8f7c..24e58868dbe 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/containerd/containerd.sock" // taints: // - key: "kubeadmNode" -// value: "someValue" +// value: "master" // 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 a5cf40c513a..30037e30d40 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, - // 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 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 []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 8353359f91a..f7f34a7cffa 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/containerd/containerd.sock" // taints: // - key: "kubeadmNode" -// value: "someValue" +// value: "master" // 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 5a5151bf64b..82ae10cc271 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, - // 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 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 []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 7d1bb67fc02..71c3c514bf0 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, kubeadmconstants.ControlPlaneTaint} + cfg.Taints = []v1.Taint{kubeadmconstants.OldControlPlaneTaint} } if cfg.CRISocket == "" { diff --git a/cmd/kubeadm/app/util/config/initconfiguration_test.go b/cmd/kubeadm/app/util/config/initconfiguration_test.go index 074a1d821f4..93d7817a232 100644 --- a/cmd/kubeadm/app/util/config/initconfiguration_test.go +++ b/cmd/kubeadm/app/util/config/initconfiguration_test.go @@ -115,17 +115,17 @@ func TestDefaultTaintsMarshaling(t *testing.T) { expectedTaintCnt int }{ { - desc: "Uninitialized nodeRegistration field produces expected taints", + desc: "Uninitialized nodeRegistration field produces a single taint (the master one)", cfg: kubeadmapiv1.InitConfiguration{ TypeMeta: metav1.TypeMeta{ APIVersion: kubeadmapiv1.SchemeGroupVersion.String(), Kind: constants.InitConfigurationKind, }, }, - expectedTaintCnt: 2, + expectedTaintCnt: 1, }, { - desc: "Uninitialized taints field produces expected taints", + desc: "Uninitialized taints field produces a single taint (the master one)", cfg: kubeadmapiv1.InitConfiguration{ TypeMeta: metav1.TypeMeta{ APIVersion: kubeadmapiv1.SchemeGroupVersion.String(), @@ -133,7 +133,7 @@ func TestDefaultTaintsMarshaling(t *testing.T) { }, NodeRegistration: kubeadmapiv1.NodeRegistrationOptions{}, }, - expectedTaintCnt: 2, + expectedTaintCnt: 1, }, { desc: "Forsing taints to an empty slice produces no taints", -- 2.25.1