k8s/helm/apps/wallabag/install.sh
2022-12-30 23:07:55 +00:00

33 lines
949 B
Bash
Executable file

#!/bin/bash
CHART_VERSION=7.1.2
NAMESPACE=wallabag
VAULT_AUTH_NAMESPACE="k8s-teapot"
helm repo add k8s-at-home https://k8s-at-home.com/charts/
helm repo update
kubectl create ns wallabag
kubectl create serviceaccount -n ${NAMESPACE} wallabag
kubectl apply -n ${NAMESPACE} -f external-secrets.yaml
helm upgrade --install \
wallabag \
k8s-at-home/wallabag \
-f values.yaml \
-n ${NAMESPACE} \
--version ${CHART_VERSION} \
--cleanup-on-fail
#kubectl apply -n ${NAMESPACE} -f traefik.yaml
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
TOKEN="$(kubectl get secret serviceaccounttoken -n wallabag -o go-template='{{ .data.token }}' | base64 -d)"
vault write auth/${VAULT_AUTH_NAMESPACE}/role/wallabag \
bound_service_account_names=wallabag \
bound_service_account_namespaces=wallabag \
policies=wallabag \
ttl=24h
vault write auth/${VAULT_AUTH_NAMESPACE}/login role=wallabag jwt=${TOKEN} iss=https://${HOST_IP}:6443