@@ -145,6 +145,9 @@ type TemplateData struct {
145145 // ClusterCIDR is the IP range for pod IPs.
146146 ClusterCIDR []string
147147
148+ // FeatureGates is list of featuregates to apply
149+ FeatureGates []string
150+
148151 // ServiceClusterIPRange is the IP range for service IPs.
149152 ServiceCIDR []string
150153
@@ -174,6 +177,9 @@ func (r *renderOpts) Run() error {
174177 TerminationGracePeriodSeconds : 135 , // bit more than 70s (minimal termination period) + 60s (apiserver graceful termination)
175178 ShutdownDelayDuration : "" , // do not override
176179 }
180+ if err := setFeatureGates (& renderConfig , r ); err != nil {
181+ return err
182+ }
177183 if len (r .clusterConfigFile ) > 0 {
178184 clusterConfigFileData , err := ioutil .ReadFile (r .clusterConfigFile )
179185 if err != nil {
@@ -461,6 +467,22 @@ func discoverCIDRsFromClusterAPI(clusterConfigFileData []byte, renderConfig *Tem
461467 return nil
462468}
463469
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+
464486func validateBoundSATokensSigningKeys (assetsDir string ) error {
465487 boundSAPublicPath := filepath .Join (assetsDir , "bound-service-account-signing-key.pub" )
466488 boundSAPrivatePath := filepath .Join (assetsDir , "bound-service-account-signing-key.key" )
0 commit comments