Skip to content

Commit 92954d6

Browse files
Updates operator to pass feature gate flags
This change updates the operator to support passing feature gates as flags to the operands. It only enables this for the MachineSet container.
1 parent b1482c9 commit 92954d6

File tree

5 files changed

+241
-20
lines changed

5 files changed

+241
-20
lines changed

pkg/operator/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type OperatorConfig struct {
2424
Controllers Controllers
2525
Proxy *configv1.Proxy
2626
PlatformType configv1.PlatformType
27+
Features map[string]bool
2728
}
2829

2930
type Controllers struct {

pkg/operator/operator.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,28 @@ func (optr *Operator) maoConfigFromInfrastructure() (*OperatorConfig, error) {
456456
return nil, err
457457
}
458458

459-
// in case the MHC controller is disabled, leave its image empty
460-
mhcImage := machineAPIOperatorImage
461459
featureGates, err := optr.featureGateAccessor.CurrentFeatureGates()
462460
if err != nil {
463461
return nil, err
464462
}
463+
464+
// in case the MHC controller is disabled, leave its image empty
465+
mhcImage := machineAPIOperatorImage
465466
if featureGates.Enabled(apifeatures.FeatureGateMachineAPIOperatorDisableMachineHealthCheckController) {
466467
klog.V(2).Info("Disabling MHC controller")
467468
mhcImage = ""
468469
}
469470

471+
// Given we only support the MachineAPIMigration featuregate being passed by
472+
// flags, it shold be the only thing populated our map (and therefore passed
473+
// as args)
474+
features := map[string]bool{
475+
string(apifeatures.FeatureGateMachineAPIMigration): featureGates.Enabled(apifeatures.FeatureGateMachineAPIMigration),
476+
}
477+
if features[string(apifeatures.FeatureGateMachineAPIMigration)] {
478+
klog.V(2).Info("Enabling MachineAPIMigration for provider controller and machinesets")
479+
}
480+
470481
return &OperatorConfig{
471482
TargetNamespace: optr.namespace,
472483
Proxy: clusterWideProxy,
@@ -479,5 +490,6 @@ func (optr *Operator) maoConfigFromInfrastructure() (*OperatorConfig, error) {
479490
TerminationHandler: terminationHandlerImage,
480491
},
481492
PlatformType: provider,
493+
Features: features,
482494
}, nil
483495
}

0 commit comments

Comments
 (0)