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