Skip to content

Commit

Permalink
Use rendered contour Gateway API yamls
Browse files Browse the repository at this point in the history
By doing that we avoid restarting contour. This
a) speeds deployment up
b) avoids Contour occasionally not noticing Gateway API enablement change in its
config map

Co-authored-by: Danail Branekov <danailster@gmail.com>
  • Loading branch information
georgethebeatle and danail-branekov committed Jan 23, 2024
1 parent 8051ad3 commit 1e4b89d
Show file tree
Hide file tree
Showing 15 changed files with 19,714 additions and 8,829 deletions.
22 changes: 8 additions & 14 deletions scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ TEST_DIR="$SCRIPT_DIR/../tests"
DEP_DIR="$TEST_DIR/dependencies"
VENDOR_DIR="$TEST_DIR/vendor"

TEMP_FILES=()
trap 'for file in ${TEMP_FILES[@]}; do rm -rf $file; done' EXIT

function usage_text() {
cat <<EOF
Usage:
Expand Down Expand Up @@ -66,27 +69,18 @@ echo "********************"
echo " Installing Contour"
echo "********************"

kubectl apply -f "$VENDOR_DIR/gateway-api"
kubectl apply -f "$VENDOR_DIR/contour"
TEMP_FILES+=("$DEP_DIR/contour/contour-gateway.yaml")
cp "$VENDOR_DIR/contour/contour-gateway.yaml" "$DEP_DIR/contour/contour-gateway.yaml"
kubectl apply -k "$DEP_DIR/contour"

kubectl apply -f - <<EOF
kind: ConfigMap
apiVersion: v1
metadata:
name: contour
namespace: projectcontour
data:
contour.yaml: |
gateway:
controllerName: projectcontour.io/gateway-controller
---
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1beta1
metadata:
name: contour
spec:
controllerName: projectcontour.io/gateway-controller
EOF
kubectl -n projectcontour rollout restart deployment/contour

echo "************************************"
echo " Installing Service Binding Runtime"
Expand All @@ -102,7 +96,7 @@ if ! kubectl get apiservice v1beta1.metrics.k8s.io >/dev/null 2>&1; then
echo " Installing Metrics Server Insecure TLS options"
echo "************************************************"

trap "rm $DEP_DIR/insecure-metrics-server/components.yaml" EXIT
TEMP_FILES+=("$DEP_DIR/insecure-metrics-server/components.yaml")
cp "$VENDOR_DIR/metrics-server-local/components.yaml" "$DEP_DIR/insecure-metrics-server/components.yaml"
kubectl apply -k "$DEP_DIR/insecure-metrics-server"
else
Expand Down
2 changes: 2 additions & 0 deletions scripts/installer/install-korifi-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
- bash
- -c
- |
set -euo pipefail
scripts/install-dependencies.sh --insecure-tls-metrics-server
helm repo add twuni https://helm.twun.io
Expand Down
20 changes: 20 additions & 0 deletions tests/dependencies/contour/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resources:
- contour-gateway.yaml

patches:
- patch: |
$patch: delete
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: example
target:
kind: GatewayClass
- patch: |
$patch: delete
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: example
target:
kind: Gateway
7 changes: 3 additions & 4 deletions tests/vendir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ directories:
depth: 1
refSelection:
semver:
constraints: ">=1.19.1"
constraints: ">=1.27.0"
includePaths:
- examples/contour/*.yaml
newRootPath: examples/contour
- examples/render/contour-gateway.yaml
newRootPath: examples/render
- path: gateway-api
githubRelease:
slug: kubernetes-sigs/gateway-api
latest: true
disableAutoChecksumValidation: true
assetNames: ["experimental-install.yaml"]

17 changes: 0 additions & 17 deletions tests/vendor/contour/00-common.yaml

This file was deleted.

185 changes: 0 additions & 185 deletions tests/vendor/contour/01-contour-config.yaml

This file was deleted.

Loading

0 comments on commit 1e4b89d

Please sign in to comment.