if list of controllers only contains disabled controllers, implicitly enable all default controllers
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
parent
a2a06a1d12
commit
985607b08c
@ -243,6 +243,11 @@ func EnabledControllers(o *config.ControllerConfiguration) sets.Set[string] {
|
||||
}
|
||||
}
|
||||
|
||||
// Detect if "*" was implied (in case only disabled controllers were specified)
|
||||
if len(disabled) > 0 && len(enabled) == 0 {
|
||||
enabled = enabled.Insert(defaults.DefaultEnabledControllers...)
|
||||
}
|
||||
|
||||
enabled = enabled.Delete(disabled...)
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(feature.ExperimentalCertificateSigningRequestControllers) {
|
||||
|
||||
@ -50,6 +50,14 @@ func TestEnabledControllers(t *testing.T) {
|
||||
controllers: []string{"*", "-clusterissuers", "-issuers"},
|
||||
expEnabled: sets.New(defaults.DefaultEnabledControllers...).Delete("clusterissuers", "issuers"),
|
||||
},
|
||||
"if only disabled controllers are specified, implicitly enable all default controllers": {
|
||||
controllers: []string{"-clusterissuers", "-issuers"},
|
||||
expEnabled: sets.New(defaults.DefaultEnabledControllers...).Delete("clusterissuers", "issuers"),
|
||||
},
|
||||
"if both enabled and disabled controllers are specified, return specified controllers": {
|
||||
controllers: []string{"foo", "-bar"},
|
||||
expEnabled: sets.New("foo"),
|
||||
},
|
||||
}
|
||||
|
||||
for name, test := range tests {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user