Skip to content

Commit

Permalink
Using handlePDBFinalizers
Browse files Browse the repository at this point in the history
  • Loading branch information
triceras committed Jan 24, 2025
1 parent 6dbc9c3 commit 2d82ce6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion controllers/humiocluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ func (r *HumioClusterReconciler) ensureMismatchedPodsAreDeleted(ctx context.Cont

podsForDeletion := desiredLifecycleState.podsToBeReplaced

pdbSpec := hnp.GetPodDisruptionBudget() // Pass the HumioCluster instance
pdbSpec := hnp.GetPodDisruptionBudget()
r.Log.Info("Entering PDB enforcement check", "nodePool", hnp.GetNodePoolName(), "pdbSpec", pdbSpec, "pdbSpec.Enabled", pdbSpec != nil && pdbSpec.Enabled)
if pdbSpec != nil && pdbSpec.Enabled {
pdbName := fmt.Sprintf("%s-%s-pdb", hc.Name, hnp.GetNodePoolName())
Expand Down Expand Up @@ -2314,6 +2314,13 @@ func (r *HumioClusterReconciler) verifyHumioClusterConfigurationIsValid(ctx cont
}

func (r *HumioClusterReconciler) cleanupUnusedResources(ctx context.Context, hc *humiov1alpha1.HumioCluster, humioNodePools HumioNodePoolList) (reconcile.Result, error) {
if !hc.DeletionTimestamp.IsZero() {
if err := r.handlePDBFinalizers(ctx, hc); err != nil {
return r.updateStatus(ctx, r.Client.Status(), hc, statusOptions().
withMessage(fmt.Sprintf("failed to handle PDB finalizers: %s", err)))
}
}

for _, pool := range humioNodePools.Items {
if err := r.ensureOrphanedPvcsAreDeleted(ctx, hc, pool); err != nil {
return r.updateStatus(ctx, r.Client.Status(), hc, statusOptions().
Expand Down

0 comments on commit 2d82ce6

Please sign in to comment.