Skip to content

Commit

Permalink
Do not decommission when Node has taints
Browse files Browse the repository at this point in the history
Continue with Pod finalizer handling if allowPVCDeletion flag is not enabled or when
K8S Node does not report NoExecute taint effect with NodeUnreachable key.
  • Loading branch information
RafalKorepta committed Jun 18, 2024
1 parent e8ef83d commit ad31401
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/go/k8s/internal/controller/redpanda/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ func (r *ClusterReconciler) handlePodFinalizer(
untainted = false
}
}
if untainted {

// Continue with Pod finalizer handling if allowPVCDeletion flag is not enabled or when
// K8S Node does not report NoExecute taint effect with NodeUnreachable key.
if untainted || !r.allowPVCDeletion {
// remove the finalizer and let the pod be restarted
if err = r.removePodFinalizer(ctx, pod, log); err != nil {
return fmt.Errorf(`unable to remove finalizer from pod "%s": %w`, pod.Name, err)
Expand Down Expand Up @@ -411,13 +414,6 @@ func (r *ClusterReconciler) handlePodFinalizer(
}
}

if !r.allowPVCDeletion {
// remove the finalizer
if err = r.removePodFinalizer(ctx, pod, log); err != nil {
return fmt.Errorf(`unable to remove finalizer from pod "%s/%s: %w"`, pod.GetNamespace(), pod.GetName(), err)
}
return nil
}
// delete the associated pvc
if err = utils.DeletePodPVCs(ctx, r.Client, pod, log); err != nil {
return fmt.Errorf(`unable to remove VPCs for pod "%s/%s: %w"`, pod.GetNamespace(), pod.GetName(), err)
Expand Down

0 comments on commit ad31401

Please sign in to comment.