@@ -145,6 +145,9 @@ type TemplateData struct {
145
145
// ClusterCIDR is the IP range for pod IPs.
146
146
ClusterCIDR []string
147
147
148
+ // FeatureGates is list of featuregates to apply
149
+ FeatureGates []string
150
+
148
151
// ServiceClusterIPRange is the IP range for service IPs.
149
152
ServiceCIDR []string
150
153
@@ -174,6 +177,9 @@ func (r *renderOpts) Run() error {
174
177
TerminationGracePeriodSeconds : 135 , // bit more than 70s (minimal termination period) + 60s (apiserver graceful termination)
175
178
ShutdownDelayDuration : "" , // do not override
176
179
}
180
+ if err := setFeatureGates (& renderConfig , r ); err != nil {
181
+ return err
182
+ }
177
183
if len (r .clusterConfigFile ) > 0 {
178
184
clusterConfigFileData , err := ioutil .ReadFile (r .clusterConfigFile )
179
185
if err != nil {
@@ -461,6 +467,22 @@ func discoverCIDRsFromClusterAPI(clusterConfigFileData []byte, renderConfig *Tem
461
467
return nil
462
468
}
463
469
470
+ func setFeatureGates (renderConfig * TemplateData , opts * renderOpts ) error {
471
+ featureSet , ok := configv1 .FeatureSets [configv1 .FeatureSet (opts .generic .FeatureSet )]
472
+ if ! ok {
473
+ return fmt .Errorf ("featureSet %q not found" , featureSet )
474
+ }
475
+ allGates := []string {}
476
+ for _ , enabled := range featureSet .Enabled {
477
+ allGates = append (allGates , fmt .Sprintf ("%v=true" , enabled ))
478
+ }
479
+ for _ , disabled := range featureSet .Disabled {
480
+ allGates = append (allGates , fmt .Sprintf ("%v=false" , disabled ))
481
+ }
482
+ renderConfig .FeatureGates = allGates
483
+ return nil
484
+ }
485
+
464
486
func validateBoundSATokensSigningKeys (assetsDir string ) error {
465
487
boundSAPublicPath := filepath .Join (assetsDir , "bound-service-account-signing-key.pub" )
466
488
boundSAPrivatePath := filepath .Join (assetsDir , "bound-service-account-signing-key.key" )
0 commit comments