Skip to content

Commit

Permalink
Fix AAD pod identity integration for sovereign clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon committed Nov 23, 2021
1 parent 953e88a commit 312d548
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions azure/scope/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (p *AzureCredentialsProvider) GetAuthorizer(ctx context.Context, resourceMa
var spt *adal.ServicePrincipalToken
switch p.Identity.Spec.Type {
case infrav1.ServicePrincipal:
if err := createAzureIdentityWithBindings(ctx, p.Identity, clusterMeta, p.Client); err != nil {
if err := createAzureIdentityWithBindings(ctx, p.Identity, resourceManagerEndpoint, activeDirectoryEndpoint, clusterMeta, p.Client); err != nil {
return nil, err
}

Expand Down Expand Up @@ -212,7 +212,7 @@ func (p *AzureCredentialsProvider) GetTenantID() string {
return p.Identity.Spec.TenantID
}

func createAzureIdentityWithBindings(ctx context.Context, azureIdentity *infrav1.AzureClusterIdentity, clusterMeta metav1.ObjectMeta,
func createAzureIdentityWithBindings(ctx context.Context, azureIdentity *infrav1.AzureClusterIdentity, resourceManagerEndpoint, activeDirectoryEndpoint string, clusterMeta metav1.ObjectMeta,
kubeClient client.Client) error {
azureIdentityType, err := getAzureIdentityType(azureIdentity)
if err != nil {
Expand Down Expand Up @@ -247,6 +247,8 @@ func createAzureIdentityWithBindings(ctx context.Context, azureIdentity *infrav1
ClientID: azureIdentity.Spec.ClientID,
ClientPassword: azureIdentity.Spec.ClientSecret,
ResourceID: azureIdentity.Spec.ResourceID,
ADResourceID: resourceManagerEndpoint,
ADEndpoint: activeDirectoryEndpoint,
},
}
err = kubeClient.Create(ctx, copiedIdentity)
Expand Down

0 comments on commit 312d548

Please sign in to comment.