Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Update cert_manager tilt extension to fix startup bug #4680

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
4 changes: 2 additions & 2 deletions hack/verify-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 4 additions & 4 deletions tilt_modules/cert_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
7 changes: 4 additions & 3 deletions tilt_modules/cert_manager/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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 - <<EOF" + cert_manager_test_resources_versioned + "EOF\n) && break || sleep 15; done", quiet=silent, echo_off=silent)
local("kubectl wait --for=condition=Ready --timeout=300s -n cert-manager-test certificate/selfsigned-cert ", quiet=silent, echo_off=silent)
local("cat << EOF | kubectl delete -f - " + cert_manager_test_resources_versioned + "EOF", quiet=silent, echo_off=silent)
local("kubectl delete -f - <<EOF" + cert_manager_test_resources_versioned + "EOF", quiet=silent, echo_off=silent)
8 changes: 8 additions & 0 deletions tilt_modules/cert_manager/test/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load('../Tiltfile', 'deploy_cert_manager')

is_kind = k8s_context().startswith('kind-')
deploy_cert_manager(load_to_kind=is_kind)

local_resource(
name='verify-cert-manager',
cmd='kubectl wait --for=condition=Available --timeout=300s -n cert-manager deployment/cert-manager')
7 changes: 7 additions & 0 deletions tilt_modules/cert_manager/test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd $(dirname $0)

set -ex
tilt ci
tilt down --delete-namespaces
9 changes: 2 additions & 7 deletions tilt_modules/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
{
"Name": "cert_manager",
"ExtensionRegistry": "https://github.com/tilt-dev/tilt-extensions",
"TimeFetched": "2020-10-13T10:04:11.507324896-07:00"
},
{
"Name": "cert_manager",
"ExtensionRegistry": "https://github.com/tilt-dev/tilt-extensions",
"TimeFetched": "2021-02-03T16:29:09.695507+01:00"
"TimeFetched": "2021-05-26T11:19:57.411132-06:00"
}
]
}
}