Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Oberlechner <[email protected]>
  • Loading branch information
geoberle committed May 9, 2024
1 parent f65234d commit a64724e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 42 deletions.
1 change: 0 additions & 1 deletion dev-infrastructure/configurations/svc-cluster.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ param workloadIdentities = items({
})
param deployMaestroInfra = false


// This parameter is always overriden in the Makefile
param currentUserId = ''
34 changes: 16 additions & 18 deletions dev-infrastructure/modules/aks-cluster-base.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -333,28 +333,26 @@ resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-01-01' = {
}

// az aks command invoke --resource-group hcp-standalone-mshen --name aro-hcp-cluster-001 --command "kubectl get ns"
resource currentUserAksClusterAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' =
if (length(currentUserId) > 0) {
scope: aksCluster
name: guid(location, aksClusterName, aksClusterAdminRoleId, currentUserId)
properties: {
roleDefinitionId: aksClusterAdminRoleId
principalId: currentUserId
principalType: 'User'
}
resource currentUserAksClusterAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (length(currentUserId) > 0) {
scope: aksCluster
name: guid(location, aksClusterName, aksClusterAdminRoleId, currentUserId)
properties: {
roleDefinitionId: aksClusterAdminRoleId
principalId: currentUserId
principalType: 'User'
}
}

// az aks command invoke --resource-group hcp-standalone-mshen --name aro-hcp-cluster-001 --command "kubectl get ns"
resource currentUserAksRbacClusterAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' =
if (length(currentUserId) > 0) {
scope: aksCluster
name: guid(location, aksClusterName, aksClusterRbacClusterAdminRoleId, currentUserId)
properties: {
roleDefinitionId: aksClusterRbacClusterAdminRoleId
principalId: currentUserId
principalType: 'User'
}
resource currentUserAksRbacClusterAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (length(currentUserId) > 0) {
scope: aksCluster
name: guid(location, aksClusterName, aksClusterRbacClusterAdminRoleId, currentUserId)
properties: {
roleDefinitionId: aksClusterRbacClusterAdminRoleId
principalId: currentUserId
principalType: 'User'
}
}

resource uami 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = [
for wi in workloadIdentities: {
Expand Down
2 changes: 0 additions & 2 deletions dev-infrastructure/modules/maestro-eventgrid-access.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ resource mqttClient 'Microsoft.EventGrid/namespaces/clients@2023-12-15-preview'
}
}


// managed identity to access the certificate in key vault
resource certificateAccessManagedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
location: location
name: 'maestro-${location}-${clientName}'
}


var keyVaultCertificateUserRoleId = subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions/',
'db79e9a7-68ee-4b58-9aeb-b90e7c24fcba'
Expand Down
17 changes: 8 additions & 9 deletions dev-infrastructure/modules/maestro-infra.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,15 @@ var keyVaultAdminRoleId = subscriptionResourceId(
'00482a5a-887f-4fb3-b363-3b7fe8e74483'
)

resource keyVaultAdminRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' =
if (length(currentUserId) > 0) {
scope: kv
name: guid(location, maestroKeyVaultName, keyVaultAdminRoleId, currentUserId)
properties: {
roleDefinitionId: keyVaultAdminRoleId
principalId: currentUserId
principalType: 'User'
}
resource keyVaultAdminRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (length(currentUserId) > 0) {
scope: kv
name: guid(location, maestroKeyVaultName, keyVaultAdminRoleId, currentUserId)
properties: {
roleDefinitionId: keyVaultAdminRoleId
principalId: currentUserId
principalType: 'User'
}
}

//
// E V E N T G R I D
Expand Down
23 changes: 11 additions & 12 deletions dev-infrastructure/templates/svc-cluster.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,18 @@ module svcCluster '../modules/aks-cluster-base.bicep' = {
}
var frontendMI = filter(svcCluster.outputs.userAssignedIdentities, id => id.uamiName == 'frontend')[0]

module rpCosmosDb '../modules/rp-cosmos.bicep' =
if (deployFrontendCosmos) {
name: 'rp_cosmos_db'
scope: resourceGroup()
params: {
location: location
aksNodeSubnetId: svcCluster.outputs.aksNodeSubnetId
vnetId: svcCluster.outputs.aksVnetId
disableLocalAuth: disableLocalAuth
userAssignedMI: frontendMI.uamiID
uamiPrincipalId: frontendMI.uamiPrincipalID
}
module rpCosmosDb '../modules/rp-cosmos.bicep' = if (deployFrontendCosmos) {
name: 'rp_cosmos_db'
scope: resourceGroup()
params: {
location: location
aksNodeSubnetId: svcCluster.outputs.aksNodeSubnetId
vnetId: svcCluster.outputs.aksVnetId
disableLocalAuth: disableLocalAuth
userAssignedMI: frontendMI.uamiID
uamiPrincipalId: frontendMI.uamiPrincipalID
}
}

output frontend_mi_client_id string = frontendMI.uamiClientID

Expand Down

0 comments on commit a64724e

Please sign in to comment.