From 78d723b48b5bb7471c4cab6ebacb7a7020f5bb1e Mon Sep 17 00:00:00 2001 From: Axel Jarmar Date: Tue, 18 Jun 2024 11:53:11 +0200 Subject: [PATCH] release: add migration script for setting nginx annotations --- .../v0.39/prepare/70-set-nginx-annotations.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 migration/v0.39/prepare/70-set-nginx-annotations.sh diff --git a/migration/v0.39/prepare/70-set-nginx-annotations.sh b/migration/v0.39/prepare/70-set-nginx-annotations.sh new file mode 100644 index 000000000..09e56671a --- /dev/null +++ b/migration/v0.39/prepare/70-set-nginx-annotations.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$(readlink -f "${0}")")" +ROOT="$(readlink -f "${HERE}/../../../")" + +# shellcheck source=scripts/migration/lib.sh +source "${ROOT}/scripts/migration/lib.sh" + +if [[ "${CK8S_CLUSTER}" =~ ^(sc|wc|both)$ ]]; then + service_enabled=$(yq_dig common .ingressNginx.controller.service.enabled) + if [[ "${service_enabled}" != "true" ]]; then + log_info "ingress-nginx service not enabled, skipping" + exit 0 + fi + + annotations=$(yq_dig common .ingressNginx.controller.service.annotations) + if [[ ! "${annotations}" =~ ^set\-me ]]; then + log_info "ingress-nginx annotations are already set, skipping" + exit 0 + fi + + log_info "setting ingress-nginx annotations to empty object" + yq_add common .ingressNginx.controller.service.annotations {} +fi