azure: use the parsed value from the configuration

Signed-off-by: Julien Balestra <julien.balestra@datadoghq.com>
This commit is contained in:
Julien Balestra 2020-06-25 12:06:30 +02:00
parent 4a91ecb976
commit 5f5eea4a24
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)