From 2c4f2f09349bd78a73ed6e25223e56bb60b630bb Mon Sep 17 00:00:00 2001 From: "Johannes M. Scheuermann" Date: Tue, 3 Dec 2024 11:56:32 +0100 Subject: [PATCH] Improve handling of test processes --- controllers/remove_process_groups.go | 2 +- controllers/update_status.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/controllers/remove_process_groups.go b/controllers/remove_process_groups.go index 770eabb2..1afdc7a3 100644 --- a/controllers/remove_process_groups.go +++ b/controllers/remove_process_groups.go @@ -384,7 +384,7 @@ func (r *FoundationDBClusterReconciler) getProcessGroupsToRemove(logger logr.Log } excluded, err := processGroup.AllAddressesExcluded(logger, remainingMap) - if !excluded || err != nil { + if processGroup.ProcessClass != fdbv1beta2.ProcessClassTest && (!excluded || err != nil) { logger.Info("Incomplete exclusion still present in removeProcessGroups step", "processGroupID", processGroup.ProcessGroupID, "error", err) allExcluded = false continue diff --git a/controllers/update_status.go b/controllers/update_status.go index 6a7e89b5..466b404a 100644 --- a/controllers/update_status.go +++ b/controllers/update_status.go @@ -392,6 +392,12 @@ func checkAndSetProcessStatus(logger logr.Logger, r *FoundationDBClusterReconcil excluded = process.Excluded } + if process.ProcessClass == fdbv1beta2.ProcessClassTest && processGroupStatus.IsMarkedForRemoval() { + processGroupStatus.ExclusionSkipped = ok + processGroupStatus.SetExclude() + excluded = true + } + if len(substitutions) == 0 { continue } @@ -440,7 +446,7 @@ func checkAndSetProcessStatus(logger logr.Logger, r *FoundationDBClusterReconcil // This allows to handle cases were a process was fully excluded but not yet removed and someone manually includes // the processes back. If multiple processes are running inside the pod and at least one process is excluded, // all processes are assumed to be excluded (as the operator always exclude all processes of a pod). - if !excluded && !processGroupStatus.ExclusionTimestamp.IsZero() { + if !excluded && !processGroupStatus.ExclusionSkipped && !processGroupStatus.ExclusionTimestamp.IsZero() { logger.Info("reset exclusion", "processGroupID", processGroupStatus.ProcessGroupID, "previousTimestamp", processGroupStatus.ExclusionTimestamp) processGroupStatus.ExclusionTimestamp = nil } @@ -491,7 +497,8 @@ func validateProcessGroups(ctx context.Context, r *FoundationDBClusterReconciler // If the process group should be removed without exclusion or the process class is test, remove it without // further checks. For the test processes there is no reason to try to exclude them as they are not maintaining // any data. - if ok || processGroup.ProcessClass == fdbv1beta2.ProcessClassTest { + if !processGroup.ExclusionSkipped && (ok || processGroup.ProcessClass == fdbv1beta2.ProcessClassTest) { + logger.V(1).Info("Process group is being removed without exclusion", "ProcessGroupID", processGroup.ProcessGroupID) processGroup.ExclusionSkipped = ok processGroup.SetExclude() }