|
39 | 39 | # Clean up namespaces and any other resources left behind by the apps
|
40 | 40 | "${here}/.././bin/ck8s" ops kubectl sc delete ns dex opensearch-system harbor fluentd-system gatekeeper-system thanos ingress-nginx monitoring kured falco velero
|
41 | 41 |
|
| 42 | +# Remove finalizers from Velero resources, see breaking changes: https://github.com/vmware-tanzu/velero/releases/tag/v1.12.0 |
| 43 | +mapfile -t VELERO_CRDS < <("${here}/.././bin/ck8s" ops kubectl sc get crd -l component=velero -oyaml | \ |
| 44 | + yq4 '.items[] | .metadata.name' | tr -d '"') |
| 45 | + |
| 46 | +for velero_crd in "${VELERO_CRDS[@]}"; do |
| 47 | + mapfile -t VELERO_RESOURCES < <("${here}/.././bin/ck8s" ops kubectl sc get "${velero_crd}" -oyaml -n velero| \ |
| 48 | + yq4 '.items[] | select(.metadata | has("finalizers")).metadata.name') |
| 49 | + for velero_resource in "${VELERO_RESOURCES[@]}"; do |
| 50 | + "${here}/.././bin/ck8s" ops kubectl sc patch "${velero_crd}" "${velero_resource}" -n velero \ |
| 51 | + -p '{"metadata":{"finalizers":null}}' --type=merge |
| 52 | + done |
| 53 | +done |
| 54 | + |
42 | 55 | # Clean up any leftover challenges
|
43 | 56 | CHALLENGES=$(
|
44 |
| - "${here}/.././bin/ck8s" ops \ |
45 |
| - kubectl sc get challenge -A \ |
46 |
| - "-o=jsonpath='{range .items[*]}{.metadata.name}{\",\"}{.metadata.namespace}{\"\n\"}{end}'" |
| 57 | + "${here}/.././bin/ck8s" ops kubectl sc get challenge -A \ |
| 58 | + "-o=jsonpath='{range .items[*]}{.metadata.name}{\",\"}{.metadata.namespace}{\"\n\"}{end}'" |
47 | 59 | )
|
48 |
| -if [ -n "$CHALLENGES" ]; then |
49 |
| - for challenge in "${CHALLENGES[@]}"; do |
50 |
| - IFS=, read -r name namespace <<< "$challenge" |
51 |
| - "${here}/.././bin/ck8s" ops \ |
52 |
| - kubectl sc patch challenge \ |
53 |
| - "$name" -n "$namespace" \ |
54 |
| - "-p '{\"metadata\":{\"finalizers\":null}}'" \ |
55 |
| - --type=merge |
56 |
| - done |
57 |
| -fi |
| 60 | +for challenge in "${CHALLENGES[@]}"; do |
| 61 | + IFS=, read -r name namespace <<< "${challenge}" |
| 62 | + "${here}/.././bin/ck8s" ops \ |
| 63 | + kubectl sc patch challenge "${name}" -n "${namespace}" \ |
| 64 | + -p '{"metadata":{"finalizers":null}}' --type=merge |
| 65 | +done |
58 | 66 |
|
59 | 67 | if [ "${clusterAPIEnabled}" = "false" ]; then
|
60 | 68 | # Destroy cert-manager helm release
|
|
0 commit comments