From 90d711dd69245ff0b9c8b53a36c82b1895948d2a Mon Sep 17 00:00:00 2001 From: Audra Stump Date: Thu, 14 Nov 2024 21:49:19 -0800 Subject: [PATCH] cert manager is only installed if version mismatch or not yet installed Update Tiltfile Update Tiltfile --- tilt_modules/cert_manager/Tiltfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tilt_modules/cert_manager/Tiltfile b/tilt_modules/cert_manager/Tiltfile index f5d23e41372..39f1d885f2f 100644 --- a/tilt_modules/cert_manager/Tiltfile +++ b/tilt_modules/cert_manager/Tiltfile @@ -47,8 +47,13 @@ def deploy_cert_manager(registry="quay.io/jetstack", version="v1.3.1", load_to_k # NOTE! # Applying the same manifest twice to same cluster kubectl get stuck with older versions of kubernetes/cert-manager. # https://github.com/jetstack/cert-manager/issues/3121 - print("Installing cert-manager") - local("kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/{}/cert-manager.yaml".format(version), quiet=silent, echo_off=silent) + + #verify that the installed version is the same as the version parameter and cert-manager is installed + #install the cert-manager if one of these is false + installed_version = local("kubectl get deployment -n cert-manager cert-manager -o=jsonpath='{.spec.template.spec.containers[0].image}' | awk -F':' '{print $2}'") + if str(installed_version).strip()!= version: + print("Cert-manager either not installed or version mismatch, installing...") + local("kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/{}/cert-manager.yaml".format(version)) # verifies cert-manager is properly working (https://cert-manager.io/docs/installation/kubernetes/#verifying-the-installation) # 1. wait for the cert-manager to be running