Skip to content

Commit 860ef38

Browse files
Refactor PostgreSQL configuration in gateway Helm chart for improved validation and clarity.
1 parent d9bd177 commit 860ef38

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

kubernetes/helm/gateway-helm-chart/templates/gateway/controller/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ spec:
106106
- name: APIP_GW_DEVELOPMENT_MODE
107107
value: {{ .Values.gateway.developmentMode | toString | quote }}
108108
{{- if and (eq .Values.gateway.config.controller.storage.type "postgres") $controller.postgres.passwordSecretRef.name }}
109-
- name: APIP_GW_GATEWAY__CONTROLLER_STORAGE_POSTGRES_PASSWORD
109+
- name: APIP_GW_CONTROLLER_STORAGE_POSTGRES_PASSWORD
110110
valueFrom:
111111
secretKeyRef:
112112
name: {{ $controller.postgres.passwordSecretRef.name }}

kubernetes/helm/gateway-helm-chart/templates/gateway/gateway-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{{- $gc := .Values.gateway.config.controller -}}
33
{{- $router := .Values.gateway.config.router -}}
44
{{- $pe := .Values.gateway.config.policy_engine -}}
5+
{{- $pg := $gc.storage.postgres -}}
56
{{- $controllerHost := printf "%s-controller" (include "gateway-operator.fullname" .) -}}
67
apiVersion: v1
78
kind: ConfigMap
@@ -39,15 +40,14 @@ data:
3940
path = {{ $gc.storage.sqlite.path | quote }}
4041
4142
{{- if eq $gc.storage.type "postgres" }}
42-
{{- $pg := $gc.storage.postgres }}
4343
[controller.storage.postgres]
4444
{{- if $pg.dsn }}
4545
dsn = {{ $pg.dsn | quote }}
4646
{{- else }}
47-
host = {{ $pg.host | quote }}
47+
host = {{ required "gateway.config.controller.storage.postgres.host is required when storage.type is \"postgres\" and dsn is unset" $pg.host | quote }}
4848
port = {{ $pg.port | int }}
49-
database = {{ $pg.database | quote }}
50-
user = {{ $pg.user | quote }}
49+
database = {{ required "gateway.config.controller.storage.postgres.database is required when storage.type is \"postgres\" and dsn is unset" $pg.database | quote }}
50+
user = {{ required "gateway.config.controller.storage.postgres.user is required when storage.type is \"postgres\" and dsn is unset" $pg.user | quote }}
5151
sslmode = {{ $pg.sslmode | default "require" | quote }}
5252
connect_timeout = {{ $pg.connect_timeout | default "5s" | quote }}
5353
max_open_conns = {{ $pg.max_open_conns | default 25 | int }}

0 commit comments

Comments
 (0)