Commit 5526b251 authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason Committed by Thong Kuah
Browse files

fix: Make delete function remove the PostgreSQL PVC

The new channel 2 postgres provisions PVCs using a volume claim
template, which is not managed by helm, and thus not deleted on helm
delete.

This breaks DB_INITIALIZE and DB_MIGRATE when those jobs expect a clean
volume.

See https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/issues/51
parent 8bddaa50
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -418,9 +418,13 @@ test-delete-postgresql:
    - auto-deploy deploy
    - helm get production
    - helm get production-postgresql
    - pvc_before_delete=$(kubectl -n $KUBE_NAMESPACE get pvc -l release=production-postgresql)
    - if [[ -z "$pvc_before_delete" ]]; then "expected to find a postgresql pvc"; exit 1; fi
    - auto-deploy delete
    - helm get production && expected_error || failed_as_expected
    - helm get production-postgresql && expected_error || failed_as_expected
    - pvc_after_delete=$(kubectl -n $KUBE_NAMESPACE get pvc -l release=production-postgresql)
    - if [[ -n "$pvc_after_delete" ]]; then echo "no postgresql pvc should be present"; exit 1; fi

test-delete-canary-postgresql:
  extends: test-deploy
+2 −0
Original line number Diff line number Diff line
@@ -379,9 +379,11 @@ function delete_postgresql() {

  if [[ -n "$(helm ls -q "^$name$")" ]]; then
    helm delete --purge "$name"
    kubectl delete pvc -n "$KUBE_NAMESPACE" -l "release=$POSTGRESQL_RELEASE_NAME"
  fi
}

# This deletes the PVC for the database if the track is stable
function delete() {
  local track="${1-stable}"
  local name