Commit ba45234c authored by Geoff Simmons's avatar Geoff Simmons

Varnish Pods are Ready when Varnish is running, even without an Ingress.

Add the port "configured" to the headless Varnish admin Service,
which responds with status 200 when an Ingress is configured, 503
otherwise. This replaces the previous purpose of the Ready state,
to determine if the Pods are currently implementing an Ingress.

This is actually a small change to the Varnish images and the admin
Service, but a wide-ranging change for testing, since we now check
the configured port before verifying a configuration (rather than
wait for the Ready state). Common test code is now in the bash
library test/utils.sh.

This commit also includes a fix for the repeated test of the
ExternalName example, which verifies that the changed IP addresses
for ExternalName Services are picked up by VMOD dynamic. The test
waits for the Ready state of the IngressBackends. The second time
around, kubectl wait sometimes picked up previous versions of the
Pods that were in the process of terminating. These of course never
became Ready, and the wait timed out. Now we wait for those Pods
to delete before proceeding with the second test.
parent 449af81d
......@@ -48,6 +48,6 @@ RUN /bin/chmod 755 /varnishd_exec.sh
ENV HTTP_PORT=80 PROTO=HTTP READY_PORT=8080 SECRET_PATH=/var/run/varnish \
SECRET_FILE=_.secret ADMIN_PORT=6081 GROUP=varnish \
OFFLOAD_PATH=/var/run/offload/varnish.sock
OFFLOAD_PATH=/var/run/offload/varnish.sock CONFIG_PORT=8000
ENTRYPOINT ["/varnishd_exec.sh"]
......@@ -27,6 +27,6 @@ RUN /bin/chmod 755 /varnishd_exec.sh
ENV HTTP_PORT=80 PROTO=HTTP READY_PORT=8080 SECRET_PATH=/var/run/varnish \
SECRET_FILE=_.secret ADMIN_PORT=6081 GROUP=varnish \
OFFLOAD_PATH=/var/run/offload/varnish.sock
OFFLOAD_PATH=/var/run/offload/varnish.sock CONFIG_PORT=8000
ENTRYPOINT ["/varnishd_exec.sh"]
......@@ -5,9 +5,12 @@ include "bogo_backend.vcl";
sub vcl_recv {
if (local.socket == "k8s") {
if (req.url == "/ready") {
return (vcl(vk8s_readiness));
return (synth(200));
}
return (synth(404));
}
if (local.socket == "vk8s_cfg") {
return (vcl(vk8s_readiness));
}
return (vcl(vk8s_regular));
}
......@@ -5,5 +5,6 @@ set -u
exec /usr/sbin/varnishd -F -a :${HTTP_PORT},${PROTO} -a k8s=:${READY_PORT} \
-a k8s_offload=${OFFLOAD_PATH},PROXY,group=${GROUP},mode=0660 \
-a vk8s_cfg=:${CONFIG_PORT} \
-S ${SECRET_PATH}/${SECRET_FILE} -T 0.0.0.0:${ADMIN_PORT} \
-p vcl_path=/etc/varnish -I /etc/varnish/start.cli -f '' "$@"
......@@ -11,6 +11,10 @@ spec:
targetPort: 6081
protocol: TCP
name: varnishadm
- port: 8000
targetPort: 8000
protocol: TCP
name: configured
- port: 5555
targetPort: 5555
protocol: TCP
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../test/utils.sh
kubectl delete -f nodeport.yaml
kubectl delete -f admin-svc.yaml
......@@ -11,5 +14,4 @@ kubectl delete -f tls-cert-secret.yaml
kubectl delete -f adm-secret.yaml
echo Waiting until varnish-ingress Pods are deleted
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=delete
wait_until_deleted app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -n kube-system -l app=varnish-ingress-controller \
--for=condition=Ready
wait_until_ready app=varnish-ingress-controller kube-system
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Initialized
sleep 1
wait_until_ready app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
wait_until_not_configured app=varnish-ingress
sleep 1
set +e
N=0
while true; do
sleep 1
cat < /dev/null > /dev/tcp/localhost/${LOCALPORT}
if [ $? -eq 0 ]; then
break
fi
if [ $N -ge 120 ]; then
echo "Giving up"
exit 1
fi
N=$(( N + 1 ))
done
set -e
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} deploy.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f acl.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f other-ingress.yaml
kubectl delete -f tea-ingress.yaml
......@@ -18,8 +21,7 @@ kubectl delete -f tls-cert-secret-coffee.yaml
kubectl delete -f varnish-system.yaml
kubectl wait --timeout=2m pod -l app=varnish-ingress -n kube-system \
--for=delete
wait_until_deleted app=varnish-ingress kube-system
kubectl delete -f nodeport-system.yaml
......
#! /bin/bash -ex
function killsystem {
kill $SYSTEMPID
}
function killcafe {
kill $SYSTEMPID
kill $CAFEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
SYSTEMPORT=${SYSTEMPORT:-8888}
CAFEPORT=${CAFEPORT:-9999}
kubectl wait -n kube-system --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress kube-system
wait_until_configured app=varnish-ingress kube-system
kubectl wait -n cafe --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress cafe
wait_until_configured app=varnish-ingress cafe
kubectl port-forward -n kube-system svc/varnish-ingress ${SYSTEMPORT}:80 >/dev/null &
SYSTEMPID=$!
trap killsystem EXIT
trap 'kill $(jobs -p)' EXIT
kubectl port-forward -n cafe svc/varnish-ingress ${CAFEPORT}:80 >/dev/null &
CAFEPID=$!
trap killcafe EXIT
sleep 1
wait_for_port ${SYSTEMPORT}
wait_for_port ${CAFEPORT}
varnishtest ${TESTOPTS} -Dsystemport=${SYSTEMPORT} -Dcafeport=${CAFEPORT} cafe.vtc
# Parse the controller log for these lines (Ingress names in any order):
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f other-ingress.yaml
kubectl delete -f tea-ingress.yaml
......@@ -27,5 +30,5 @@ kubectl delete -f namespace.yaml
# Restores the Varnish admin Service in namespace default.
kubectl apply -f ../../../deploy/admin-svc.yaml
echo Waiting until varnish-ingress Pods are running
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Initialized
echo Waiting until varnish-ingress Pods are ready
wait_until_ready app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait -n kube-system --timeout=2m pod -l app=varnish-ingress \
--for=condition=Ready
wait_until_ready app=varnish-ingress kube-system
wait_until_configured app=varnish-ingress kube-system
kubectl port-forward -n kube-system svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
# Parse the controller log for this line (Ingress names in any order):
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f tea-ingress.yaml
kubectl delete -f coffee-ingress.yaml
......@@ -30,5 +33,4 @@ kubectl delete -f namespace.yaml
kubectl delete -f controller.yaml
kubectl wait --timeout=2m pod -l app=varnish-ingress-controller,example=coffee \
-n kube-system --for=delete
wait_until_deleted app=varnish-ingress-controller,example=coffee kube-system
#! /bin/bash -ex
function killcoffee {
kill $COFFEEPID
}
function killcafe {
kill $COFFEEPID
kill $TEAPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
COFFEEPORT=${COFFEEPORT:-8888}
TEAPORT=${TEAPORT:-9999}
kubectl wait -n kube-system --timeout=2m pod -l app=varnish-ingress-controller \
--for=condition=Ready
wait_until_ready app=varnish-ingress-controller kube-system
kubectl wait -n cafe --timeout=2m pod -l app=varnish-ingress \
--for=condition=Ready
wait_until_ready app=varnish-ingress cafe
wait_until_configured app=varnish-ingress cafe
kubectl port-forward -n cafe svc/varnish-coffee ${COFFEEPORT}:80 >/dev/null &
COFFEEPID=$!
trap killcoffee EXIT
trap 'kill $(jobs -p)' EXIT
kubectl port-forward -n cafe svc/varnish-tea ${TEAPORT}:80 >/dev/null &
TEAPID=$!
trap killcafe EXIT
sleep 1
wait_for_port ${COFFEEPORT}
wait_for_port ${TEAPORT}
varnishtest ${TESTOPTS} -Dcoffeeport=${COFFEEPORT} -Dteaport=${TEAPORT} cafe.vtc
# Parse the tea controller log for these lines:
......
#! /bin/bash -ex
function killcoffee {
kill $COFFEEPID
}
function killcafe {
kill $COFFEEPID
kill $TEAPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
COFFEEPORT=${COFFEEPORT:-8888}
TEAPORT=${TEAPORT:-9999}
kubectl wait -n cafe --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress cafe
wait_until_configured app=varnish-ingress cafe
kubectl port-forward -n cafe svc/varnish-coffee ${COFFEEPORT}:80 >/dev/null &
COFFEEPID=$!
trap killcoffee EXIT
trap 'kill $(jobs -p)' EXIT
kubectl port-forward -n cafe svc/varnish-tea ${TEAPORT}:80 >/dev/null &
TEAPID=$!
trap killcafe EXIT
sleep 1
wait_for_port ${COFFEEPORT}
wait_for_port ${TEAPORT}
varnishtest ${TESTOPTS} -Dcoffeeport=${COFFEEPORT} -Dteaport=${TEAPORT} cafe.vtc
# Parse the controller log for these lines
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f acl-or-auth.yaml
kubectl delete -f basic-secrets.yaml
......@@ -8,18 +11,5 @@ kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f basic-auth.yaml
kubectl delete -f basic-secrets.yaml
......@@ -8,18 +11,5 @@ kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f proxy-auth.yaml
kubectl delete -f proxy-auth-secrets.yaml
......@@ -8,18 +11,5 @@ kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_acl_or_auth.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_basic_auth.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy_auth.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f backend-cfg.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f custom-vcl.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
apiVersion: apps/v1
kind: Deployment
metadata:
name: coffee
spec:
replicas: 2
selector:
matchLabels:
app: coffee
example: externalname
template:
metadata:
labels:
app: coffee
example: externalname
spec:
containers:
- name: coffee
image: nginxdemos/hello:plain-text
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: coffee-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: coffee
example: externalname
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tea
spec:
replicas: 3
selector:
matchLabels:
app: tea
example: externalname
template:
metadata:
labels:
app: tea
example: externalname
spec:
containers:
- name: tea
image: nginxdemos/hello:plain-text
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: tea-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: tea
example: externalname
#! /bin/bash -ex
kubectl create -f ../hello/cafe.yaml
kubectl create -f cafe.yaml
kubectl create -f ext-svcs.yaml
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f backend-cfg.yaml
kubectl delete -f cafe-ingress.yaml
kubectl delete -f ext-svcs.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
kubectl delete -f cafe.yaml
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=coffee --for=condition=Ready
kubectl wait --timeout=2m pod -l app=tea --for=condition=Ready
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=coffee,example=externalname
wait_until_ready app=tea,example=externalname
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
sleep 1
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
set +e
N=0
while true; do
sleep 1
cat < /dev/null > /dev/tcp/localhost/${LOCALPORT}
if [ $? -eq 0 ]; then
break
fi
if [ $N -ge 120 ]; then
echo "Giving up"
exit 1
fi
N=$(( N + 1 ))
done
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} ../hello/cafe.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f cafe-ingress.yaml
kubectl delete -f cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait -n varnish-ingress --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress varnish-ingress
wait_until_configured app=varnish-ingress varnish-ingress
kubectl port-forward -n varnish-ingress svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f alt-builtin.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f builtin.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f cacheability.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f pass-on-session-cookie.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f purge-method.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f url-whitelist.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_alt-builtin.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_builtin.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cacheability.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_pass-on-session-cookie.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_purge.vtc
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_url-whitelist.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f rewrite.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete -f self-sharding-cfg.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
......@@ -3,17 +3,17 @@
# Nothing special about self-sharding is verified here, just run the
# same tests as for the cafe example ("hello").
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
wait_until_ready app=varnish-ingress
wait_until_configured app=varnish-ingress
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
# XXX hackish
# If we run the test too "soon" after the Varnish Services become ready,
......@@ -23,5 +23,4 @@ trap killforward EXIT
# Varnish is not properly configured immediately after self-sharding is
# deployed.
sleep 10
#sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.vtc
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f cafe-ingress.yaml
kubectl delete -f cafe.yaml
kubectl delete -f cafe-tls-secret.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
LOCALPORT=${LOCALPORT:-4443}
wait_until_ready app=varnish-ingress
# Long timeout to wait for the Secret to appear as a certificate on
# the Pods.
kubectl wait --timeout=5m pod -l app=varnish-ingress --for=condition=Ready
ret=$?
if [ $ret -ne 0 ]; then
exit $ret
fi
wait_until_configured app=varnish-ingress default 600
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:443 >/dev/null &
ret=$?
if [ $ret -ne 0 ]; then
exit $ret
fi
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
set +e
sleep 1
# The test may be skipped (exit status 77) if haproxy is not installed.
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f beverage-ingress.yaml
kubectl delete -f beverage.yaml
......@@ -9,17 +12,4 @@ kubectl delete -f bar-tls-secret.yaml
kubectl delete -f cafe-tls-secret.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
LOCALPORT=${LOCALPORT:-4443}
wait_until_ready app=varnish-ingress
# Long timeout to wait for the Secret to appear as a certificate on
# the Pods.
kubectl wait --timeout=5m pod -l app=varnish-ingress --for=condition=Ready
wait_until_configured app=varnish-ingress default 600
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:443 >/dev/null &
KUBEPID=$!
trap killforward EXIT
sleep 1
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
CONNECT=cafe.example.com:443:localhost:4443
URI=https://cafe.example.com/coffee/foo/bar
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl apply -f ../hello/cafe.yaml
kubectl apply -f ../hello/cafe-ingress.yaml
......@@ -9,6 +12,6 @@ kubectl delete -f ../../deploy/admin-svc.yaml
kubectl delete deploy varnish
echo Waiting until example varnish-ingress Pods are deleted
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=delete
wait_until_deleted app=varnish-ingress
kubectl apply -f env.yaml
......@@ -68,6 +68,13 @@ spec:
- name: ADMIN_PORT
value: "7000"
# Container port for the configuration check (returns HTTP
# status 200 iff an Ingress has been configured)
# MUST match the targetPort named "configured" in the Service
# below..
- name: CONFIG_PORT
value: "9000"
# Path at which the volume for the admin secret is mounted.
# MUST match the value of mountPath in volumeMounts above.
- name: SECRET_PATH
......@@ -160,6 +167,10 @@ spec:
targetPort: 7000
protocol: TCP
name: varnishadm
- port: 9000
targetPort: 9000
protocol: TCP
name: configured
- port: 5555
targetPort: 5555
protocol: TCP
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
kubectl delete svc varnish-ingress-env-admin
kubectl delete svc varnish-ingress
......@@ -7,7 +10,7 @@ kubectl delete svc varnish-ingress
kubectl delete deploy varnish
echo Waiting until example varnish-ingress Pods are deleted
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=delete
wait_until_deleted app=varnish-ingress
kubectl delete -f ../hello/cafe-ingress.yaml
......@@ -19,5 +22,5 @@ kubectl apply -f ../../deploy/nodeport.yaml
kubectl apply -f ../../deploy/admin-svc.yaml
echo Waiting until varnish-ingress Pods are running
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Initialized
echo Waiting until varnish-ingress Pods are ready
wait_until_ready app=varnish-ingress
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete
wait_until_deleted app=varnish-ingress,example!=cli-args
set -e
kubectl wait --timeout=2m pod -l example=cli-args --for=condition=Ready
wait_until_ready example=cli-args
wait_until_configured example=cli-args
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=env --for=delete
wait_until_deleted app=varnish-ingress,example!=env
set -e
kubectl wait --timeout=2m pod -l example=env --for=condition=Ready
wait_until_ready example=env
# Config check is at non-default port 9000.
wait_until_configured example=env default 120 9000
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:81 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../test/utils.sh
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete
wait_until_deleted app=varnish-ingress,example!=proxy
set -e
kubectl wait --timeout=2m pod -l example=proxy --for=condition=Ready
wait_until_ready example=proxy
wait_until_configured example=proxy
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
trap 'kill $(jobs -p)' EXIT
wait_for_port ${LOCALPORT}
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc
......@@ -7,6 +7,7 @@ function undeploy_and_clear {
}
MYPATH="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
source ${MYPATH}/utils.sh
trap undeploy_and_clear EXIT
export TESTOPTS=-v
......@@ -169,6 +170,13 @@ cd ${MYPATH}/../examples/externalname/
./verify.sh
./undeploy.sh
# Wait for prior versions of the IngressBackends from the previous
# test to delete.
set +e
wait_until_deleted app=coffee,example=externalname
wait_until_deleted app=tea,example=externalname
set -e
# Now re-deploy and verify again -- the Service is assigned a new IP
# address, verify that the new address is resolved.
# Since the Service does not exist for a brief time, DNS lookups get
......
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
kubectl delete -f other-ingress.yaml
kubectl delete -f cafe-ingress.yaml
......@@ -8,18 +11,5 @@ kubectl delete -f cafe.yaml
kubectl delete -f cafe-tls-secret.yaml
echo "Waiting until varnish-ingress Pods are not ready"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress -o jsonpath="${JSONPATH}" | grep -q '\bReady=True\b'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
echo "Waiting until varnish-ingress Pods are not configured for Ingress"
wait_until_not_configured app=varnish-ingress
#! /bin/bash -ex
MYDIR=$(dirname ${BASH_SOURCE[0]})
source ${MYDIR}/../../../test/utils.sh
wait_until_ready app=varnish-ingress
# Long timeout to wait for the Secret to appear as a certificate on
# the Pods.
kubectl wait --timeout=5m pod -l app=varnish-ingress --for=condition=Ready
wait_until_configured app=varnish-ingress default 600
# Delete the TLS Secret not used by the Ingress for Varnish
kubectl delete -f other-tls-secret.yaml
......
#! /bin/bash
function wait_for_pod_status {
local label="$1"
local ns=${2-default}
local timeout=${3-2m}
local for=${4-condition=Ready}
kubectl wait pod -n ${ns} --timeout=${timeout} -l ${label} --for=${for}
}
function wait_until_ready {
wait_for_pod_status "$@"
}
function wait_until_deleted {
local label="$1"
local ns=${2-default}
local timeout=${3-2m}
wait_for_pod_status ${label} ${ns} ${timeout} "delete"
}
function wait_for_port {
local port="$1"
local timeout=${2-120}
set +e
N=0
while true; do
sleep 1
cat < /dev/null > /dev/tcp/localhost/${port}
if [ $? -eq 0 ]; then
break
fi
if [ $N -ge 120 ]; then
echo "Timed out waiting for listener at port ${port}"
exit 1
fi
N=$(( N + 1 ))
done
set -e
}
function wait_for_config_status {
local label="$1"
local ns=${2-default}
local timeout=${3-120}
local port=${4-8000}
local expect=${5-200}
pods=( $(kubectl get pods -n ${ns} -l ${label} --no-headers -o custom-columns=":metadata.name") )
for pod in "${pods[@]}"
do
kubectl port-forward -n ${ns} pod/${pod} ${port}:${port} &
local PODPID=$!
wait_for_port ${port} ${timeout}
local N=0
while true; do
sleep 1
local status=$(curl -s -o /dev/null -w "%{http_code}" -I http://localhost:${port})
if [ ${status} -eq ${expect} ]; then
break
fi
if [ $N -ge ${timeout} ]; then
echo "Timed out waiting for status ${expect} from pod ${pod}"
kill $PODPID
exit 1
fi
N=$(( N + 1 ))
done
kill $PODPID
done
}
function wait_until_configured {
wait_for_config_status "$@"
}
function wait_until_not_configured {
local label="$1"
local ns=${2-default}
local timeout=${3-120}
local port=${4-8000}
wait_for_config_status ${label} ${ns} ${timeout} ${port} '503'
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment