Merge pull request #55545 from osoriano/private/osoriano/gcp-initialize-alphafeaturegate

Automatic merge from submit-queue (batch tested with PRs 55545, 55548, 55815, 56136, 56185). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

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.

```release-note
NONE 
```

Closes #55544
This commit is contained in:
Kubernetes Submit Queue 2017-11-22 16:52:23 -08:00 committed by GitHub
commit 11cf604377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,6 +252,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