diff --git a/charts/geonode/templates/_helpers.tpl b/charts/geonode/templates/_helpers.tpl index ad26a9f..2515b0c 100644 --- a/charts/geonode/templates/_helpers.tpl +++ b/charts/geonode/templates/_helpers.tpl @@ -26,6 +26,7 @@ {{- end -}} + # Database definitions {{- define "database_hostname" -}} {{- if (index .Values "postgres-operator" "enabled") -}} @@ -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 -}} @@ -102,4 +131,3 @@ amqp://{{ .Values.rabbitmq.auth.username }}:{{ .Values.rabbitmq.auth.password }} {{- define "boolean2str" -}} {{ . | ternary "True" "False" }} {{- end -}} - diff --git a/charts/geonode/templates/geonode/geonode-deploy.yaml b/charts/geonode/templates/geonode/geonode-deploy.yaml index ecf5792..b712bf8 100644 --- a/charts/geonode/templates/geonode/geonode-deploy.yaml +++ b/charts/geonode/templates/geonode/geonode-deploy.yaml @@ -105,17 +105,17 @@ spec: valueFrom: secretKeyRef: name: {{ include "database_geonode_password_secret_key_ref" . }} - key: geonode_password + key: password - name: GEONODE_GEODATABASE_PASSWORD valueFrom: secretKeyRef: name: {{ include "database_geodata_password_secret_key_ref" . }} - key: geodata_password + key: password - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "database_postgres_password_secret_key_ref" . }} - key: postgres_password + key: password - name: GEODATABASE_URL value: "postgis://$(GEONODE_GEODATABASE):$(GEONODE_GEODATABASE_PASSWORD)@$(DATABASE_HOST):$(DATABASE_PORT)/$(GEONODE_GEODATABASE)" - name: DATABASE_URL @@ -212,17 +212,17 @@ spec: valueFrom: secretKeyRef: name: {{ include "database_geonode_password_secret_key_ref" . }} - key: geonode_password + key: {{ include "database_geonode_password_key_ref" . }} - name: GEONODE_GEODATABASE_PASSWORD valueFrom: secretKeyRef: name: {{ include "database_geodata_password_secret_key_ref" . }} - key: geodata_password + key: {{ include "database_geodata_password_key_ref" . }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "database_postgres_password_secret_key_ref" . }} - key: postgres_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 diff --git a/charts/geonode/templates/geonode/geonode-env.yaml b/charts/geonode/templates/geonode/geonode-env.yaml index c3bbf56..f1ee377 100644 --- a/charts/geonode/templates/geonode/geonode-env.yaml +++ b/charts/geonode/templates/geonode/geonode-env.yaml @@ -180,6 +180,8 @@ data: DATABASE_HOST: {{ include "database_hostname" . | quote }} DATABASE_PORT: {{ include "database_port" . | quote }} + # enables ssl encrypted psql connection (required by postgres-operator databases) + PGSSLMODE: "require" POSTGRES_USER: {{ .Values.postgres.username | quote }} GEONODE_DATABASE: {{ .Values.postgres.geonode_databasename_and_username | quote }} GEONODE_GEODATABASE: {{ .Values.postgres.geodata_databasename_and_username | quote }} diff --git a/charts/geonode/templates/geoserver/geoserver-deploy.yaml b/charts/geonode/templates/geoserver/geoserver-deploy.yaml index 2482703..b506510 100644 --- a/charts/geonode/templates/geoserver/geoserver-deploy.yaml +++ b/charts/geonode/templates/geoserver/geoserver-deploy.yaml @@ -81,7 +81,7 @@ spec: valueFrom: secretKeyRef: name: {{ include "database_geodata_password_secret_key_ref" . }} - key: geodata_password + key: {{ include "database_geodata_password_key_ref" . }} volumeMounts: - name: "{{ include "persistant_volume_name" . }}" diff --git a/charts/geonode/templates/postgres/postgres-external-geodata-secrets.yaml b/charts/geonode/templates/postgres/postgres-external-geodata-secrets.yaml index 832fcd1..f521803 100644 --- a/charts/geonode/templates/postgres/postgres-external-geodata-secrets.yaml +++ b/charts/geonode/templates/postgres/postgres-external-geodata-secrets.yaml @@ -6,6 +6,5 @@ metadata: namespace: {{ .Release.Namespace }} type: Opaque data: - geodata_username: {{ .Values.postgres.geodata_databasename_and_username | b64enc }} geodata_password: {{ .Values.postgres.external_postgres.secret.geodata_password | b64enc }} {{ end }} diff --git a/charts/geonode/templates/postgres/postgres-external-geonode-secrets.yaml b/charts/geonode/templates/postgres/postgres-external-geonode-secrets.yaml index c8cd240..c26a016 100644 --- a/charts/geonode/templates/postgres/postgres-external-geonode-secrets.yaml +++ b/charts/geonode/templates/postgres/postgres-external-geonode-secrets.yaml @@ -6,6 +6,5 @@ metadata: namespace: {{ .Release.Namespace }} type: Opaque data: - geonode_username: {{ .Values.postgres.geonode_databasename_and_username | b64enc }} geonode_password: {{ .Values.postgres.external_postgres.secret.geonode_password | b64enc }} {{ end }} diff --git a/charts/geonode/templates/postgres/postgres-external-postgres-secrets.yaml b/charts/geonode/templates/postgres/postgres-external-postgres-secrets.yaml index 6ac8527..446ec7d 100644 --- a/charts/geonode/templates/postgres/postgres-external-postgres-secrets.yaml +++ b/charts/geonode/templates/postgres/postgres-external-postgres-secrets.yaml @@ -6,6 +6,5 @@ metadata: namespace: {{ .Release.Namespace }} type: Opaque data: - postgres_username: {{ .Values.postgres.username | b64enc }} postgres_password: {{ .Values.postgres.external_postgres.secret.postgres_password | b64enc }} {{ end }}