k8s/helm/apps/miniflux/install.sh

40 lines
1 KiB
Bash
Raw Normal View History

2022-12-30 18:29:23 +00:00
#!/bin/bash
CHART_VERSION=0.1.7
NAMESPACE=miniflux
VAULT_AUTH_NAMESPACE="k8s-teapot"
kubectl create ns ${NAMESPACE}
kubectl create serviceaccount -n ${NAMESPACE} miniflux
kubectl apply -n ${NAMESPACE} -f external-secrets.yaml
helm repo add gabe565 https://charts.gabe565.com
helm repo update
helm upgrade --install \
miniflux \
gabe565/miniflux \
-f values.yaml \
-n ${NAMESPACE} \
--version ${CHART_VERSION} \
--cleanup-on-fail
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
2022-12-30 23:07:55 +00:00
TOKEN="$(kubectl get secret serviceaccounttoken -n miniflux -o go-template='{{ .data.token }}' | base64 -d)"
2022-12-30 18:29:23 +00:00
cat << EOH > miniflux.hcl
path "kv/data/miniflux" {
capabilities = ["read"]
}
EOH
vault policy write miniflux miniflux.hcl
rm miniflux.hcl
vault write auth/${VAULT_AUTH_NAMESPACE}/role/miniflux \
bound_service_account_names=miniflux \
bound_service_account_namespaces=miniflux \
policies=miniflux \
ttl=24h
vault write auth/${VAULT_AUTH_NAMESPACE}/login role=miniflux jwt=${TOKEN} iss=https://${HOST_IP}:6443