Skip to content

Commit

Permalink
[fixes #145] Bug: Database connection issue when using postgres-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Wallschlaeger committed Feb 23, 2024
1 parent 4de8c7f commit 1091b69
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
30 changes: 29 additions & 1 deletion charts/geonode/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{{- end -}}



# Database definitions
{{- define "database_hostname" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
Expand Down Expand Up @@ -76,6 +77,34 @@
{{- end -}}
{{- end -}}

# define password key name in geonode postgres secret
{{- define "database_geonode_password_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
password
{{- else if .Values.postgres.external_postgres.enabled -}}
geonode-password
{{- end -}}
{{- end -}}

# define password key name in geodata postgres secret
{{- define "database_geodata_password_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
password
{{- else if .Values.postgres.external_postgres.enabled -}}
geodata-password
{{- end -}}
{{- end -}}

# define password key name in postgres postgres secret
{{- define "database_postgres_password_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
password
{{- else if .Values.postgres.external_postgres.enabled -}}
postgres-password
{{- end -}}
{{- end -}}


{{- define "pycsw_pod_name" -}}
{{ .Release.Name }}-{{ .Values.pycsw.pod_name }}
{{- end -}}
Expand All @@ -102,4 +131,3 @@ amqp://{{ .Values.rabbitmq.auth.username }}:{{ .Values.rabbitmq.auth.password }}
{{- define "boolean2str" -}}
{{ . | ternary "True" "False" }}
{{- end -}}

6 changes: 3 additions & 3 deletions charts/geonode/templates/geonode/geonode-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,17 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "database_geonode_password_secret_key_ref" . }}
key: password
key: {{ include "database_geonode_password_key_ref" . }}
- name: GEONODE_GEODATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "database_geodata_password_secret_key_ref" . }}
key: password
key: {{ include "database_geodata_password_key_ref" . }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "database_postgres_password_secret_key_ref" . }}
key: password
key: {{ include "database_postgres_password_key_ref" . }}
- name: GEODATABASE_URL
value: "postgis://$(GEONODE_GEODATABASE):$(GEONODE_GEODATABASE_PASSWORD)@$(DATABASE_HOST):$(DATABASE_PORT)/$(GEONODE_GEODATABASE)"
- name: DATABASE_URL
Expand Down
2 changes: 1 addition & 1 deletion charts/geonode/templates/geoserver/geoserver-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "database_geodata_password_secret_key_ref" . }}
key: password
key: {{ include "database_geodata_password_key_ref" . }}

volumeMounts:
- name: "{{ include "persistant_volume_name" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ metadata:
namespace: {{ .Release.Namespace }}
type: Opaque
data:
username: {{ .Values.postgres.geodata_databasename_and_username | b64enc }}
password: {{ .Values.postgres.external_postgres.secret.geodata_password | b64enc }}
geodata_password: {{ .Values.postgres.external_postgres.secret.geodata_password | b64enc }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ metadata:
namespace: {{ .Release.Namespace }}
type: Opaque
data:
username: {{ .Values.postgres.geonode_databasename_and_username | b64enc }}
password: {{ .Values.postgres.external_postgres.secret.geonode_password | b64enc }}
geonode_password: {{ .Values.postgres.external_postgres.secret.geonode_password | b64enc }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ metadata:
namespace: {{ .Release.Namespace }}
type: Opaque
data:
username: {{ .Values.postgres.username | b64enc }}
password: {{ .Values.postgres.external_postgres.secret.postgres_password | b64enc }}
postgres_password: {{ .Values.postgres.external_postgres.secret.postgres_password | b64enc }}
{{ end }}

0 comments on commit 1091b69

Please sign in to comment.