Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#205 from chuckha/fix-delete
Browse files Browse the repository at this point in the history
🐛 Fix DockerMachine delete for first control plane
  • Loading branch information
k8s-ci-robot authored Aug 20, 2019
2 parents 4e2ce55 + 64a6f42 commit c0b225a
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 c0b225a

Please sign in to comment.