Commit 1aca523d authored by Geoff Simmons's avatar Geoff Simmons

Add an example/test for primary-only self-sharding.

parent 7db3f020
......@@ -178,7 +178,8 @@ example:self-sharding:
extends: .integration-tests
script:
- cd ../examples/self-sharding
- make deploy verify undeploy
- make EXAMPLE=self-sharding deploy verify undeploy
- make EXAMPLE=primary-only deploy verify undeploy
example:authentication:basic:
extends: .integration-tests
......
......@@ -34,22 +34,19 @@ CHARTDIR=$(mkdir)/../../charts
all: deploy
deploy-helm:
deploy-self-sharding-helm:
@helm install viking-ingress $(CHARTDIR)/viking-test-app \
--values values.yaml
deploy-kubectl:
deploy-cafe-kubectl:
@kubectl apply -f $(mkdir)/../hello/cafe.yaml
@kubectl apply -f $(mkdir)/../hello/cafe-ingress.yaml
@kubectl apply -f self-sharding-cfg.yaml
deploy:
deploy-self-sharding-kubectl: deploy-cafe-kubectl
@kubectl apply -f self-sharding-cfg.yaml
ifeq ($(DEPLOY),kubectl)
deploy: deploy-kubectl
else
deploy: deploy-helm
endif
deploy-primary-only-kubectl: deploy-cafe-kubectl
@kubectl apply -f primary-only.yaml
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify:
......@@ -59,24 +56,45 @@ wait:
@echo Waiting until varnish-ingress Pods are not configured for Ingress
$(TESTDIR)/wait.sh app=varnish-ingress
uninstall-helm:
undeploy-self-sharding-helm:
@helm uninstall viking-ingress
$(MAKE) wait
undeploy-helm: uninstall-helm wait
uninstall-kubectl:
@kubectl delete -f self-sharding-cfg.yaml
undeploy-cafe-kubectl:
@kubectl delete -f $(mkdir)/../hello/cafe-ingress.yaml
@kubectl delete -f $(mkdir)/../hello/cafe.yaml
undeploy-kubectl: uninstall-kubectl wait
undeploy-self-sharding-kubectl:
@kubectl delete -f self-sharding-cfg.yaml
$(MAKE) undeploy-cafe-kubectl
$(MAKE) wait
undeploy:
undeploy-primary-only-kubectl:
@kubectl delete -f primary-only.yaml
$(MAKE) undeploy-cafe-kubectl
$(MAKE) wait
ifeq ($(DEPLOY),kubectl)
undeploy: undeploy-kubectl
deploy-self-sharding: deploy-self-sharding-kubectl
undeploy-self-sharding: undeploy-self-sharding-kubectl
deploy-primary-only: deploy-primary-only-kubectl
undeploy-primary-only: undeploy-primary-only-kubectl
else
deploy-self-sharding: deploy-self-sharding-helm
undeploy-self-sharding: undeploy-self-sharding-helm
deploy-primary-only undeploy-primary-only:
$(error primary-only not yet implemented for helm)
endif
ifeq ($(EXAMPLE),self-sharding)
deploy: deploy-self-sharding
undeploy: undeploy-self-sharding
else ifeq ($(EXAMPLE),primary-only)
deploy: deploy-primary-only
undeploy: undeploy-primary-only
else
undeploy: undeploy-helm
deploy undeploy:
$(error EXAMPLE must be set to self-sharding or primary-only)
endif
.PHONY: all $(MAKECMDGOALS)
# Sample configuration for a self-sharding Varnish cluster
apiVersion: "ingress.varnish-cache.org/v1alpha1"
kind: VarnishConfig
metadata:
name: primary-only-sharding-cfg
spec:
# The services array is required and must have at least one element.
# Lists the Service names of Varnish services in the same namespace
# to which this config is to be applied.
services:
- varnish-ingress-admin
# If the self-sharding object is present, then self-sharding will be
# implemented for the named service. All of its properties are
# optional, and defaults hold if they are left out. To just apply
# self-sharding with all default values, specify an empty object:
#
# self-sharding: {}
#
self-sharding:
primaryOnly: true
probe:
timeout: 6s
interval: 6s
initial: 2
window: 4
threshold: 3
......@@ -66,7 +66,10 @@ make deploy verify undeploy
echo Self-sharding cluster example
cd ${MYPATH}/../examples/self-sharding/
make deploy verify undeploy
make EXAMPLE=self-sharding deploy verify undeploy
echo Primary-only self-sharding cluster example
make EXAMPLE=primary-only deploy verify undeploy
echo Basic Authentication example
cd ${MYPATH}/../examples/authentication/
......
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