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

bicep refmt #117

Merged
merged 1 commit into from
May 9, 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
3 changes: 2 additions & 1 deletion .github/workflows/dev-infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
- name: 'az bicep format and lint'
working-directory: './dev-infrastructure'
run: |
az bicep version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you want to keep this?

What do you think about an az bicep upgrade here as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was running linting against it earlier, i was getting warnings about the 2023-04-01 (or 09-01) NSG/VNET resource id until i upgraded my bicep on the azure-cli.

Copy link
Contributor Author

@mjlshen mjlshen May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, just for easier troubleshooting - yesterday I had az bicep upgrade and it didn't actually upgrade in the GitHub Actions runner due to a bicep.use_binary_from_path configuration.

Take a look at this attempt from yesterday https://github.com/Azure/ARO-HCP/actions/runs/9006416096/job/24743908959 in the az bicep format and lint step

Run az bicep upgrade
WARNING: The configuration value of bicep.use_binary_from_path has been set to 'false'.
Installing Bicep CLI v0.26.170...
Successfully installed Bicep CLI to "/home/runner/.azure/bin/bicep".
set -e; \
FILES="$(find . -type f -name "*.bicep*")"; \
for file in $FILES; do \
echo "az bicep format --file ${file}"; \
az bicep format --file $file; \
done
az bicep format --file ./modules/aks-cluster-base.bicep
WARNING: A new Bicep release is available: v0.27.1. Upgrade now by running "az bicep upgrade".

make fmt
make lint

- name: Check for uncommitted changes
working-directory: './dev-infrastructure'
run: |
git diff --exit-code || (echo "::error::Uncommitted changes detected in OpenAPI spec. Please regenerate and commit them." && exit 1)
git diff --exit-code || (echo "::error::Uncommitted changes detected in bicep templates" && exit 1)
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
23 changes: 11 additions & 12 deletions dev-infrastructure/templates/svc-cluster.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,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