k8s/scripts/miniflux-vault.sh

21 lines
608 B
Bash
Executable file

#!/bin/bash
cat << EOH > miniflux.hcl
path "kv/data/miniflux" {
capabilities = ["read"]
}
EOH
vault policy write miniflux miniflux.hcl
rm miniflux.hcl
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
TOKEN="$(kubectl get secret serviceaccounttoken -n miniflux -o go-template='{{ .data.token }}' | base64 -d)"
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