1
0
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:
moelsayed
2018-08-03 03:16:58 +02:00
committed by Denise
parent 28db358ebd
commit 39b5ac1345
3 changed files with 13 additions and 17 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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