21 lines
624 B
Bash
Executable file
21 lines
624 B
Bash
Executable file
#!/bin/bash -xe
|
|
VAULT_AUTH_NAMESPACE="k8s-teapot"
|
|
cat << EOH > immich.hcl
|
|
path "kv/data/immich" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOH
|
|
vault policy write immich immich.hcl
|
|
rm immich.hcl
|
|
|
|
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
|
|
TOKEN="$(kubectl get secret serviceaccounttoken -n immich -o go-template='{{ .data.token }}' | base64 -d)"
|
|
|
|
vault write auth/${VAULT_AUTH_NAMESPACE}/role/immich \
|
|
bound_service_account_names=immich \
|
|
bound_service_account_namespaces=immich \
|
|
policies=immich \
|
|
ttl=24h
|
|
|
|
vault write auth/${VAULT_AUTH_NAMESPACE}/login role=immich jwt=${TOKEN} iss=https://${HOST_IP}:6443
|
|
|