Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CS MI resource ID reference #880

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
2 changes: 1 addition & 1 deletion config/config.msft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defaults:

# MGMT cluster specifics
mgmt:
clusterServicePrincipalId: 'todo'
clusterServiceResourceId: 'todo'
subscription: hcp-{{ .ctx.region }}
rg: hcp-underlay-{{ .ctx.region }}-mgmt-{{ .ctx.stamp }}
etcd:
Expand Down
4 changes: 2 additions & 2 deletions config/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
"subscription": {
"type": "string"
},
"clusterServicePrincipalId": {
"clusterServiceResourceId": {
"type": "string"
},
"systemAgentPool": {
Expand Down Expand Up @@ -383,7 +383,7 @@
},
"additionalProperties": false,
"required": [
"clusterServicePrincipalId",
"clusterServiceResourceId",
"etcd",
"rg",
"systemAgentPool",
Expand Down
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defaults:

# MGMT cluster specifics
mgmt:
clusterServicePrincipalId: /subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-{{ .ctx.regionShort }}-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service
clusterServiceResourceId: /subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-{{ .ctx.regionShort }}-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service
subscription: hcp-{{ .ctx.region }}
rg: hcp-underlay-{{ .ctx.regionShort }}-mgmt-{{ .ctx.stamp }}
etcd:
Expand Down
2 changes: 1 addition & 1 deletion config/public-cloud-cs-pr.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"serverMqttClientName": "maestro-server-cspr-cs"
},
"mgmt": {
"clusterServicePrincipalId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-cspr-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"clusterServiceResourceId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-cspr-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"etcd": {
"kvName": "arohcp-etcd-cspr-1",
"kvSoftDelete": false
Expand Down
2 changes: 1 addition & 1 deletion config/public-cloud-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"serverMqttClientName": "maestro-server-dev-dev"
},
"mgmt": {
"clusterServicePrincipalId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-dev-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"clusterServiceResourceId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-dev-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"etcd": {
"kvName": "arohcp-etcd-dev-1",
"kvSoftDelete": false
Expand Down
2 changes: 1 addition & 1 deletion config/public-cloud-msft-int.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"serverMqttClientName": "maestro-server"
},
"mgmt": {
"clusterServicePrincipalId": "todo",
"clusterServiceResourceId": "todo",
"etcd": {
"kvName": "arohcp-etcd-int-1",
"kvSoftDelete": true
Expand Down
2 changes: 1 addition & 1 deletion config/public-cloud-personal-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"serverMqttClientName": "maestro-server-usw3tst"
},
"mgmt": {
"clusterServicePrincipalId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-usw3tst-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"clusterServiceResourceId": "/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourcegroups/hcp-underlay-usw3tst-svc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/clusters-service",
"etcd": {
"kvName": "arohcp-etcd-usw3tst-1",
"kvSoftDelete": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ param mgmtKeyVaultSoftDelete = {{ .mgmtKeyVault.softDelete }}

// Cluster Service identity
// used for Key Vault access
param clusterServicePrincipalId = '{{ .mgmt.clusterServicePrincipalId }}'
param clusterServiceMIResourceId = '{{ .mgmt.clusterServiceResourceId }}'

// MI for deployment scripts
param aroDevopsMsiId = '{{ .aroDevopsMsiId }}'
23 changes: 16 additions & 7 deletions dev-infrastructure/templates/mgmt-cluster.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ param mgmtKeyVaultPrivate bool
@description('Defines if the MGMT KeyVault has soft delete enabled')
param mgmtKeyVaultSoftDelete bool

@description('Cluster user assigned identity principal id, used to grant KeyVault access')
param clusterServicePrincipalId string
@description('Cluster user assigned identity resource id, used to grant KeyVault access')
param clusterServiceMIResourceId string

@description('MSI that will be used to run deploymentScripts')
param aroDevopsMsiId string
Expand Down Expand Up @@ -248,17 +248,26 @@ module mgmtKeyVault '../modules/keyvault/keyvault.bicep' = {
}
}

var clusterServiceMISplit = split(clusterServiceMIResourceId, '/')
var clusterServiceMIResourceGroup = clusterServiceMISplit[4]
var clusterServiceMIName = last(clusterServiceMISplit)

resource clusterServiceMI 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = {
scope: resourceGroup(clusterServiceMIResourceGroup)
name: clusterServiceMIName
}

module cxClusterServiceKeyVaultAccess '../modules/keyvault/keyvault-secret-access.bicep' = [
for role in [
'Key Vault Secrets Officer'
'Key Vault Certificate User'
'Key Vault Certificates Officer'
]: {
name: guid(cxKeyVaultName, clusterServicePrincipalId, role)
name: guid(cxKeyVaultName, clusterServiceMIResourceId, role)
params: {
keyVaultName: cxKeyVaultName
roleName: role
managedIdentityPrincipalId: clusterServicePrincipalId
managedIdentityPrincipalId: clusterServiceMI.properties.principalId
}
dependsOn: [
cxKeyVault
Expand All @@ -272,19 +281,19 @@ module msiClusterServiceKeyVaultAccess '../modules/keyvault/keyvault-secret-acce
'Key Vault Certificate User'
'Key Vault Certificates Officer'
]: {
name: guid(msiKeyVaultName, clusterServicePrincipalId, role)
name: guid(msiKeyVaultName, clusterServiceMIResourceId, role)
params: {
keyVaultName: msiKeyVaultName
roleName: role
managedIdentityPrincipalId: clusterServicePrincipalId
managedIdentityPrincipalId: clusterServiceMI.properties.principalId
}
dependsOn: [
msiKeyVault
]
}
]

//
//
// E V E N T G R I D P R I V A T E E N D P O I N T C O N N E C T I O N
//

Expand Down