From 60b7ea43e9d6caba6705064b6b02519df2b7385a Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Wed, 26 May 2021 11:48:46 -0600 Subject: [PATCH] Update cert_manager tilt extension to fix startup bug --- hack/boilerplate/boilerplate.py | 2 +- hack/verify-shellcheck.sh | 4 ++-- tilt_modules/cert_manager/README.md | 8 ++++---- tilt_modules/cert_manager/Tiltfile | 7 ++++--- tilt_modules/cert_manager/test/Tiltfile | 8 ++++++++ tilt_modules/cert_manager/test/test.sh | 7 +++++++ tilt_modules/extensions.json | 9 ++------- 7 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 tilt_modules/cert_manager/test/Tiltfile create mode 100755 tilt_modules/cert_manager/test/test.sh diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 24c51262e42c..9ab4b4497028 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -152,7 +152,7 @@ def file_extension(filename): return os.path.splitext(filename)[1].split(".")[-1].lower() skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh', - "vendor", "hack/boilerplate/test"] + "vendor", "hack/boilerplate/test", "tilt_modules"] # list all the files contain 'DO NOT EDIT', but are not generated skipped_ungenerated_files = ['hack/lib/swagger.sh', 'hack/boilerplate/boilerplate.py'] diff --git a/hack/verify-shellcheck.sh b/hack/verify-shellcheck.sh index 2576ad48131f..5920668a2c58 100755 --- a/hack/verify-shellcheck.sh +++ b/hack/verify-shellcheck.sh @@ -64,9 +64,9 @@ fi echo "Running shellcheck..." cd "${ROOT_PATH}" || exit -IGNORE_FILES=$(find . -name "*.sh" | grep third_party) +IGNORE_FILES=$(find . -name "*.sh" | grep "third_party\|tilt_modules") echo "Ignoring shellcheck on ${IGNORE_FILES}" -FILES=$(find . -name "*.sh" | grep -v third_party) +FILES=$(find . -name "*.sh" -not -path "./tilt_modules/*" -not -path "*third_party*") while read -r file; do "$SHELLCHECK" -x "$file" >> "${OUT}" 2>&1 done <<< "$FILES" diff --git a/tilt_modules/cert_manager/README.md b/tilt_modules/cert_manager/README.md index 08bdc2427851..1d1feb766ee4 100644 --- a/tilt_modules/cert_manager/README.md +++ b/tilt_modules/cert_manager/README.md @@ -12,15 +12,15 @@ load('ext://cert_manager', 'deploy_cert_manager') deploy_cert_manager() ``` -This will deploy cert-manager to you cluster and checks it actually works. +This will deploy cert-manager to your cluster and check that it actually works. -If working with Kind, its is possible to pass `load_to_kind=True` to `deploy_cert_manager` so -all the cert-manager images will be pre-pulled to your local environment and then loaded into Kind before installing. +If working with Kind, it's possible to pass `load_to_kind=True` to `deploy_cert_manager` so +all the cert-manager images will be pre-pulled to your local environment and then loaded into Kind before installing. This speeds up your workflow if you're repeatedly destroying and recreating your kind cluster, as it doesn't have to pull the images over the network each time. The full list of parameters accepted by `deploy_cert_manager` includes: - `registry` from which images should be pulled, defaults to `quay.io/jetstack` -- `version` of cert-manager to install, defaults to `v1.1.0` +- `version` of cert-manager to install, defaults to `v1.3.1` - `load_to_kind` (see above), defaults to `False` - `kind_cluster_name`, defaults to `kind` diff --git a/tilt_modules/cert_manager/Tiltfile b/tilt_modules/cert_manager/Tiltfile index ba6f17098b8e..f5d23e413722 100644 --- a/tilt_modules/cert_manager/Tiltfile +++ b/tilt_modules/cert_manager/Tiltfile @@ -26,7 +26,7 @@ spec: """ # Deploys cert manager to your environment -def deploy_cert_manager(registry="quay.io/jetstack", version="v1.1.0", load_to_kind=False, kind_cluster_name="kind"): +def deploy_cert_manager(registry="quay.io/jetstack", version="v1.3.1", load_to_kind=False, kind_cluster_name="kind"): silent=True if version.startswith('v0'): cert_manager_test_resources_versioned = cert_manager_test_resources.format(cert_manager_api_version='v1alpha2') @@ -59,6 +59,7 @@ def deploy_cert_manager(registry="quay.io/jetstack", version="v1.1.0", load_to_k # 2. create a test certificate print("Testing cert-manager") - local("cat << EOF | kubectl apply -f - " + cert_manager_test_resources_versioned + "EOF", quiet=silent, echo_off=silent) + # The webhook may refuse connections initially (despite the deployment being Available), so try several times. + local("for i in 1 2 3 4 5 6; do (kubectl apply -f - <