nebari icon indicating copy to clipboard operation
nebari copied to clipboard

fix azure deployments so they can have a dash in project name

Open Adam-D-Lewis opened this issue 1 year ago • 3 comments

Reference Issues or PRs

Fixes https://github.com/nebari-dev/nebari/issues/2405

What does this implement/fix?

Put a x in the boxes that apply

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds a feature)
  • [ ] Breaking change (fix or feature that would cause existing features not to work as expected)
  • [ ] Documentation Update
  • [ ] Code style update (formatting, renaming)
  • [x] Refactoring (no functional changes, no API changes)
  • [ ] Build related changes
  • [ ] Other (please describe):

Testing

  • [x] Did you test the pull request locally?
  • [ ] Did you add new tests?

Any other comments?

Adam-D-Lewis avatar Apr 23 '24 02:04 Adam-D-Lewis

TODO: At a minimum I would need to do a migration of the nebari config file for Azure deployments during nebari upgrade.

Adam-D-Lewis avatar Apr 23 '24 02:04 Adam-D-Lewis

It's possible to fix https://github.com/nebari-dev/nebari/issues/2405 with a simpler PR, but I feel that this PR has several advantages:

  • I like that we've moved the storage account and container info into the terraform_state section of the config file rather than having it in the azure section of the config file. It makes more sense to have it in the terraform state section since the storage account and container are where the terraform state are saved.
  • Before this PR, the escaped_project_name attribute was used to satisfy the naming constraints of several different pieces of the Azure infrastructure, but this PR allows for more customized name mutations based on which component we are creating (e.g. storage account vs container registry). This is convenient since they have differing naming requirements (https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules)

I expect upgrading to need to set the account name and storage container name in the nebari config. I also expect upgrading to delete/create the container registry, but that shouldn't be a major problem.

Adam-D-Lewis avatar Apr 23 '24 03:04 Adam-D-Lewis

This causes a change in the Nebari config of Azure deployments from

provider: azure
namespace: dev
nebari_version: 2024.4.2
project_name: ne-bri6
domain: adam.nebari.dev
terraform_state:
  type: remote
security:
  keycloak:
    initial_root_password: broot
  authentication:
    type: password
azure:
  kubernetes_version: 1.29.0
  region: centralus
  storage_account_postfix: xhz2  # This key gets deleted ----------------------------------------------------
certificate:
  type: lets-encrypt
  acme_email: [email protected]

to

provider: azure
namespace: dev
nebari_version: 2024.4.2.dev2+g85d3a757
project_name: ne-bri6
domain: adam.nebari.dev
terraform_state:
  type: remote
  storage_account_name: nebri6xhz2  # This key gets added ----------------------------------------------------
  storage_container_name: nebri6  # This key gets added ----------------------------------------------------
security:
  keycloak:
    initial_root_password: df3vvlph2vcd53lcfsjq9p6nqzrn7j63
  authentication:
    type: password
azure:
  kubernetes_version: 1.29.2
  region: centralus
certificate:
  type: lets-encrypt
  acme_email: [email protected]

Notice the azure.storage_account_postfix key is deleted and replaced by the terraform_state.storage_account_name and terraform_state.storage_container_name keys.

Adam-D-Lewis avatar Apr 23 '24 03:04 Adam-D-Lewis