From 45db24730137ec85d29be5ef06d77f5343c95d0b Mon Sep 17 00:00:00 2001 From: ange Date: Wed, 15 May 2024 19:48:31 +0200 Subject: [PATCH] feat: instance_name == branch --- .env | 2 +- .gitea/workflows/deploy.yaml | 1 + config/settings.yaml | 2 +- manifests/bin/deploy.sh | 8 +++++--- manifests/common/app.yaml | 1 - manifests/common/clusterrole.yaml | 1 + 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 77c8380..6f77a66 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ PROD_URL=apps.gmoker.com -IMAGEAPP=ghcr.io/gethomepage/homepage:v0.8.12 +IMAGEAPP=ghcr.io/gethomepage/homepage:v0.8.13 diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index bd60ffd..97e4dc5 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -15,6 +15,7 @@ jobs: fi cat <> .env BASE_URL="$BASE_URL" + INSTANCE_NAME="${{ gitea.ref_name }}" EOF cat .env diff --git a/config/settings.yaml b/config/settings.yaml index 63fbcbb..558b50a 100644 --- a/config/settings.yaml +++ b/config/settings.yaml @@ -3,4 +3,4 @@ # https://gethomepage.dev/latest/configs/settings headerStyle: clean -instanceName: public +instanceName: "$INSTANCE_NAME" diff --git a/manifests/bin/deploy.sh b/manifests/bin/deploy.sh index 19c61f2..d960f38 100755 --- a/manifests/bin/deploy.sh +++ b/manifests/bin/deploy.sh @@ -30,9 +30,11 @@ function kgcmkey() { kubectl get configmap "$cm" -o jsonpath="{.data.$key}" } - -mapfile -t files "$(printf -- '--from-file=%s\n' config/*)" -kcreatecm homepage-config "${files[@]}" +cmd=(kcreatecm homepage-config) +for f in config/*; do + cmd+=("--from-file=$f=<(envsubst \"\$(env | xargs printf '$%s ')\" < $f)") +done +eval "${cmd[*]}" kapply common/clusterrole.yaml common/app.yaml diff --git a/manifests/common/app.yaml b/manifests/common/app.yaml index 84dec71..cb8aee8 100644 --- a/manifests/common/app.yaml +++ b/manifests/common/app.yaml @@ -44,7 +44,6 @@ metadata: labels: app: app spec: - revisionHistoryLimit: 3 replicas: $NB_REPLICAS selector: matchLabels: diff --git a/manifests/common/clusterrole.yaml b/manifests/common/clusterrole.yaml index 839975e..8580135 100644 --- a/manifests/common/clusterrole.yaml +++ b/manifests/common/clusterrole.yaml @@ -29,3 +29,4 @@ roleRef: subjects: - kind: ServiceAccount name: homepage + namespace: "$K8S_NS"