mirror of
https://github.com/rancher/rke.git
synced 2025-09-18 08:06:20 +00:00
Fix resoncile missing taints
This commit is contained in:
@@ -113,14 +113,6 @@ func reconcileControl(ctx context.Context, currentCluster, kubeCluster *Cluster,
|
||||
if err := rebuildLocalAdminConfig(ctx, kubeCluster); err != nil {
|
||||
return err
|
||||
}
|
||||
// attempt to remove unschedulable taint
|
||||
toAddHosts := hosts.GetToAddHosts(currentCluster.ControlPlaneHosts, kubeCluster.ControlPlaneHosts)
|
||||
for _, host := range toAddHosts {
|
||||
kubeCluster.UpdateWorkersOnly = false
|
||||
if host.IsEtcd {
|
||||
host.ToDelTaints = append(host.ToDelTaints, unschedulableEtcdTaint)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
21
k8s/node.go
21
k8s/node.go
@@ -219,14 +219,8 @@ func doSyncTaints(k8sClient *kubernetes.Clientset, nodeName string, toAddTaints,
|
||||
node.Spec.Taints = append(node.Spec.Taints, toTaint(taintStr))
|
||||
}
|
||||
// Remove Taints from node
|
||||
for i, taintStr := range toDelTaints {
|
||||
if isTaintExist(toTaint(taintStr), node.Spec.Taints) {
|
||||
if len(node.Spec.Taints) == 1 {
|
||||
node.Spec.Taints = []v1.Taint{}
|
||||
} else {
|
||||
node.Spec.Taints = append(node.Spec.Taints[:i], node.Spec.Taints[i+1:]...)
|
||||
}
|
||||
}
|
||||
for _, taintStr := range toDelTaints {
|
||||
node.Spec.Taints = delTaintFromList(node.Spec.Taints, toTaint(taintStr))
|
||||
}
|
||||
|
||||
//node.Spec.Taints
|
||||
@@ -286,3 +280,14 @@ func SetAddressesAnnotations(k8sClient *kubernetes.Clientset, nodeName, internal
|
||||
}
|
||||
return listErr
|
||||
}
|
||||
|
||||
func delTaintFromList(l []v1.Taint, t v1.Taint) []v1.Taint {
|
||||
r := []v1.Taint{}
|
||||
for _, i := range l {
|
||||
if i == t {
|
||||
continue
|
||||
}
|
||||
r = append(r, i)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ func RunWorkerPlane(ctx context.Context, allHosts []*hosts.Host, localConnDialer
|
||||
// Add unschedulable taint
|
||||
host.ToAddTaints = append(host.ToAddTaints, unschedulableControlTaint)
|
||||
}
|
||||
|
||||
}
|
||||
runHost := host
|
||||
// maps are not thread safe
|
||||
|
Reference in New Issue
Block a user