Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent deletion of kluster as long as nodepools are present #81

Merged
merged 5 commits into from
Nov 2, 2017

Conversation

SchwarzM
Copy link
Contributor

If nodes are still present during a terminate the routes will not be deleted from the neutron router.
As long as we do not implement a more sophisticated cleanup we should prevent klusters with
nodepools from terminating.

@SchwarzM SchwarzM self-assigned this Oct 27, 2017
@@ -20,7 +21,18 @@ type terminateCluster struct {

func (d *terminateCluster) Handle(params operations.TerminateClusterParams, principal *models.Principal) middleware.Responder {

_, err := editCluster(d.Kubernikus.Kubernikus().Klusters(d.Namespace), principal, params.Name, func(kluster *v1.Kluster) {
k, err := d.Kubernikus.Kubernikus().Klusters(d.Namespace).Get(qualifiedName(params.Name, principal.Account), metav1.GetOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's extract this kluster a variable, so we can reuse it later...

return NewErrorResponse(&operations.TerminateClusterDefault{}, 409, "Cluster still has NodePools")
}

_, err = editCluster(d.Kubernikus.Kubernikus().Klusters(d.Namespace), principal, params.Name, func(kluster *v1.Kluster) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse kluster from above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove the double error handling below...

@BugRoger BugRoger merged commit 50cd40e into master Nov 2, 2017
@databus23 databus23 deleted the no_delete_kluster_with_nodepool branch November 10, 2017 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants