1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-31 06:49:54 +00:00

Make control node only unschedulable

This commit is contained in:
galal-hussein 2018-05-31 23:06:59 +02:00 committed by Alena Prokharchyk
parent aabce06714
commit 3c906a9ed2
7 changed files with 36 additions and 9 deletions

View File

@ -16,7 +16,8 @@ import (
)
const (
unschedulableEtcdTaint = "node-role.kubernetes.io/etcd=true:NoExecute"
unschedulableEtcdTaint = "node-role.kubernetes.io/etcd=true:NoExecute"
unschedulableControlTaint = "node-role.kubernetes.io/controlplane=true:NoExecute"
)
func ReconcileCluster(ctx context.Context, kubeCluster, currentCluster *Cluster, updateOnly bool) error {
@ -72,6 +73,9 @@ func reconcileWorker(ctx context.Context, currentCluster, kubeCluster *Cluster,
if host.IsEtcd {
host.ToDelTaints = append(host.ToDelTaints, unschedulableEtcdTaint)
}
if host.IsControl {
host.ToDelTaints = append(host.ToDelTaints, unschedulableControlTaint)
}
}
return nil
}

View File

@ -11,7 +11,8 @@ import (
)
const (
unschedulableEtcdTaint = "node-role.kubernetes.io/etcd=true:NoExecute"
unschedulableEtcdTaint = "node-role.kubernetes.io/etcd=true:NoExecute"
unschedulableControlTaint = "node-role.kubernetes.io/controlplane=true:NoExecute"
)
func RunWorkerPlane(ctx context.Context, allHosts []*hosts.Host, localConnDialerFactory hosts.DialerFactory, prsMap map[string]v3.PrivateRegistry, workerNodePlanMap map[string]v3.RKEConfigNodePlan, certMap map[string]pki.CertificatePKI, updateWorkersOnly bool, alpineImage string) error {
@ -23,9 +24,16 @@ func RunWorkerPlane(ctx context.Context, allHosts []*hosts.Host, localConnDialer
continue
}
}
if !host.IsControl && !host.IsWorker {
// Add unschedulable taint
host.ToAddTaints = append(host.ToAddTaints, unschedulableEtcdTaint)
if !host.IsWorker {
if host.IsEtcd {
// Add unschedulable taint
host.ToAddTaints = append(host.ToAddTaints, unschedulableEtcdTaint)
}
if host.IsControl {
// Add unschedulable taint
host.ToAddTaints = append(host.ToAddTaints, unschedulableControlTaint)
}
}
runHost := host
// maps are not thread safe

View File

@ -183,8 +183,9 @@ spec:
operator: Exists
- effect: NoExecute
operator: Exists
- key: "node-role.kubernetes.io/master"
- key: "node-role.kubernetes.io/controlplane"
operator: "Exists"
effect: "NoExecute"
- key: "node-role.kubernetes.io/etcd"
operator: "Exists"
effect: "NoExecute"

View File

@ -240,8 +240,9 @@ spec:
operator: Exists
- effect: NoExecute
operator: Exists
- key: "node-role.kubernetes.io/master"
- key: "node-role.kubernetes.io/controlplane"
operator: "Exists"
effect: "NoExecute"
- key: "node-role.kubernetes.io/etcd"
operator: "Exists"
effect: "NoExecute"

View File

@ -148,9 +148,9 @@ spec:
mountPath: /host/opt/cni/bin/
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/master
- key: node-role.kubernetes.io/controlplane
operator: Exists
effect: NoSchedule
effect: NoExecute
- key: node-role.kubernetes.io/etcd
operator: Exists
effect: NoExecute

View File

@ -14,6 +14,13 @@ spec:
metadata:
name: pi
spec:
tolerations:
- key: node-role.kubernetes.io/controlplane
operator: Exists
effect: NoExecute
- key: node-role.kubernetes.io/etcd
operator: Exists
effect: NoExecute
hostNetwork: true
serviceAccountName: rke-job-deployer
nodeName: {{$nodeName}}

View File

@ -96,6 +96,12 @@ items:
seLinuxOptions: {}
serviceAccountName: weave-net
tolerations:
- key: "node-role.kubernetes.io/controlplane"
operator: "Exists"
effect: "NoExecute"
- key: "node-role.kubernetes.io/etcd"
operator: "Exists"
effect: "NoExecute"
- effect: NoExecute
operator: Exists
volumes: