Skip to content

Commit

Permalink
Fix cleanup error
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Jul 31, 2024
1 parent 5cda026 commit f171cf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 122 deletions.
4 changes: 2 additions & 2 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-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 accommodate this there is a script `setup-gmsa.sh` that does this configuration. The script has been converted to terraform and can be found at https://github.com/kubernetes/k8s.io/tree/main/infra/azure/terraform/capz.
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.

6 changes: 3 additions & 3 deletions capz/run-capz-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ create_gmsa_domain(){
export GMSA_NODE_RG="gmsa-dc-${GMSA_ID}"
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

0 comments on commit f171cf8

Please sign in to comment.