Skip to content

Commit

Permalink
Merge pull request #1271 from whites11/managed-identity-worker-0-4
Browse files Browse the repository at this point in the history
[backport] Set identity settings in cloud config file for worker nodes as well
  • Loading branch information
k8s-ci-robot authored Mar 26, 2021
2 parents 2a24afe + 4c3b06b commit 5a264be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/azurejson_machinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *AzureJSONMachinePoolReconciler) Reconcile(req ctrl.Request) (_ ctrl.Res
azureMachinePool.Namespace,
azureMachinePool.Name,
owner,
infrav1.VMIdentityNone,
azureMachinePool.Spec.Identity,
"",
)

Expand Down
9 changes: 9 additions & 0 deletions controllers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ func systemAssignedIdentityCloudProviderConfig(d azure.ClusterScoper) (*CloudPro
controlPlaneConfig.AadClientID = ""
controlPlaneConfig.AadClientSecret = ""
controlPlaneConfig.UseManagedIdentityExtension = true
workerConfig.AadClientID = ""
workerConfig.AadClientSecret = ""
workerConfig.UseManagedIdentityExtension = true
return controlPlaneConfig, workerConfig
}

Expand All @@ -207,6 +210,10 @@ func userAssignedIdentityCloudProviderConfig(d azure.ClusterScoper, identityID s
controlPlaneConfig.AadClientSecret = ""
controlPlaneConfig.UseManagedIdentityExtension = true
controlPlaneConfig.UserAssignedIdentityID = identityID
workerConfig.AadClientID = ""
workerConfig.AadClientSecret = ""
workerConfig.UseManagedIdentityExtension = true
workerConfig.UserAssignedIdentityID = identityID
return controlPlaneConfig, workerConfig
}

Expand All @@ -233,6 +240,8 @@ func newCloudProviderConfig(d azure.ClusterScoper) (controlPlaneConfig *CloudPro
},
&CloudProviderConfig{
Cloud: d.CloudEnvironment(),
AadClientID: d.ClientID(),
AadClientSecret: d.ClientSecret(),
TenantID: d.TenantID(),
SubscriptionID: d.SubscriptionID(),
ResourceGroup: d.ResourceGroup(),
Expand Down
11 changes: 8 additions & 3 deletions controllers/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ const (
"cloud": "AzurePublicCloud",
"tenantId": "fooTenant",
"subscriptionId": "baz",
"aadClientId": "fooClient",
"aadClientSecret": "fooSecret",
"resourceGroup": "bar",
"securityGroupName": "foo-node-nsg",
"securityGroupResourceGroup": "bar",
Expand Down Expand Up @@ -401,7 +403,7 @@ const (
"routeTableName": "foo-node-routetable",
"loadBalancerSku": "Standard",
"maximumLoadBalancerRuleCount": 250,
"useManagedIdentityExtension": false,
"useManagedIdentityExtension": true,
"useInstanceMetadata": true
}`

Expand Down Expand Up @@ -439,8 +441,9 @@ const (
"routeTableName": "foo-node-routetable",
"loadBalancerSku": "Standard",
"maximumLoadBalancerRuleCount": 250,
"useManagedIdentityExtension": false,
"useInstanceMetadata": true
"useManagedIdentityExtension": true,
"useInstanceMetadata": true,
"userAssignedIdentityId": "foobar"
}`
spCustomVnetControlPlaneCloudConfig = `{
"cloud": "AzurePublicCloud",
Expand All @@ -466,6 +469,8 @@ const (
"cloud": "AzurePublicCloud",
"tenantId": "fooTenant",
"subscriptionId": "baz",
"aadClientId": "fooClient",
"aadClientSecret": "fooSecret",
"resourceGroup": "bar",
"securityGroupName": "foo-node-nsg",
"securityGroupResourceGroup": "custom-vnet-resource-group",
Expand Down

0 comments on commit 5a264be

Please sign in to comment.