Ensure GCE AlphaFeatureGate initialized

If no config file is specified for the controller-manager,
the GCE CloudConfig.AlphaFeatureGate property is not initialized.

This can cause a panic when checking for alpha features in the GCE
provider.

Closes #55544
This commit is contained in:
osoriano 2017-11-12 05:09:42 +00:00
parent 858f3cbf59
commit 58513b8c0b

View File

@ -240,6 +240,8 @@ func generateCloudConfig(configFile *ConfigFile) (cloudConfig *CloudConfig, err
cloudConfig.TokenSource = google.ComputeTokenSource("")
cloudConfig.UseMetadataServer = true
featureMap := make(map[string]bool)
cloudConfig.AlphaFeatureGate = &AlphaFeatureGate{featureMap}
if configFile != nil {
if configFile.Global.ApiEndpoint != "" {
cloudConfig.ApiEndpoint = configFile.Global.ApiEndpoint