Skip to content

Commit

Permalink
Fix DockerMachine delete for first control plane
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Ha <[email protected]>
  • Loading branch information
chuckha committed Aug 20, 2019
1 parent 771e5aa commit 64a6f42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docker/actions/cluster_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func DeleteClusterNode(clusterName, nodeName string) error {
if err != nil {
return errors.Wrap(err, "failed to list all control planes")
}
// If there is only one control plane being deleted do not update the corev1.Node list
if len(allControlPlanes) == 1 {
return nil
}
var node nodes.Node
// pick one that doesn't match the node name we are trying to delete
for _, n := range allControlPlanes {
Expand Down
4 changes: 2 additions & 2 deletions docker/actions/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (m *MachineActions) DeleteControlPlane(clusterName, nodeName string) error
fmt.Sprintf("name=%s$", nodeName),
)
if err != nil {
return nil
return errors.WithStack(err)
}

// assume it's already deleted
Expand All @@ -175,7 +175,7 @@ func (m *MachineActions) DeleteControlPlane(clusterName, nodeName string) error
// Delete the infrastructure
log.Info("Deleting node")
if err := nodes.Delete(node); err != nil {
return err
return errors.WithStack(err)
}
return ConfigureLoadBalancer(clusterName)
}
Expand Down

0 comments on commit 64a6f42

Please sign in to comment.