Skip to content

Commit 55828d0

Browse files
committed
misc fixes
1 parent ec57d8a commit 55828d0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pkg/credentialprovider/azure/azure_credentials.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (a *acrProvider) loadConfig(rdr io.Reader) error {
144144
klog.Errorf("Failed to load azure credential file: %v", err)
145145
}
146146

147-
a.environment, err = auth.ParseAzureEnvironment(a.config.Cloud, a.config.cloudFQDN, a.config.IdentitySystem)
147+
a.environment, err = auth.ParseAzureEnvironment(a.config.Cloud, a.config.CloudFQDN, a.config.IdentitySystem)
148148
if err != nil {
149149
return err
150150
}

staging/src/k8s.io/legacy-cloud-providers/azure/auth/azure_auth.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ type AzureAuthConfig struct {
6464
SubscriptionID string `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"`
6565
// IdentitySystem indicates the identity provider. Relevant only to hybrid clouds (Azure Stack).
6666
// Allowed values are 'azure_ad' (default), 'adfs'.
67-
IdentitySystem string `json:"identitySystem" yaml:"identitySystem"`
67+
IdentitySystem string `json:"identitySystem,omitempty" yaml:"identitySystem,omitempty"`
6868
// CloudFQDN represents the hybrid cloud's fully qualified domain name: {location}.{domain}
6969
// If set, cloud provider will generate its autorest.Environment instead of using one of the pre-defined ones.
70-
CloudFQDN string `json:"cloudFQDN" yaml:"cloudFQDN"`
70+
CloudFQDN string `json:"cloudFQDN,omitempty" yaml:"cloudFQDN,omitempty"`
7171
}
7272

7373
// GetServicePrincipalToken creates a new service principal token based on the configuration
@@ -142,11 +142,13 @@ func ParseAzureEnvironment(cloudName, cloudFQDN, identitySystem string) (*azure.
142142
klog.V(4).Infof("Loading environment from resource manager endpoint: %s", resourceManagerEndpoint)
143143
env, err = azure.EnvironmentFromURL(resourceManagerEndpoint, nameOverride)
144144
if err == nil && strings.EqualFold(cloudName, "AzureStackCloud") {
145-
azureStackOverrides(env, cloudFQDN, identitySystem)
145+
azureStackOverrides(&env, cloudFQDN, identitySystem)
146146
}
147147
} else if cloudName == "" {
148+
klog.V(4).Info("Using public cloud environment")
148149
env = azure.PublicCloud
149150
} else {
151+
klog.V(4).Infof("Using %s environment", cloudName)
150152
env, err = azure.EnvironmentFromName(cloudName)
151153
}
152154
return &env, err
@@ -167,7 +169,7 @@ func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.Private
167169
return certificate, rsaPrivateKey, nil
168170
}
169171

170-
func azureStackOverrides(env azure.Environment, cloudFQDN, identitySystem string) azure.Environment {
172+
func azureStackOverrides(env *azure.Environment, cloudFQDN, identitySystem string) {
171173
// if AzureStack, make sure the generated environment matches what AKSe currently generates
172174
env.ManagementPortalURL = fmt.Sprintf("https://portal.%s/", cloudFQDN)
173175
// TODO: figure out why AKSe does this
@@ -183,5 +185,4 @@ func azureStackOverrides(env azure.Environment, cloudFQDN, identitySystem string
183185
env.ActiveDirectoryEndpoint = strings.TrimSuffix(env.ActiveDirectoryEndpoint, "/")
184186
env.ActiveDirectoryEndpoint = strings.TrimSuffix(env.ActiveDirectoryEndpoint, "adfs")
185187
}
186-
return env
187188
}

0 commit comments

Comments
 (0)