Skip to content

Commit

Permalink
remove pod finalizer (#5060)
Browse files Browse the repository at this point in the history
* remove pod finalizer

* remove pod finalizer

* remove pod finalizer
  • Loading branch information
bearslyricattack authored Sep 10, 2024
1 parent d47170c commit b03274c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/devbox/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/labring/sealos/controllers/devbox

go 1.22.0
go 1.23

require (
github.com/avast/retry-go v2.7.0+incompatible
Expand Down
10 changes: 10 additions & 0 deletions controllers/devbox/internal/controller/devbox_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ func commitSuccess(podStatus corev1.PodPhase) bool {

func (r *DevboxReconciler) removeAll(ctx context.Context, devbox *devboxv1alpha1.Devbox, recLabels map[string]string) error {
// Delete Pod
var podList corev1.PodList
if err := r.List(ctx, &podList, client.InNamespace(devbox.Namespace), client.MatchingLabels(recLabels)); err != nil {
return err
}
for _, pod := range podList.Items {
controllerutil.RemoveFinalizer(&pod, FinalizerName)
if err := r.Update(ctx, &pod); err != nil {
return err
}
}
if err := r.deleteResourcesByLabels(ctx, &corev1.Pod{}, devbox.Namespace, recLabels); err != nil {
return err
}
Expand Down

0 comments on commit b03274c

Please sign in to comment.