mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
kubeadm: cleanup master related taint and tolerations
This commit is contained in:
parent
b87a436aed
commit
4daf5f903b
@ -254,10 +254,6 @@ const (
|
||||
// CertificateKeySize specifies the size of the key used to encrypt certificates on uploadcerts phase
|
||||
CertificateKeySize = 32
|
||||
|
||||
// LabelNodeRoleOldControlPlane specifies that a node hosts control-plane components
|
||||
// DEPRECATED: https://github.com/kubernetes/kubeadm/issues/2200
|
||||
LabelNodeRoleOldControlPlane = "node-role.kubernetes.io/master"
|
||||
|
||||
// LabelNodeRoleControlPlane specifies that a node hosts control-plane components
|
||||
LabelNodeRoleControlPlane = "node-role.kubernetes.io/control-plane"
|
||||
|
||||
@ -439,20 +435,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// OldControlPlaneTaint is the taint to apply on the PodSpec for being able to run that Pod on the control-plane
|
||||
// DEPRECATED: https://github.com/kubernetes/kubeadm/issues/2200
|
||||
OldControlPlaneTaint = v1.Taint{
|
||||
Key: LabelNodeRoleOldControlPlane,
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
}
|
||||
|
||||
// OldControlPlaneToleration is the toleration to apply on the PodSpec for being able to run that Pod on the control-plane
|
||||
// DEPRECATED: https://github.com/kubernetes/kubeadm/issues/2200
|
||||
OldControlPlaneToleration = v1.Toleration{
|
||||
Key: LabelNodeRoleOldControlPlane,
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
}
|
||||
|
||||
// ControlPlaneTaint is the taint to apply on the PodSpec for being able to run that Pod on the control-plane
|
||||
ControlPlaneTaint = v1.Taint{
|
||||
Key: LabelNodeRoleControlPlane,
|
||||
|
@ -105,15 +105,13 @@ func EnsureDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Inter
|
||||
func coreDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interface, replicas *int32, out io.Writer, printManifest bool) error {
|
||||
// Get the YAML manifest
|
||||
coreDNSDeploymentBytes, err := kubeadmutil.ParseTemplate(CoreDNSDeployment, struct {
|
||||
DeploymentName, Image, OldControlPlaneTaintKey, ControlPlaneTaintKey string
|
||||
Replicas *int32
|
||||
DeploymentName, Image, ControlPlaneTaintKey string
|
||||
Replicas *int32
|
||||
}{
|
||||
DeploymentName: kubeadmconstants.CoreDNSDeploymentName,
|
||||
Image: images.GetDNSImage(cfg),
|
||||
// TODO: https://github.com/kubernetes/kubeadm/issues/2200
|
||||
OldControlPlaneTaintKey: kubeadmconstants.LabelNodeRoleOldControlPlane,
|
||||
ControlPlaneTaintKey: kubeadmconstants.LabelNodeRoleControlPlane,
|
||||
Replicas: replicas,
|
||||
DeploymentName: kubeadmconstants.CoreDNSDeploymentName,
|
||||
Image: images.GetDNSImage(cfg),
|
||||
ControlPlaneTaintKey: kubeadmconstants.LabelNodeRoleControlPlane,
|
||||
Replicas: replicas,
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error when parsing CoreDNS deployment template")
|
||||
|
@ -43,14 +43,13 @@ func TestCompileManifests(t *testing.T) {
|
||||
name: "CoreDNSDeployment manifest",
|
||||
manifest: CoreDNSDeployment,
|
||||
data: struct {
|
||||
DeploymentName, Image, OldControlPlaneTaintKey, ControlPlaneTaintKey string
|
||||
Replicas *int32
|
||||
DeploymentName, Image, ControlPlaneTaintKey string
|
||||
Replicas *int32
|
||||
}{
|
||||
DeploymentName: "foo",
|
||||
Image: "foo",
|
||||
OldControlPlaneTaintKey: "foo",
|
||||
ControlPlaneTaintKey: "foo",
|
||||
Replicas: &replicas,
|
||||
DeploymentName: "foo",
|
||||
Image: "foo",
|
||||
ControlPlaneTaintKey: "foo",
|
||||
Replicas: &replicas,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -127,15 +126,14 @@ func TestDeploymentsHaveSystemClusterCriticalPriorityClassName(t *testing.T) {
|
||||
name: "CoreDNSDeployment",
|
||||
manifest: CoreDNSDeployment,
|
||||
data: struct {
|
||||
DeploymentName, Image, OldControlPlaneTaintKey, ControlPlaneTaintKey, CoreDNSConfigMapName string
|
||||
Replicas *int32
|
||||
DeploymentName, Image, ControlPlaneTaintKey, CoreDNSConfigMapName string
|
||||
Replicas *int32
|
||||
}{
|
||||
DeploymentName: "foo",
|
||||
Image: "foo",
|
||||
OldControlPlaneTaintKey: "foo",
|
||||
ControlPlaneTaintKey: "foo",
|
||||
CoreDNSConfigMapName: "foo",
|
||||
Replicas: &replicas,
|
||||
DeploymentName: "foo",
|
||||
Image: "foo",
|
||||
ControlPlaneTaintKey: "foo",
|
||||
CoreDNSConfigMapName: "foo",
|
||||
Replicas: &replicas,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -92,8 +92,6 @@ spec:
|
||||
tolerations:
|
||||
- key: CriticalAddonsOnly
|
||||
operator: Exists
|
||||
- key: {{ .OldControlPlaneTaintKey }}
|
||||
effect: NoSchedule
|
||||
- key: {{ .ControlPlaneTaintKey }}
|
||||
effect: NoSchedule
|
||||
nodeSelector:
|
||||
|
@ -89,7 +89,6 @@ func TestMarkControlPlane(t *testing.T) {
|
||||
{
|
||||
name: "has taint and should merge with wanted taint",
|
||||
existingLabels: []string{
|
||||
kubeadmconstants.LabelNodeRoleOldControlPlane,
|
||||
kubeadmconstants.LabelNodeRoleControlPlane,
|
||||
kubeadmconstants.LabelExcludeFromExternalLB,
|
||||
},
|
||||
|
@ -124,10 +124,6 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
|
||||
RunAsNonRoot: pointer.Bool(true),
|
||||
},
|
||||
Tolerations: []v1.Toleration{
|
||||
{
|
||||
Key: constants.LabelNodeRoleOldControlPlane,
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
},
|
||||
{
|
||||
Key: constants.LabelNodeRoleControlPlane,
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
|
Loading…
Reference in New Issue
Block a user