forked from SciCatProject/localdeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_ingress.sh
executable file
·30 lines (25 loc) · 1.33 KB
/
01_ingress.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# setting up the ingress controller with port forwarding to the node ports
# argument 'forwardonly' does not install the ingress controller, assumes it exists already
# learn about some utility functions before heading on ...
scriptpath="$(readlink -f "$0")"
scriptdir="$(dirname "$scriptpath")"
. "$scriptdir/services/deploytools"
# get provided command line flags
clean="$(getScriptFlags clean "$@")"
if [ -z "$clean" ]; then
proccount="$(awk -F': ' '/^processor/{print ($NF)+1}' /proc/cpuinfo | tail -n1)"
[ "$proccount" -gt 8 ] && proccount=8
# make sure the necessary repo is available
(helm repo list | grep -q '^ingress-nginx') || helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# get the systems outward facing (physical) ip address, needs gawk (GNU awk)
ipaddr="$(ip addr show | awk '/\<inet\>\s[0-9\.]+\/24/ { split($2,a,"/"); print a[1] }' | head -n1)"
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace kube-system \
--set controller.kind=DaemonSet --set "controller.service.externalIPs[0]=$ipaddr" \
--set controller.config.hsts-preload=true \
--set "controller.config.worker-processes=$proccount" \
#--set controller.extraArgs.v=5
else # clean up
helm del --namespace kube-system ingress-nginx
fi
# vim: set ts=4 sw=4 sts=4 tw=0 et: