Commit 57ba1972 authored by Geoff Simmons's avatar Geoff Simmons

Add helm deployments and a Makefile for the "multi Varnish in ns" test.

parent 5cb33e84
# Copyright (c) 2020 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# GNU make is required.
mkpath := $(abspath $(lastword $(MAKEFILE_LIST)))
mkdir := $(dir $(mkpath))
CHARTDIR=$(mkdir)/../../../charts
# For the klarlack image: make VARNISH=klarlack ...
ifndef VARNISH
VARNISH=varnish
endif
CI_REPO_PFX=registry.gitlab.com/uplex/varnish/k8s-ingress/varnish-ingress
# For tests using the local docker registry: make TEST=local ...
# For tests using images from the CI pipeline: make TEST=ci ...
ifeq ($(TEST),local)
VARNISH_IMAGE=varnish-ingress/$(VARNISH)
VARNISH_TAG=latest
HAPROXY_IMAGE=varnish-ingress/haproxy
HAPROXY_TAG=latest
else ifeq ($(TEST),ci)
VARNISH_IMAGE=$(CI_REPO_PFX)/$(VARNISH)
VARNISH_TAG=master
HAPROXY_IMAGE=$(CI_REPO_PFX)/haproxy
HAPROXY_TAG=master
endif
# If not specified, pull the latest "official" images from dockerhub.
LATEST=0.0.2
ifndef VARNISH_IMAGE
VARNISH_IMAGE=uplex/viking-$(VARNISH)
endif
ifndef VARNISH_TAG
VARNISH_TAG=$(LATEST)
endif
ifndef HAPROXY_IMAGE
HAPROXY_IMAGE=uplex/viking-haproxy
endif
ifndef HAPROXY_TAG
HAPROXY_TAG=$(LATEST)
endif
all: deploy
deploy-helm:
@kubectl apply -f namespace.yaml
@helm install viking-service-tea $(CHARTDIR)/viking-service \
--values values-varnish.yaml --namespace cafe \
--set nameOverride=varnish-tea \
--set fullnameOverride=varnish-tea \
--set vikingService.varnish.image.repository=$(VARNISH_IMAGE) \
--set vikingService.varnish.image.tag=$(VARNISH_TAG) \
--set vikingService.haproxy.image.repository=$(HAPROXY_IMAGE) \
--set vikingService.haproxy.image.tag=$(HAPROXY_TAG)
@helm install viking-service-coffee $(CHARTDIR)/viking-service \
--values values-varnish.yaml --namespace cafe \
--set nameOverride=varnish-coffee \
--set fullnameOverride=varnish-coffee \
--set vikingService.varnish.image.repository=$(VARNISH_IMAGE) \
--set vikingService.varnish.image.tag=$(VARNISH_TAG) \
--set vikingService.haproxy.image.repository=$(HAPROXY_IMAGE) \
--set vikingService.haproxy.image.tag=$(HAPROXY_TAG)
@helm install coffee-ingress $(CHARTDIR)/viking-test-app \
--values values-coffee.yaml --namespace cafe
@helm install tea-ingress $(CHARTDIR)/viking-test-app \
--values values-tea.yaml --namespace cafe
deploy-kubectl:
@kubectl apply -f namespace.yaml
@kubectl apply -f rbac.yaml
@kubectl apply -f coffee.yaml
@kubectl apply -f tea.yaml
@kubectl apply -f adm-secret-tea.yaml
@kubectl apply -f admin-svc-tea.yaml
@kubectl apply -f nodeport-tea.yaml
@kubectl apply -f varnish-tea.yaml
@kubectl apply -f adm-secret-coffee.yaml
@kubectl apply -f admin-svc-coffee.yaml
@kubectl apply -f nodeport-coffee.yaml
@kubectl apply -f varnish-coffee.yaml
@kubectl apply -f coffee-ingress.yaml
@kubectl apply -f tea-ingress.yaml
deploy:
ifeq ($(DEPLOY),kubectl)
deploy: deploy-kubectl
else
deploy: deploy-helm
endif
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify:
$(mkdir)/verify.sh
undeploy-helm:
@helm uninstall tea-ingress --namespace cafe
@helm uninstall coffee-ingress --namespace cafe
@helm uninstall viking-service-coffee --namespace cafe
@helm uninstall viking-service-tea --namespace cafe
@kubectl delete -f namespace.yaml
undeploy-kubectl:
@kubectl delete -f tea-ingress.yaml
@kubectl delete -f coffee-ingress.yaml
@kubectl delete -f varnish-coffee.yaml
@kubectl delete -f nodeport-coffee.yaml
@kubectl delete -f admin-svc-coffee.yaml
@kubectl delete -f adm-secret-coffee.yaml
@kubectl delete -f varnish-tea.yaml
@kubectl delete -f nodeport-tea.yaml
@kubectl delete -f admin-svc-tea.yaml
@kubectl delete -f adm-secret-tea.yaml
@kubectl delete -f tea.yaml
@kubectl delete -f coffee.yaml
@kubectl delete -f rbac.yaml
@kubectl delete -f namespace.yaml
undeploy:
ifeq ($(DEPLOY),kubectl)
undeploy: undeploy-kubectl
else
undeploy: undeploy-helm
endif
.PHONY: all $(MAKECMDGOALS)
apps:
coffee:
image: nginxdemos/hello:plain-text
replicas: 2
ingress:
name: coffee-ingress
rules:
- host: coffee.example.com
paths:
- app: coffee
vikingAdmSvc: varnish-coffee-admin
apps:
tea:
image: nginxdemos/hello:plain-text
replicas: 3
ingress:
name: tea-ingress
rules:
- host: tea.example.com
paths:
- app: tea
vikingAdmSvc: varnish-tea-admin
vikingService:
## Name of the ingress class to route through this controller
##
ingressClass: varnish
# labels to add to the pod container metadata
podLabels:
app: varnish-ingress
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