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

launch controller cleanup needs to wait on deorbiter #717

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pkg/apis/kubernikus/v1/kluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ func (k *Kluster) NeedsFinalizer(finalizer string) bool {
}

func (k *Kluster) HasFinalizer(finalizer string) bool {
if k.ObjectMeta.DeletionTimestamp == nil {
// not deleted. do not remove finalizers at this time
return false
}

for _, f := range k.ObjectMeta.Finalizers {
if f == finalizer {
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/deorbit/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func (d *DeorbitReconciler) Reconcile(kluster *v1.Kluster) (bool, error) {
if kluster.TerminationProtection() {
return false, nil
}
if kluster.ObjectMeta.DeletionTimestamp == nil {
return false, nil //wait until the kluster is marked for deletion
}
if kluster.HasFinalizer(DeorbiterFinalizer) {
if err := d.deorbit(kluster); err != nil {
return false, err
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/launch/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
v1 "github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
"github.com/sapcc/kubernikus/pkg/controller/base"
"github.com/sapcc/kubernikus/pkg/controller/config"
"github.com/sapcc/kubernikus/pkg/controller/deorbit"
"github.com/sapcc/kubernikus/pkg/controller/metrics"
"github.com/sapcc/kubernikus/pkg/controller/nodeobservatory"
informers_kubernikus "github.com/sapcc/kubernikus/pkg/generated/informers/externalversions/kubernikus/v1"
Expand Down Expand Up @@ -91,6 +92,9 @@ func (lr *LaunchReconciler) Reconcile(kluster *v1.Kluster) (requeue bool, err er
if kluster.TerminationProtection() {
return false, nil
}
if kluster.HasFinalizer(deorbit.DeorbiterFinalizer) {
return false, nil //Wait for dorbiter so that volumes are detached before deleting nodes
}

return lr.terminatePools(kluster)
}
Expand Down