Skip to content

Commit

Permalink
Merge pull request #113 from geoberle/make-ifndef
Browse files Browse the repository at this point in the history
ifndef indentation issue
  • Loading branch information
s-amann authored and mjlshen committed May 8, 2024
2 parents 2e01baa + 13760df commit 659a3bf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 47 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/dev-infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
branches:
- main
paths:
- 'dev-infrastructure/**'
- "dev-infrastructure/**"

jobs:
validate_bicep:
permissions:
contents: 'read'
contents: "read"
runs-on: ubuntu-latest

steps:
Expand All @@ -24,13 +24,15 @@ jobs:
fetch-depth: 1
sparse-checkout: dev-infrastructure

- name: 'az bicep format and lint'
working-directory: './dev-infrastructure'
- name: "az bicep format and lint"
working-directory: "./dev-infrastructure"
run: |
az upgrade --yes
az bicep upgrade
make fmt
make lint
- name: Check for uncommitted changes
working-directory: './dev-infrastructure'
working-directory: "./dev-infrastructure"
run: |
git diff --exit-code || (echo "::error::Uncommitted changes detected in OpenAPI spec. Please regenerate and commit them." && exit 1)
16 changes: 4 additions & 12 deletions dev-infrastructure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ lint:
az bicep lint --file $$file; \
done

show:
@echo "Resource group : $(RESOURCEGROUP)"
@echo "VPN resource group : $(VPNRESOURCEGROUP)"
@echo "AddressSpace prefix : $(PREFIX)"
@echo "AKS version : $(AKSVERSION)"
@echo "Location : $(LOCATION)"
@echo "AKS VNet Name : $(AKSVNETNAME)"
@echo "DNSZone/deployment : $(DEPLOYMENTNAME)"

setsubscription:
ifndef AKSCONFIG
$(error "Must set AKSCONFIG")
endif
if [[ -z $$AKSCONFIG ]]; then \
echo "Must set AKSCONFIG"; \
exit 1; \
fi
az account set --subscription $(HCPDEVSUBSCRIPTION)
az account show

Expand Down
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 @@ -316,28 +316,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
23 changes: 11 additions & 12 deletions dev-infrastructure/templates/svc-cluster.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,17 @@ 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

0 comments on commit 659a3bf

Please sign in to comment.