Commit 0b64cf9f authored by Geoff Simmons's avatar Geoff Simmons

Add helm deployment and a Makefile for the BackendConfig example/test.

parent 19990c68
# 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
TESTDIR=$(mkdir)/../../test
all: deploy
deploy-helm:
@helm install viking-ingress-backend-cfg $(CHARTDIR)/viking-test-app \
--values values.yaml
deploy-kubectl:
@kubectl apply -f $(mkdir)/../hello/cafe-ingress.yaml
@kubectl apply -f backend-cfg.yaml
@kubectl apply -f $(mkdir)/../hello/cafe.yaml
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify:
$(mkdir)/verify.sh
wait:
$(TESTDIR)/wait.sh app=varnish-ingress
uninstall-kubectl:
@kubectl delete -f backend-cfg.yaml
@kubectl delete -f $(mkdir)/../hello/cafe-ingress.yaml
@kubectl delete -f $(mkdir)/../hello/cafe.yaml
uninstall-helm:
@helm uninstall viking-ingress-backend-cfg
undeploy-kubectl: uninstall-kubectl wait
undeploy-helm: uninstall-helm wait
ifeq ($(DEPLOY),kubectl)
deploy: deploy-kubectl
undeploy: undeploy-kubectl
else
deploy: deploy-helm
undeploy: undeploy-helm
endif
.PHONY: all $(MAKECMDGOALS)
apps:
coffee:
image: nginxdemos/hello:plain-text
replicas: 2
config:
# For requests routed to coffee-svc:
# - The first byte timeout is three seconds.
# - The between bytes timeout is two seconds.
first-byte-timeout: 3s
between-bytes-timeout: 2s
probe:
# Health probe for coffee-svc:
# - Requests are send as shown in the request array.
# - Timeout three seconds.
# - Three of four good probes are required for the Endpoint to
# count as healthy.
request:
- GET /coffee/healthz HTTP/1.1
- "Host: cafe.example.com"
- "Connection: close"
timeout: 3s
interval: 3s
window: 4
threshold: 3
director:
# Shard requests to Endpoints by URL path.
# - 50% of requests are sent to the "next" Endpoint to which they
# would be sharded if the "first" Endpoint were to be removed.
# - Requests for newly added Endpoints ramp up over five minutes.
type: shard
warmup: 50
rampup: 5m
tea:
image: nginxdemos/hello:plain-text
replicas: 3
config:
# For requests routed to tea-svc:
# - The Host header is set to cafe.example.com if it is missing from
# the request.
# - The connect timeout (for opening new connections to an Endpoint)
# is one second.
# - The first byte timeout (until the first byte of a backend response
# header is received) is two seconds.
# - The between bytes timeout (while a response is being received)
# is one second.
# - No more than 200 connections to an Endpoint may be opened.
host-header: cafe.example.com
connect-timeout: 1s
first-byte-timeout: 2s
between-bytes-timeout: 1s
max-connections: 200
probe:
# Health probe requests for Endpoints of tea-svc:
# - Request URL path is /tea/healthz
# - Health probes are good when the response code is 200.
# - Five second timeout to receive responses.
# - Probes are sent every five seconds.
# - Two of three probes must be good for the Endpoint to count as
# healthy.
# - At startup, one probe is implicitly assumed to be good.
url: /tea/healthz
expected-response: 200
timeout: 5s
interval: 5s
initial: 1
window: 3
threshold: 2
director:
# Use random load balancing of Endpoints.
type: random
ingress:
name: cafe-ingress
rules:
- host: cafe.example.com
paths:
- path: /tea
app: tea
- path: /coffee
app: coffee
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