1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-17 23:49:06 +00:00

Handle deleting all controlplane nodes when nodes are unreachable

This commit is contained in:
galal-hussein
2018-09-27 01:26:20 +02:00
committed by Alena Prokharchyk
parent 2bd4577b19
commit ce62c898bb
3 changed files with 36 additions and 14 deletions

View File

@@ -315,7 +315,20 @@ func (c *Cluster) deployAddons(ctx context.Context) error {
return nil
}
func (c *Cluster) SyncLabelsAndTaints(ctx context.Context) error {
func (c *Cluster) SyncLabelsAndTaints(ctx context.Context, currentCluster *Cluster) error {
// Handle issue when deleting all controlplane nodes https://github.com/rancher/rancher/issues/15810
if currentCluster != nil {
cpToDelete := hosts.GetToDeleteHosts(currentCluster.ControlPlaneHosts, c.ControlPlaneHosts, c.InactiveHosts)
if len(cpToDelete) == len(currentCluster.ControlPlaneHosts) {
log.Infof(ctx, "[sync] Cleaning left control plane nodes from reconcilation")
for _, toDeleteHost := range cpToDelete {
if err := cleanControlNode(ctx, c, currentCluster, toDeleteHost); err != nil {
return err
}
}
}
}
if len(c.ControlPlaneHosts) > 0 {
log.Infof(ctx, "[sync] Syncing nodes Labels and Taints")
k8sClient, err := k8s.NewClient(c.LocalKubeConfigPath, c.K8sWrapTransport)