Merge pull request #92505 from DataDog/jb/az-cloud-init

azure: use the parsed value from the configuration
This commit is contained in:
Kubernetes Prow Robot 2020-07-01 00:07:26 -07:00 committed by GitHub
commit 5fe980beff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -391,7 +391,7 @@ func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret bool) erro
// No credentials provided, useInstanceMetadata should be enabled for Kubelet.
// TODO(feiskyer): print different error message for Kubelet and controller-manager, as they're
// requiring different credential settings.
if !config.UseInstanceMetadata && az.Config.CloudConfigType == cloudConfigTypeFile {
if !config.UseInstanceMetadata && config.CloudConfigType == cloudConfigTypeFile {
return fmt.Errorf("useInstanceMetadata must be enabled without Azure credentials")
}

View File

@ -3324,8 +3324,8 @@ func TestInitializeCloudFromConfig(t *testing.T) {
AzureAuthConfig: auth.AzureAuthConfig{
Cloud: "AZUREPUBLICCLOUD",
},
CloudConfigType: cloudConfigTypeFile,
}
az.Config.CloudConfigType = cloudConfigTypeFile
err = az.InitializeCloudFromConfig(&config, false)
expectedErr = fmt.Errorf("useInstanceMetadata must be enabled without Azure credentials")
assert.Equal(t, expectedErr, err)