mirror of
https://github.com/rancher/rke.git
synced 2025-08-10 11:13:44 +00:00
Make control node only unschedulable
This commit is contained in:
parent
aabce06714
commit
3c906a9ed2
@ -16,7 +16,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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 {
|
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 {
|
if host.IsEtcd {
|
||||||
host.ToDelTaints = append(host.ToDelTaints, unschedulableEtcdTaint)
|
host.ToDelTaints = append(host.ToDelTaints, unschedulableEtcdTaint)
|
||||||
}
|
}
|
||||||
|
if host.IsControl {
|
||||||
|
host.ToDelTaints = append(host.ToDelTaints, unschedulableControlTaint)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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 {
|
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
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !host.IsControl && !host.IsWorker {
|
if !host.IsWorker {
|
||||||
// Add unschedulable taint
|
if host.IsEtcd {
|
||||||
host.ToAddTaints = append(host.ToAddTaints, unschedulableEtcdTaint)
|
// Add unschedulable taint
|
||||||
|
host.ToAddTaints = append(host.ToAddTaints, unschedulableEtcdTaint)
|
||||||
|
}
|
||||||
|
if host.IsControl {
|
||||||
|
// Add unschedulable taint
|
||||||
|
host.ToAddTaints = append(host.ToAddTaints, unschedulableControlTaint)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
runHost := host
|
runHost := host
|
||||||
// maps are not thread safe
|
// maps are not thread safe
|
||||||
|
@ -183,8 +183,9 @@ spec:
|
|||||||
operator: Exists
|
operator: Exists
|
||||||
- effect: NoExecute
|
- effect: NoExecute
|
||||||
operator: Exists
|
operator: Exists
|
||||||
- key: "node-role.kubernetes.io/master"
|
- key: "node-role.kubernetes.io/controlplane"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
effect: "NoExecute"
|
||||||
- key: "node-role.kubernetes.io/etcd"
|
- key: "node-role.kubernetes.io/etcd"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
effect: "NoExecute"
|
effect: "NoExecute"
|
||||||
|
@ -240,8 +240,9 @@ spec:
|
|||||||
operator: Exists
|
operator: Exists
|
||||||
- effect: NoExecute
|
- effect: NoExecute
|
||||||
operator: Exists
|
operator: Exists
|
||||||
- key: "node-role.kubernetes.io/master"
|
- key: "node-role.kubernetes.io/controlplane"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
effect: "NoExecute"
|
||||||
- key: "node-role.kubernetes.io/etcd"
|
- key: "node-role.kubernetes.io/etcd"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
effect: "NoExecute"
|
effect: "NoExecute"
|
||||||
|
@ -148,9 +148,9 @@ spec:
|
|||||||
mountPath: /host/opt/cni/bin/
|
mountPath: /host/opt/cni/bin/
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
tolerations:
|
tolerations:
|
||||||
- key: node-role.kubernetes.io/master
|
- key: node-role.kubernetes.io/controlplane
|
||||||
operator: Exists
|
operator: Exists
|
||||||
effect: NoSchedule
|
effect: NoExecute
|
||||||
- key: node-role.kubernetes.io/etcd
|
- key: node-role.kubernetes.io/etcd
|
||||||
operator: Exists
|
operator: Exists
|
||||||
effect: NoExecute
|
effect: NoExecute
|
||||||
|
@ -14,6 +14,13 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
name: pi
|
name: pi
|
||||||
spec:
|
spec:
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/controlplane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoExecute
|
||||||
|
- key: node-role.kubernetes.io/etcd
|
||||||
|
operator: Exists
|
||||||
|
effect: NoExecute
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
serviceAccountName: rke-job-deployer
|
serviceAccountName: rke-job-deployer
|
||||||
nodeName: {{$nodeName}}
|
nodeName: {{$nodeName}}
|
||||||
|
@ -96,6 +96,12 @@ items:
|
|||||||
seLinuxOptions: {}
|
seLinuxOptions: {}
|
||||||
serviceAccountName: weave-net
|
serviceAccountName: weave-net
|
||||||
tolerations:
|
tolerations:
|
||||||
|
- key: "node-role.kubernetes.io/controlplane"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoExecute"
|
||||||
|
- key: "node-role.kubernetes.io/etcd"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoExecute"
|
||||||
- effect: NoExecute
|
- effect: NoExecute
|
||||||
operator: Exists
|
operator: Exists
|
||||||
volumes:
|
volumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user