-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathofinstall
More file actions
executable file
·47 lines (39 loc) · 1.99 KB
/
ofinstall
File metadata and controls
executable file
·47 lines (39 loc) · 1.99 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
. ~/.rpicrc
# we'll need the OpenFaaS CLI. If it's not here, install it
which faas-cli > /dev/null
OUT=$?
if [ $OUT -eq 1 ];then
echo "installing openfaas-cli..."
curl -sL https://cli.openfaas.com | sudo sh
fi
echo "ready to install OpenFaaS"
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
helm repo add openfaas https://openfaas.github.io/faas-netes/
# if we want load-balancer and ingress make sure these options are uncommented
# docs say: if ingress.enabled=true then exposeServices should be false, but not true if LB
OPTIONS=""
#OPTIONS=$OPTIONS" --set serviceType=LoadBalancer"
OPTIONS=$OPTIONS" --set exposeServices=false"
OPTIONS=$OPTIONS" --set ingress.enabled=true"
OPTIONS=$OPTIONS" --set faasnetes.httpProbe=true" # httpProbe is more efficient than exec
OPTIONS=$OPTIONS" --set queueWorker.replicas=3" # HA
OPTIONS=$OPTIONS" --set gateway.replicas=3" # HA
OPTIONS=$OPTIONS" --set faasIdler.replicas=3" # HA
OPTIONS=$OPTIONS" --set faasIdler.dryRun=false" # not dry runs, perform real scaledown
OPTIONS=$OPTIONS" --set psp=true" # create pod security policies
OPTIONS=$OPTIONS" --set nats.enableMontitoring=true"
# generate a random password
# drop into a creds file so we don't lose track of it.
if [ -z $OFPASSWD ]
then
OFPASSWD=$(head -c 12 /dev/urandom | shasum | cut -d' ' -f1)
OFUSER="admin"
echo $OFUSER/$OFPASSWD > ofcreds.txt
fi
kubectl -n openfaas create secret generic basic-auth --from-literal=basic-auth-user="$OFUSER" --from-literal=basic-auth-password="$OFPASSWD"
helm repo update
helm upgrade -f conf/openfaas/values.yaml -f conf/openfaas/values-arm64.yaml openfaas --install openfaas/openfaas --namespace openfaas --set basic_auth=true --set functionNamespace=openfaas-fn $OPTIONS
# ...and set key-signing pair as secret for cert-manager
kubectl create secret tls ca-key-pair --cert=conf/ca.crt --key=conf/ca.key --namespace openfaas
echo "when deployments are complete (verify with 'ofcheck') run 'oftls', then 'meshup' to finish"