@@ -26,8 +26,9 @@ import (
26
26
"strings"
27
27
"time"
28
28
29
- fdbv1beta2 "github.com/FoundationDB/fdb-kubernetes-operator/v2/api/v1beta2"
30
29
"github.com/FoundationDB/fdb-kubernetes-operator/v2/internal/restarts"
30
+
31
+ fdbv1beta2 "github.com/FoundationDB/fdb-kubernetes-operator/v2/api/v1beta2"
31
32
"github.com/FoundationDB/fdb-kubernetes-operator/v2/pkg/fdbadminclient"
32
33
"github.com/go-logr/logr"
33
34
)
@@ -400,6 +401,29 @@ func UpdateGlobalCoordinationState(
400
401
continue
401
402
}
402
403
404
+ // If the process group is missing long enough to be ignored, ensure that it's removed from the pending
405
+ // and the ready list.
406
+ if processGroup .GetConditionTime (fdbv1beta2 .IncorrectCommandLine ) != nil &&
407
+ ! restarts .ShouldBeIgnoredBecauseMissing (logger , cluster , processGroup ) {
408
+ // Check if the process group is present in pendingForRestart.
409
+ // If not add it to the according set.
410
+ if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ! ok {
411
+ updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
412
+ }
413
+ } else {
414
+ // Check if the process group is present in pendingForRestart or readyForRestart.
415
+ // If so, add them to the set to remove those entries as the process has the correct command line.
416
+ if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
417
+ logger .V (1 ).Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID )
418
+ updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
419
+ }
420
+
421
+ if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
422
+ logger .V (1 ).Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID )
423
+ updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
424
+ }
425
+ }
426
+
403
427
// Keep track of the visited process group to remove entries from removed process groups.
404
428
visited [processGroup .ProcessGroupID ] = fdbv1beta2.None {}
405
429
if processGroup .IsMarkedForRemoval () {
@@ -457,44 +481,29 @@ func UpdateGlobalCoordinationState(
457
481
updatesReadyForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
458
482
}
459
483
}
460
-
461
- // if the process group is excluded, we don't need to restart it.
462
- if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
463
- logger .V (1 ).
464
- Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
465
- updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
466
- }
467
-
468
- if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
469
- logger .V (1 ).
470
- Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
471
- updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
472
- }
473
484
}
474
485
475
486
// If the process group is stuck in terminating, we can add it to the ready for inclusion list.
476
487
if processGroup .GetConditionTime (fdbv1beta2 .ResourcesTerminating ) != nil {
477
488
if _ , ok := pendingForInclusion [processGroup .ProcessGroupID ]; ! ok {
478
489
logger .V (1 ).
479
- Info ("Adding to pendingForInclusion and readyForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal and in terminating" )
490
+ Info ("Adding to pendingForInclusion and readyForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is in terminating state " )
480
491
updatesPendingForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
481
492
updatesReadyForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
482
493
}
483
494
484
495
// If the process group is marked for removal and the resources are stuck in terminating or the processes are not running, we should
485
496
// remove them from the restart list, because there are no processes to restart.
486
- if processGroup .GetConditionTime (fdbv1beta2 .MissingProcesses ) != nil {
487
- if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
488
- logger .V (1 ).
489
- Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal" )
490
- updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
491
- }
497
+ if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
498
+ logger .V (1 ).
499
+ Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is in terminating state" )
500
+ updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
501
+ }
492
502
493
- if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
494
- logger .V (1 ).
495
- Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal" )
496
- updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
497
- }
503
+ if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
504
+ logger .V (1 ).
505
+ Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is in terminating state" )
506
+ updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
498
507
}
499
508
}
500
509
@@ -507,29 +516,6 @@ func UpdateGlobalCoordinationState(
507
516
508
517
continue
509
518
}
510
-
511
- // If the process group is missing long enough to be ignored, ensure that it's removed from the pending
512
- // and the ready list.
513
- if processGroup .GetConditionTime (fdbv1beta2 .IncorrectCommandLine ) != nil &&
514
- ! restarts .ShouldBeIgnoredBecauseMissing (logger , cluster , processGroup ) {
515
- // Check if the process group is present in pendingForRestart.
516
- // If not add it to the according set.
517
- if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ! ok {
518
- updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
519
- }
520
- } else {
521
- // Check if the process group is present in pendingForRestart or readyForRestart.
522
- // If so, add them to the set to remove those entries as the process has the correct command line.
523
- if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
524
- logger .V (1 ).Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID )
525
- updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
526
- }
527
-
528
- if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
529
- logger .V (1 ).Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID )
530
- updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
531
- }
532
- }
533
519
}
534
520
535
521
// Iterate over all the sets and mark all entries that are associated with a removed process group to be
0 commit comments