Skip to content

Commit 26749dc

Browse files
committed
cherry-pick 3a965a0 from release-1.6
Wait until the webhook is "actually" ready before running the smoke tests. Signed-off-by: Maël Valais <[email protected]>
1 parent 0589f68 commit 26749dc

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

smoke-test.Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
# Dockerfile: https://github.com/GoogleCloudPlatform/marketplace-testrunner/blob/master/Dockerfile
1010
FROM python:alpine
1111

12-
RUN apk add curl patch
12+
RUN apk add curl patch bash
1313
RUN pip3 install cram
14-
RUN curl -L https://github.com/stern/stern/releases/download/v1.19.0/stern_1.19.0_linux_amd64.tar.gz | tar xz -C /tmp \
15-
&& mv /tmp/stern_1.19.0_linux_amd64/stern /usr/local/bin \
16-
&& curl -L https://storage.googleapis.com/kubernetes-release/release/v1.19.6/bin/linux/amd64/kubectl --output-dir /usr/local/bin -O \
14+
RUN curl -L https://storage.googleapis.com/kubernetes-release/release/v1.19.6/bin/linux/amd64/kubectl --output-dir /usr/local/bin -O \
1715
&& chmod 755 /usr/local/bin/kubectl
1816

1917
WORKDIR /opt
@@ -24,4 +22,4 @@ ENV NAMESPACE=test
2422
# We don't use "kubectl logs" because we need to know to which container each
2523
# logs comes from. Also, stern follows logs and never returns, so we do the
2624
# pause trick.
27-
CMD ["sh", "-c", "cram smoke-test.t || (stern -A -l app.kubernetes.io/name=jetstack-secure-gcm & (sleep 5; exit 1))"]
25+
CMD ["sh", "-c", "cram smoke-test.t"]

smoke-test.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,22 @@ test suite. This image is used in a Job in data-test. mpdev verify detects the
77
presence of this Job thanks to the annotation
88
"marketplace.cloud.google.com/verification: test"
99

10-
First, let us create a self-signed Issuer and a Certificate. This is a good way
10+
Let's make sure the cert-manager API is actually ready. We do 2>/dev/null due to
11+
the fact that this command outputs an unknown number of lines, which is
12+
something I don't know how to express in cram syntax.
13+
14+
$ timeout 5m bash -c "until kubectl apply --dry-run=server -f- <<<$'kind: Issuer\napiVersion: cert-manager.io/v1\nmetadata:\n name: a\nspec:\n selfSigned: {}' 2>/dev/null >&2; do sleep 10s; done"
15+
$ kubectl apply --dry-run=server -f- <<EOF
16+
> kind: Issuer
17+
> apiVersion: cert-manager.io/v1
18+
> metadata:
19+
> name: a
20+
> spec:
21+
> selfSigned: {}
22+
> EOF
23+
issuer.cert-manager.io/a created (server dry run)
24+
25+
Let us create a self-signed Issuer and a Certificate. This is a good way
1126
to spot webhook misconfigurations.
1227

1328
$ kubectl apply -n ${NAMESPACE} -f - <<EOF

0 commit comments

Comments
 (0)