diff --git a/osm-seed/templates/tiler-db/tiler-db-configmap.yaml b/osm-seed/templates/tiler-db/tiler-db-configmap.yaml index efef635a..383b2c83 100644 --- a/osm-seed/templates/tiler-db/tiler-db-configmap.yaml +++ b/osm-seed/templates/tiler-db/tiler-db-configmap.yaml @@ -1,14 +1,17 @@ {{- if .Values.tilerDb.enabled -}} -{{- if .Values.tilerDb.postgresqlConfig.enabled -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-tiler-db-postgresql-config - labels: - app: {{ template "osm-seed.name" . }} - release: {{ .Release.Name }} + name: {{ .Release.Name }}-tiler-db-common-env data: - postgresql.conf: | -{{ .Values.tilerDb.postgresqlConfig.values | indent 4 }} -{{- end }} + {{- if not .Values.tilerDb.useExternalHost.enabled }} + POSTGRES_HOST: {{ .Release.Name }}-tiler-db + PGDATA: {{ .Values.tilerDb.persistenceDisk.mountPath }} + {{- else }} + POSTGRES_HOST: {{ .Values.tilerDb.env.POSTGRES_HOST }} + {{- end }} + POSTGRES_DB: {{ .Values.tilerDb.env.POSTGRES_DB }} + POSTGRES_PASSWORD: {{ .Values.tilerDb.env.POSTGRES_PASSWORD | quote }} + POSTGRES_USER: {{ .Values.tilerDb.env.POSTGRES_USER | default "postgres" | quote }} + PGUSER: {{ .Values.tilerDb.env.POSTGRES_USER | default "postgres" | quote }} {{- end }} \ No newline at end of file diff --git a/osm-seed/templates/tiler-db/tiler-db-pd.yaml b/osm-seed/templates/tiler-db/tiler-db-pd.yaml index 5e2ad544..33a38d89 100644 --- a/osm-seed/templates/tiler-db/tiler-db-pd.yaml +++ b/osm-seed/templates/tiler-db/tiler-db-pd.yaml @@ -1,4 +1,5 @@ {{- if .Values.tilerDb.enabled -}} +{{- if not .Values.tilerDb.useExternalHost.enabled -}} {{- if .Values.tilerDb.persistenceDisk.enabled -}} apiVersion: v1 kind: PersistentVolume @@ -82,4 +83,5 @@ spec: storage: {{ .Values.tilerDb.persistenceDisk.GCP_gcePersistentDisk_size }} {{- end }} {{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/osm-seed/templates/tiler-db/tiler-db-postgresql-configmap.yaml b/osm-seed/templates/tiler-db/tiler-db-postgresql-configmap.yaml new file mode 100644 index 00000000..e7e547c2 --- /dev/null +++ b/osm-seed/templates/tiler-db/tiler-db-postgresql-configmap.yaml @@ -0,0 +1,16 @@ +{{- if .Values.tilerDb.enabled -}} +{{- if not .Values.tilerDb.useExternalHost.enabled -}} +{{- if .Values.tilerDb.postgresqlConfig.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-tiler-db-postgresql-config + labels: + app: {{ template "osm-seed.name" . }} + release: {{ .Release.Name }} +data: + postgresql.conf: | +{{ .Values.tilerDb.postgresqlConfig.values | indent 4 }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/osm-seed/templates/tiler-db/tiler-db-service.yaml b/osm-seed/templates/tiler-db/tiler-db-service.yaml index 646d355e..f8fa6957 100644 --- a/osm-seed/templates/tiler-db/tiler-db-service.yaml +++ b/osm-seed/templates/tiler-db/tiler-db-service.yaml @@ -1,4 +1,5 @@ {{- if .Values.tilerDb.enabled -}} +{{- if not .Values.tilerDb.useExternalHost.enabled -}} apiVersion: v1 kind: Service metadata: @@ -16,4 +17,5 @@ spec: app: {{ template "osm-seed.name" . }} release: {{ .Release.Name }} run: {{ .Release.Name }}-tiler-db +{{- end }} {{- end }} \ No newline at end of file diff --git a/osm-seed/templates/tiler-db/tiler-db-statefulset.yaml b/osm-seed/templates/tiler-db/tiler-db-statefulset.yaml index 724f1f04..208d0c50 100644 --- a/osm-seed/templates/tiler-db/tiler-db-statefulset.yaml +++ b/osm-seed/templates/tiler-db/tiler-db-statefulset.yaml @@ -1,4 +1,5 @@ {{- if .Values.tilerDb.enabled -}} +{{- if not .Values.tilerDb.useExternalHost.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: @@ -30,23 +31,26 @@ spec: - name: postgres containerPort: 5432 protocol: TCP - env: - # - name: GET_HOSTS_FROM - # value: dns - - name: POSTGRES_HOST - value: {{ .Release.Name }}-tiler-db - - name: POSTGRES_DB - value: {{ .Values.tilerDb.env.POSTGRES_DB }} - - name: POSTGRES_PASSWORD - value: {{ quote .Values.tilerDb.env.POSTGRES_PASSWORD }} - - name: POSTGRES_USER - value: {{ default "postgres" .Values.tilerDb.env.POSTGRES_USER | quote }} - - name: PGUSER - value: {{ default "postgres" .Values.tilerDb.env.POSTGRES_USER | quote }} - - name: PGDATA - value: {{ .Values.tilerDb.persistenceDisk.mountPath }} - - name: POD_IP - valueFrom: { fieldRef: { fieldPath: status.podIP } } + envFrom: + - configMapRef: + name: {{ .Release.Name }}-tiler-db-common-env + # env: + # # - name: GET_HOSTS_FROM + # # value: dns + # - name: POSTGRES_HOST + # value: {{ .Release.Name }}-tiler-db + # - name: POSTGRES_DB + # value: {{ .Values.tilerDb.env.POSTGRES_DB }} + # - name: POSTGRES_PASSWORD + # value: {{ quote .Values.tilerDb.env.POSTGRES_PASSWORD }} + # - name: POSTGRES_USER + # value: {{ default "postgres" .Values.tilerDb.env.POSTGRES_USER | quote }} + # - name: PGUSER + # value: {{ default "postgres" .Values.tilerDb.env.POSTGRES_USER | quote }} + # - name: PGDATA + # value: {{ .Values.tilerDb.persistenceDisk.mountPath }} + # - name: POD_IP + # valueFrom: { fieldRef: { fieldPath: status.podIP } } {{- if and .Values.tilerDb.postgresqlConfig.enabled .Values.tilerDb.persistenceDisk.enabled }} command: - "sh" @@ -106,3 +110,4 @@ spec: {{ .Values.tilerDb.nodeSelector.label_key }} : {{ .Values.tilerDb.nodeSelector.label_value }} {{- end }} {{- end }} +{{- end }} diff --git a/osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml b/osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml index 904b8a56..a529781f 100644 --- a/osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml +++ b/osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml @@ -42,17 +42,10 @@ spec: memory: {{ .Values.tilerImposm.resources.limits.memory }} cpu: {{ .Values.tilerImposm.resources.limits.cpu }} {{- end }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-tiler-db-common-env env: - - name: POSTGRES_HOST - value: {{ .Release.Name }}-tiler-db - - name: POSTGRES_DB - value: {{ .Values.tilerDb.env.POSTGRES_DB | quote }} - - name: POSTGRES_PASSWORD - value: {{ .Values.tilerDb.env.POSTGRES_PASSWORD | quote }} - - name: POSTGRES_USER - value: {{ .Values.tilerDb.env.POSTGRES_USER | quote }} - - name: POSTGRES_PORT - value: {{ .Values.tilerDb.env.POSTGRES_PORT | quote }} - name: TILER_IMPORT_FROM value: {{ .Values.tilerImposm.env.TILER_IMPORT_FROM | quote }} - name: TILER_IMPORT_PBF_URL diff --git a/osm-seed/templates/tiler-server/tiler-server-deployment.yaml b/osm-seed/templates/tiler-server/tiler-server-deployment.yaml index 65a474f9..d4561a79 100644 --- a/osm-seed/templates/tiler-server/tiler-server-deployment.yaml +++ b/osm-seed/templates/tiler-server/tiler-server-deployment.yaml @@ -46,19 +46,10 @@ spec: memory: {{ .Values.tilerServer.resources.limits.memory }} cpu: {{ .Values.tilerServer.resources.limits.cpu }} {{- end }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-tiler-db-common-env env: - # tiler-db env variables - - name: POSTGRES_HOST - value: {{ .Release.Name }}-tiler-db - - name: POSTGRES_DB - value: {{ .Values.tilerDb.env.POSTGRES_DB }} - - name: POSTGRES_PASSWORD - value: {{ quote .Values.tilerDb.env.POSTGRES_PASSWORD }} - - name: POSTGRES_USER - value: {{ .Values.tilerDb.env.POSTGRES_USER }} - - name: POSTGRES_PORT - value: {{ .Values.tilerDb.env.POSTGRES_PORT | quote }} - # tiler-server env variables - name: TILER_SERVER_PORT value: {{ .Values.tilerServer.env.TILER_SERVER_PORT | quote }} - name: TILER_CACHE_TYPE diff --git a/osm-seed/templates/tiler-server/tiler-server-statefulset.yaml b/osm-seed/templates/tiler-server/tiler-server-statefulset.yaml index fbba8247..c28bd2f6 100644 --- a/osm-seed/templates/tiler-server/tiler-server-statefulset.yaml +++ b/osm-seed/templates/tiler-server/tiler-server-statefulset.yaml @@ -47,19 +47,10 @@ spec: memory: {{ .Values.tilerServer.resources.limits.memory }} cpu: {{ .Values.tilerServer.resources.limits.cpu }} {{- end }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-tiler-db-common-env env: - # tiler-db env variables - - name: POSTGRES_HOST - value: {{ .Release.Name }}-tiler-db - - name: POSTGRES_DB - value: {{ .Values.tilerDb.env.POSTGRES_DB }} - - name: POSTGRES_PASSWORD - value: {{ quote .Values.tilerDb.env.POSTGRES_PASSWORD }} - - name: POSTGRES_USER - value: {{ .Values.tilerDb.env.POSTGRES_USER }} - - name: POSTGRES_PORT - value: {{ .Values.tilerDb.env.POSTGRES_PORT | quote }} - # tiler-server env variables - name: TILER_SERVER_PORT value: {{ .Values.tilerServer.env.TILER_SERVER_PORT | quote }} - name: TILER_CACHE_TYPE diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index 2a345d6d..562ae1c8 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -348,6 +348,8 @@ osmProcessor: # ==================================================================================================== tilerDb: enabled: false + useExternalHost: # In case you are using an external host for the database, make sure you add POSTGRES_HOST + enabled: false image: name: "" tag: ""