37 lines
968 B
Bash
Executable file
37 lines
968 B
Bash
Executable file
#!/bin/bash
|
|
NAMESPACE=photos
|
|
VAULT_AUTH_NAMESPACE="k8s-teapot"
|
|
|
|
kubectl create ns ${NAMESPACE}
|
|
kubectl create serviceaccount -n ${NAMESPACE} photos
|
|
kubectl apply -n ${NAMESPACE} -f external-secrets.yaml
|
|
|
|
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
|
|
TOKEN="$(kubectl get secret serviceaccounttoken -n photos -o go-template='{{ .data.token }}' | base64 -d)"
|
|
|
|
cat << EOH > photos.hcl
|
|
path "kv/data/photoview" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOH
|
|
vault policy write photos photos.hcl
|
|
rm photos.hcl
|
|
|
|
vault write auth/${VAULT_AUTH_NAMESPACE}/role/photos \
|
|
bound_service_account_names=photos \
|
|
bound_service_account_namespaces=photos \
|
|
policies=photos \
|
|
ttl=24h
|
|
|
|
vault write auth/${VAULT_AUTH_NAMESPACE}/login role=photos jwt=${TOKEN} iss=https://${HOST_IP}:6443
|
|
|
|
helm repo add p80n https://p80n.github.io/photoprism-helm/
|
|
helm repo update
|
|
|
|
helm upgrade --install \
|
|
photos \
|
|
p80n/photoprism \
|
|
-f values.yaml \
|
|
-n ${NAMESPACE} \
|
|
--cleanup-on-fail
|