Skip to content

Commit

Permalink
Improve tagging & deployment for install-contour/provisioner-working …
Browse files Browse the repository at this point in the history
…scripts

Signed-off-by: Harshil Patel <[email protected]>
  • Loading branch information
harshil1973 committed Dec 4, 2023
1 parent 55aa95d commit a1db613
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/scripts/install-contour-working.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ if ! kind::cluster::exists "$CLUSTERNAME" ; then
exit 2
fi

# Set (pseudo) random image tag to trigger restarts at every deployment.
# TODO: Come up with a scheme that doesn't fill up the dev environment with randomly-tagged images.
VERSION="v$$"
docker rmi ghcr.io/projectcontour/contour:dev --force

# Build the image.
make -C ${REPO} container IMAGE=ghcr.io/projectcontour/contour VERSION=${VERSION}
make -C ${REPO} container IMAGE=ghcr.io/projectcontour/contour VERSION=dev

# Push the Contour build image into the cluster.
kind::cluster::load::docker ghcr.io/projectcontour/contour:${VERSION}
kind::cluster::load::docker ghcr.io/projectcontour/contour:dev

# Install Contour
${KUBECTL} apply -f ${REPO}/examples/contour/00-common.yaml
Expand All @@ -71,11 +69,14 @@ for file in ${REPO}/examples/contour/02-job-certgen.yaml ${REPO}/examples/contou
# we built above.
sed \
"-es|imagePullPolicy: Always|imagePullPolicy: IfNotPresent|" \
"-es|image: ghcr.io/projectcontour/contour:.*$|image: ghcr.io/projectcontour/contour:${VERSION}|" \
"-es|image: ghcr.io/projectcontour/contour:.*$|image: ghcr.io/projectcontour/contour:dev|" \
"$file" | \
${KUBECTL} apply -f -
done

# Patching the deployment with timestamp will trigger pod restart.
${KUBECTL} patch deployment -n projectcontour contour --patch '{"spec": {"template": {"metadata": {"annotations": {"timestamp": "'$(date +%s)'"}}}}}'

# Wait for Contour and Envoy to report "Ready" status.
${KUBECTL} wait --timeout="${WAITTIME}" -n projectcontour -l app=contour deployments --for=condition=Available
${KUBECTL} wait --timeout="${WAITTIME}" -n projectcontour -l app=envoy pods --for=condition=Ready
5 changes: 5 additions & 0 deletions test/scripts/install-provisioner-working.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ ${KUBECTL} apply -f <(cat examples/gateway-provisioner/03-gateway-provisioner.ya
yq eval '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' - | \
yq eval '.spec.template.spec.containers[0].args += "--contour-image="+env(CONTOUR_IMG)' -)

# Patching the deployment with timestamp will trigger pod restart.
for deployment in $(kubectl get deployment -n projectcontour -l app.kubernetes.io/managed-by=contour-gateway-provisioner -o name) ; do
${KUBECTL} patch $deployment -n projectcontour --patch '{"spec": {"template": {"metadata": {"annotations": {"timestamp": "'$(date +%s)'"}}}}}'
done

# Wait for the provisioner to report "Ready" status.
${KUBECTL} wait --timeout="${WAITTIME}" -n projectcontour -l control-plane=contour-gateway-provisioner deployments --for=condition=Available
${KUBECTL} wait --timeout="${WAITTIME}" -n projectcontour -l control-plane=contour-gateway-provisioner pods --for=condition=Ready

0 comments on commit a1db613

Please sign in to comment.