2024-03-09 20:47:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-12-10 03:23:13 +00:00
|
|
|
CHART_VERSION=10.1.1
|
2024-03-09 20:47:20 +00:00
|
|
|
NAMESPACE=gitea
|
|
|
|
VAULT_AUTH_NAMESPACE="k8s-teapot"
|
|
|
|
|
|
|
|
#helm repo add forgejo oci://codeberg.org/forgejo-contrib/forgejo
|
|
|
|
#helm repo update
|
|
|
|
#kubectl create ns gitea
|
|
|
|
#kubectl create serviceaccount -n ${NAMESPACE} gitea
|
|
|
|
#kubectl apply -n ${NAMESPACE} -f external-secrets.yaml
|
|
|
|
#cat << EOH > gitea.hcl
|
|
|
|
#path "kv/data/git" {
|
|
|
|
# capabilities = ["read"]
|
|
|
|
#}
|
|
|
|
#EOH
|
|
|
|
#vault policy write gitea gitea.hcl
|
|
|
|
#rm gitea.hcl
|
|
|
|
#
|
|
|
|
#HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
|
|
|
|
#TOKEN="$(kubectl get secret serviceaccounttoken -n forgejo -o go-template='{{ .data.token }}' | base64 -d)"
|
|
|
|
#
|
|
|
|
#vault write auth/${VAULT_AUTH_NAMESPACE}/role/gitea \
|
|
|
|
# bound_service_account_names=gitea \
|
|
|
|
# bound_service_account_namespaces=gitea \
|
|
|
|
# policies=gitea \
|
|
|
|
# ttl=24h
|
|
|
|
#
|
|
|
|
#vault write auth/${VAULT_AUTH_NAMESPACE}/login role=gitea jwt=${TOKEN} iss=https://${HOST_IP}:6443
|
|
|
|
|
|
|
|
helm upgrade --install \
|
|
|
|
forgejo \
|
|
|
|
oci://codeberg.org/forgejo-contrib/forgejo \
|
|
|
|
-f values.yaml \
|
|
|
|
-n ${NAMESPACE} \
|
|
|
|
--version ${CHART_VERSION} \
|
|
|
|
--cleanup-on-fail
|