From ccac13ba0aca11b3f2825e8862fb264682aede78 Mon Sep 17 00:00:00 2001 From: DaviPtrs Date: Wed, 4 Dec 2024 14:35:50 -0300 Subject: [PATCH] use aux helm chart for shared resources --- .drone.yml | 36 +++++++++++++++++++++++++++++ apps/commune-governance/values.yaml | 4 ++-- apps/commune-validator/values.yaml | 4 ++-- apps/commune-worker/values.yaml | 6 ++--- values-utils.yaml | 13 +++++++++++ values.yaml | 15 +----------- 6 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 values-utils.yaml diff --git a/.drone.yml b/.drone.yml index 9bb13fc..89d8406 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,6 +37,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps @@ -101,6 +107,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps @@ -165,6 +177,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps @@ -229,6 +247,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps @@ -293,6 +317,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps @@ -357,6 +387,12 @@ steps: - export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7} - env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" ) - release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" ) + # Install shared resources + - >- + helm template commune-"$env_name"-aux + -f values-utils.yaml -n commune-"$env_name"-web-apps + --set environmentName="$env_name" + renlabs/utils | kubectl apply -f - # Install application chart - >- helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps diff --git a/apps/commune-governance/values.yaml b/apps/commune-governance/values.yaml index 6fa75aa..5251dac 100644 --- a/apps/commune-governance/values.yaml +++ b/apps/commune-governance/values.yaml @@ -6,10 +6,10 @@ deployment: JWT_SECRET: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: jwt_secret POSTGRES_URL: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: community_validator_db_url \ No newline at end of file diff --git a/apps/commune-validator/values.yaml b/apps/commune-validator/values.yaml index c3325f4..11999ea 100644 --- a/apps/commune-validator/values.yaml +++ b/apps/commune-validator/values.yaml @@ -6,10 +6,10 @@ deployment: JWT_SECRET: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: jwt_secret POSTGRES_URL: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: community_validator_db_url \ No newline at end of file diff --git a/apps/commune-worker/values.yaml b/apps/commune-worker/values.yaml index 3ca3b74..9436cc5 100644 --- a/apps/commune-worker/values.yaml +++ b/apps/commune-worker/values.yaml @@ -48,17 +48,17 @@ deployment: COMMUNITY_VALIDATOR_MNEMONIC: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: community_validator_mnemonic POSTGRES_URL: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: community_validator_db_url DAO_NOTIFIER_DISCORD_WEBHOOK_URL: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: dao_notifier_discord_webhook_url additionalContainers: diff --git a/values-utils.yaml b/values-utils.yaml new file mode 100644 index 0000000..926781a --- /dev/null +++ b/values-utils.yaml @@ -0,0 +1,13 @@ +staticSecret: + enabled: true + secrets: + commune-{{ .Values.environmentName }}-web-apps: + type: kv-v2 + mount: commune_infra + path: '{{ .Values.environmentName }}_web_apps' + destination: + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' + create: true + overwrite: true + refreshAfter: 30s + vaultAuthRef: 'commune-{{ .Values.environmentName }}-web-apps-commune-{{ .Values.environmentName }}-web-apps-default' diff --git a/values.yaml b/values.yaml index 1f43116..3be9046 100644 --- a/values.yaml +++ b/values.yaml @@ -15,7 +15,7 @@ deployment: PINATA_JWT: valueFrom: secretKeyRef: - name: '{{ .Values.environmentName }}-web-apps-secret' + name: 'commune-{{ .Values.environmentName }}-web-apps-secret' key: pinata_jwt startupProbe: @@ -88,16 +88,3 @@ configMap: next_public_ws_url: "{{ .Values.wssApiEndpoint }}" next_public_cache_provider_url: "{{ .Values.cacheUrl }}" -staticSecret: - enabled: true - secrets: - - name: web-apps - type: kv-v2 - mount: commune_infra - path: '{{ .Values.environmentName }}_web_apps' - destination: - name: '{{ .Values.environmentName }}-web-apps-secret' - create: true - overwrite: true - refreshAfter: 30s - vaultAuthRef: 'commune-{{ .Values.environmentName }}-web-apps-commune-{{ .Values.environmentName }}-web-apps-default'