-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure: check existing role assignments before attempting to create a …
…new one Currently when re-reconciling an already-provisioned CredentialsRequest in Azure, the actuator will just always attempt to create a role assignment even if it already exists. There is error handling to catch the "RoleAssignmentExists" error, and it just moves along to the next task. This results in the Resource Group where the cluster is installed having periodic entries in the Activity Log recording these (non-critical) errors: ``` { "authorization": { "action": "Microsoft.Authorization/roleAssignments/write", "scope": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/jdiaz-az-gpqgx-rg/providers/Microsoft.Authorization/roleAssignments/94025186-5e7b-4e18-88de-4625cac3ed19" }, "level": "Error", "operationName": { "value": "Microsoft.Authorization/roleAssignments/write", "localizedValue": "Create role assignment" }, "resourceGroupName": "jdiaz-az-gpqgx-rg", "subStatus": { "value": "Conflict", "localizedValue": "Conflict (HTTP Status Code: 409)" }, "properties": { "statusCode": "Conflict", "serviceRequestId": "931445cc-fbc6-469a-a6f4-2f7750788255", "statusMessage": "{\"error\":{\"code\":\"RoleAssignmentExists\",\"message\":\"The role assignment already exists.\"}}" }, } ``` Change the logic to pull the current list of Role Assignments so that we can avoid making unnecessary CreateRoleAssignment calls.
- Loading branch information
Joel Diaz
committed
Nov 25, 2019
1 parent
475436e
commit ec23983
Showing
3 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters