Skip to content

Commit

Permalink
Recreate stateful set in case field updates are invalid. (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored May 3, 2024
1 parent 60c2779 commit b0e2e8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion controllers/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,19 @@ func (r *DurosReconciler) deployCSI(ctx context.Context, projectID string, scs [
})

if err != nil {
return err
if apierrors.IsInvalid(err) {
// this means the statefulset needs recreation (for instance labels were modified), let's delete it
deleteErr := r.Shoot.Delete(ctx, sts)
if deleteErr != nil {
return fmt.Errorf("error deleting statefulset: %w", deleteErr)
}

log.Info("recreated statefulset", "name", sts.Name)
}

return fmt.Errorf("error creating or updating statefulset: %w", err)
}

log.Info("statefulset", "name", sts.Name, "operation", op)

ds := &apps.DaemonSet{ObjectMeta: metav1.ObjectMeta{Name: csiNodeDaemonSet.Name, Namespace: csiNodeDaemonSet.Namespace}}
Expand Down

0 comments on commit b0e2e8c

Please sign in to comment.