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

When moving to new sub, the name of the keyvault changed #459

Merged
merged 2 commits into from
Jul 31, 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 capz/gmsa/ci-gmsa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")
CI_RG="${CI_RG:-capz-ci}"
GMSA_NODE_RG="${GMSA_NODE_RG:-gmsa-dc}"
AZURE_LOCATION="${AZURE_LOCATION:-westus2}"
GMSA_KEYVAULT="${GMSA_KEYVAULT:-$CI_RG-gmsa}"
GMSA_KEYVAULT="${GMSA_KEYVAULT:-$CI_RG-gmsa-community}"

# The VM requires setup that needs Role Assignment permissions
# This script checks that all that has been configured properly before creating the Azure VM
Expand Down
2 changes: 1 addition & 1 deletion capz/gmsa/domain.init.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ write_files:
exit
}

$keyvaultName="${GMSA_KEYVAULT:-${CI_RG}-gmsa}"
$keyvaultName="${GMSA_KEYVAULT:-${CI_RG}-gmsa-community}"
$gmsaAdminName="gmsa-admin-${GMSA_ID}"
$gmsaUserName="gmsa-e2e-user-${GMSA_ID}"
$resourcegroup="${CI_RG}"
Expand Down
6 changes: 3 additions & 3 deletions capz/gmsa/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ A general overview of the required to run the gMSA:

![diagram of gmsa architecture with required vms and keyvaults](images/gmsa-design.png)

## Subscrition Setup
## Subscription Setup

The Azure subscription requires a few pre-requisits to be able run the tests. This is becuase the Managed Identities used with the gMSA plugin need Subscription Owner Permissions to create.
The Azure subscription requires a few pre-requisites to be able run the tests. This is because the Managed Identities used with the gMSA plugin need Subscription Owner Permissions to create.

To accomidate this there is a script `setup-gmsa.sh` that does this configuration.
The setup required can be found at the [k8s.io repo](https://github.com/kubernetes/k8s.io/tree/main/infra/azure/terraform/capz).

## Domain VM Creation

Expand Down
117 changes: 0 additions & 117 deletions capz/gmsa/setup-gmsa.sh

This file was deleted.

8 changes: 4 additions & 4 deletions capz/run-capz-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ create_gmsa_domain(){
export CI_RG="${CI_RG:-capz-ci}"
export GMSA_ID="${RANDOM}"
export GMSA_NODE_RG="gmsa-dc-${GMSA_ID}"
export GMSA_KEYVAULT_URL="https://${GMSA_KEYVAULT:-$CI_RG-gmsa}.vault.azure.net"
export GMSA_KEYVAULT_URL="https://${GMSA_KEYVAULT:-$CI_RG-gmsa-community}.vault.azure.net"

log "setting up domain vm in $GMSA_NODE_RG with keyvault $CI_RG-gmsa"
log "setting up domain vm in $GMSA_NODE_RG with keyvault $CI_RG-gmsa-community"
"${SCRIPT_ROOT}/gmsa/ci-gmsa.sh"

# export the ip Address so it can be used in e2e test
Expand Down Expand Up @@ -134,8 +134,8 @@ run_capz_e2e_cleanup() {
# clean up GMSA NODE RG
if [[ -n ${GMSA:-} ]]; then
echo "Cleaning up gMSA resources $GMSA_NODE_RG with keyvault $GMSA_KEYVAULT_URL"
az keyvault secret list --vault-name "${GMSA_KEYVAULT:-$CI_RG-gmsa}" --query "[? contains(name, '${GMSA_ID}')].name" -o tsv | while read -r secret ; do
az keyvault secret delete -n "$secret" --vault-name "${GMSA_KEYVAULT:-$CI_RG-gmsa}"
az keyvault secret list --vault-name "${GMSA_KEYVAULT:-$CI_RG-gmsa-community}" --query "[? contains(name, '${GMSA_ID}')].name" -o tsv | while read -r secret ; do
az keyvault secret delete -n "$secret" --vault-name "${GMSA_KEYVAULT:-$CI_RG-gmsa-community}"
done

az group delete --name "$GMSA_NODE_RG" --no-wait -y --force-deletion-types=Microsoft.Compute/virtualMachines --force-deletion-types=Microsoft.Compute/virtualMachineScaleSets || true
Expand Down
Loading