File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ func initManager(ctx context.Context) (runtime.Options, error) {
276
276
options .LeaderElection = true
277
277
options .LeaderElectionID = lease
278
278
options .LeaderElectionNamespace = os .Getenv ("PGO_NAMESPACE" )
279
+ } else {
280
+ // K8SPG-761
281
+ options .LeaderElection = true
282
+ options .LeaderElectionID = perconaRuntime .ElectionID
279
283
}
280
284
281
285
// Check PGO_TARGET_NAMESPACE for backwards compatibility with
@@ -315,10 +319,6 @@ func initManager(ctx context.Context) (runtime.Options, error) {
315
319
}
316
320
}
317
321
318
- // K8SPG-761
319
- options .LeaderElection = true
320
- options .LeaderElectionID = perconaRuntime .ElectionID
321
-
322
322
return options , nil
323
323
}
324
324
Original file line number Diff line number Diff line change @@ -32,12 +32,14 @@ func TestInitManager(t *testing.T) {
32
32
})
33
33
34
34
assert .Assert (t , options .Cache .DefaultNamespaces == nil )
35
- assert .Assert (t , options .LeaderElection == false )
35
+ assert .Assert (t , options .LeaderElection == true )
36
36
37
37
{
38
38
options .Cache .SyncPeriod = nil
39
39
options .Controller .GroupKindConcurrency = nil
40
40
options .HealthProbeBindAddress = ""
41
+ options .LeaderElection = false
42
+ options .LeaderElectionID = ""
41
43
42
44
assert .Assert (t , reflect .ValueOf (options ).IsZero (),
43
45
"expected remaining fields to be unset:\n %+v" , options )
You can’t perform that action at this time.
0 commit comments