Skip to content

Commit ee41f4b

Browse files
Added a clarifying comment in values.yaml to explain that values in the external secret (host, port, database) will override the corresponding values defined in external.host, external.port, and external.database.
Confirmed that the conditional blocks in deployment.yaml were already consolidated to eliminate redundancy. The file was already using a single include statement for PostgreSQL environment variables: env: {{- include "eoapi.postgresqlEnv" $ | nindent 12 }} Removed the unused eoapi.mapLegacyPostgresql helper function from _helpers.tpl as it wasn't being referenced anywhere in the codebase.
1 parent 5f45f50 commit ee41f4b

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

helm-chart/eoapi/templates/_helpers.tpl

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -344,30 +344,6 @@ Validate PostgreSQL configuration
344344
{{- end }}
345345
{{- end }}
346346

347-
{{/*
348-
Map legacy configuration to new postgresql configuration
349-
*/}}
350-
{{- define "eoapi.mapLegacyPostgresql" -}}
351-
{{- $postgresql := dict }}
352-
{{- if .Values.postgrescluster.enabled }}
353-
{{- $_ := set $postgresql "type" "postgrescluster" }}
354-
{{- else if .Values.db.enabled }}
355-
{{- $_ := set $postgresql "type" "external-plaintext" }}
356-
{{- $external := dict }}
357-
{{- $_ := set $external "host" .Values.db.settings.secrets.POSTGRES_HOST }}
358-
{{- $_ := set $external "port" .Values.db.settings.secrets.POSTGRES_PORT }}
359-
{{- $_ := set $external "database" .Values.db.settings.secrets.POSTGRES_DB }}
360-
{{- $credentials := dict }}
361-
{{- $_ := set $credentials "username" .Values.db.settings.secrets.POSTGRES_USER }}
362-
{{- $_ := set $credentials "password" .Values.db.settings.secrets.POSTGRES_PASSWORD }}
363-
{{- $_ := set $external "credentials" $credentials }}
364-
{{- $_ := set $postgresql "external" $external }}
365-
{{- else }}
366-
{{- $_ := set $postgresql "type" "postgrescluster" }}
367-
{{- end }}
368-
{{- $postgresql | toYaml }}
369-
{{- end }}
370-
371347
{{/*
372348
values.schema.json doesn't play nice combined value checks
373349
so we use this helper function to check autoscaling rules

helm-chart/eoapi/templates/services/deployment.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,7 @@ spec:
7575
resources:
7676
{{- toYaml (index $v "settings" "resources") | nindent 10 }}
7777
env:
78-
{{- if or $.Values.postgrescluster.enabled (eq $.Values.postgresql.type "postgrescluster") }}
7978
{{- include "eoapi.postgresqlEnv" $ | nindent 12 }}
80-
{{- else if eq $.Values.postgresql.type "external-plaintext" }}
81-
{{- include "eoapi.postgresqlEnv" $ | nindent 12 }}
82-
{{- else if eq $.Values.postgresql.type "external-secret" }}
83-
{{- include "eoapi.postgresqlEnv" $ | nindent 12 }}
84-
{{- end }}
8579
envFrom:
8680
# NOTE: there's no reason we need to use a `ConfigMap` or `Secret` here to get os env vars into the pod.
8781
# we could just template them out here immediately with `value: $_` but this allows us

helm-chart/eoapi/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ postgresql:
8181
username: "username"
8282
password: "password"
8383
# Optional: if these are provided in the secret
84+
# Note: These values override external.host, external.port and external.database if defined
8485
host: "host"
8586
port: "port"
8687
database: "database"

0 commit comments

Comments
 (0)