Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
AzKeyName = "posit-team-dedicated"
KeyVaultAdminRoleId = "00482a5a-887f-4fb3-b363-3b7fe8e74483" // Key Vault Administrator built-in role
StorageBlobDataContribRoleId = "ba92f5b4-2d11-453d-a403-e96b0029c9fe" // Storage Blob Data Contributor built-in role
AksRbacClusterAdminRoleId = "b1ff04bb-8a4e-4dc4-8eb5-8693973ce19b" // Azure Kubernetes Service RBAC Cluster Admin built-in role

// Tags
POSIT_TEAM_ENVIRONMENT = "posit.team/environment"
Expand Down
13 changes: 13 additions & 0 deletions lib/steps/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ func (s *BootstrapStep) runAzure(ctx context.Context, c types.Credentials, _ str
}
}

// Ensure AKS RBAC Cluster Admin role assignment exists for admin group
s.Log.Info("Ensuring AKS RBAC Cluster Admin role assignment exists", "adminGroupId", azureTarget.AdminGroupID())
aksRbacExists, err := azure.RoleAssignmentExists(ctx, azureCreds, azureTarget.SubscriptionID(), azureTarget.ResourceGroupName(), azureTarget.AdminGroupID(), consts.AksRbacClusterAdminRoleId)
if err != nil {
return err
}
if !aksRbacExists {
err = azure.CreateRoleAssignment(ctx, azureCreds, azureTarget.SubscriptionID(), azureTarget.ResourceGroupName(), azureTarget.AdminGroupID(), consts.AksRbacClusterAdminRoleId)
if err != nil {
return err
}
}

// create site secrets, certain site secret values are populated in later steps rather than here
for siteName := range s.DstTarget.Sites() {
s.Log.Info("Creating site secrets if they don't exist", "site", siteName)
Expand Down
Loading