Skip to content

Commit

Permalink
Add configuration to add external host for tiler db
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Dec 6, 2024
1 parent c814eda commit 7b1713f
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 59 deletions.
19 changes: 11 additions & 8 deletions osm-seed/templates/tiler-db/tiler-db-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions osm-seed/templates/tiler-db/tiler-db-pd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.tilerDb.enabled -}}
{{- if not .Values.tilerDb.useExternalHost.enabled -}}
{{- if .Values.tilerDb.persistenceDisk.enabled -}}
apiVersion: v1
kind: PersistentVolume
Expand Down Expand Up @@ -82,4 +83,5 @@ spec:
storage: {{ .Values.tilerDb.persistenceDisk.GCP_gcePersistentDisk_size }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions osm-seed/templates/tiler-db/tiler-db-postgresql-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions osm-seed/templates/tiler-db/tiler-db-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.tilerDb.enabled -}}
{{- if not .Values.tilerDb.useExternalHost.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -16,4 +17,5 @@ spec:
app: {{ template "osm-seed.name" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}-tiler-db
{{- end }}
{{- end }}
39 changes: 22 additions & 17 deletions osm-seed/templates/tiler-db/tiler-db-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.tilerDb.enabled -}}
{{- if not .Values.tilerDb.useExternalHost.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -106,3 +110,4 @@ spec:
{{ .Values.tilerDb.nodeSelector.label_key }} : {{ .Values.tilerDb.nodeSelector.label_value }}
{{- end }}
{{- end }}
{{- end }}
13 changes: 3 additions & 10 deletions osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions osm-seed/templates/tiler-server/tiler-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions osm-seed/templates/tiler-server/tiler-server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions osm-seed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down

0 comments on commit 7b1713f

Please sign in to comment.