Skip to content

Commit

Permalink
Update imposm env vars (#352)
Browse files Browse the repository at this point in the history
* Increase initialDelaySeconds for tiler db deployment

* Update env vars for statefulset imposm

* Update statefulset for tiler

* Add configuration to add external host for tiler db

* Add postgres port in configmap

* Update configmap name for tiler db

* Remove env var from tiler server configmap

* Update tiler charts helm to support multi configmap

* Disable statefulset when tiler server is using external host

* Increase proxy timeout for tiler ingress
  • Loading branch information
Rub21 authored Dec 23, 2024
1 parent efb8d5b commit 702ddc6
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 98 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-cm
data:
postgresql.conf: |
{{ .Values.tilerDb.postgresqlConfig.values | indent 4 }}
{{- 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 | quote }}
POSTGRES_PORT: {{ .Values.tilerDb.env.POSTGRES_PORT | quote }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion 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 }}
{{- 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 }}
6 changes: 4 additions & 2 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 @@ -13,7 +14,8 @@ spec:
- port: 5432
targetPort: 5432
selector:
app: {{ template "osm-seed.name" . }}
app: {{ .Release.Name }}-tiler-db
release: {{ .Release.Name }}
run: {{ .Release.Name }}-tiler-db
{{- end }}
{{- end }}
{{- end }}
27 changes: 9 additions & 18 deletions osm-seed/templates/tiler-db/tiler-db-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{{- if .Values.tilerDb.enabled -}}
{{- if not .Values.tilerDb.useExternalHost.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-tiler-db
labels:
app: {{ template "osm-seed.name" . }}
app: {{ .Release.Name }}-tiler-db
component: db-tiler-statefulset
environment: {{ .Values.environment }}
release: {{ .Release.Name }}
spec:
replicas: 1 # we only ever want one replica of the db
replicas: 1
selector:
matchLabels:
app: {{ template "osm-seed.name" . }}
app: {{ .Release.Name }}-tiler-db
release: {{ .Release.Name }}
run: {{ .Release.Name }}-tiler-db
serviceName: {{ .Release.Name }}-tiler-db
template:
metadata:
labels:
app: {{ template "osm-seed.name" . }}
app: {{ .Release.Name }}-tiler-db
release: {{ .Release.Name }}
run: {{ .Release.Name }}-tiler-db
spec:
Expand All @@ -30,21 +31,10 @@ spec:
- name: postgres
containerPort: 5432
protocol: TCP
envFrom:
- configMapRef:
name: {{ .Release.Name }}-tiler-db-cm
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 }}
Expand Down Expand Up @@ -112,3 +102,4 @@ spec:
{{ .Values.tilerDb.nodeSelector.label_key }} : {{ .Values.tilerDb.nodeSelector.label_value }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion osm-seed/templates/tiler-imposm/tiler-imposm-pd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ spec:
storage: {{ .Values.tilerImposm.persistenceDisk.GCP_gcePersistentDisk_size }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions osm-seed/templates/tiler-imposm/tiler-imposm-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.tilerImposm.enabled -}}
# TODO, delete service for tiler-imposm
apiVersion: v1
kind: Service
metadata:
Expand All @@ -13,7 +14,7 @@ spec:
- port: 3000
targetPort: 3000
selector:
app: {{ template "osm-seed.name" . }}
app: {{ .Release.Name }}-tiler-imposm-sts
release: {{ .Release.Name }}
run: {{ .Release.Name }}-tiler-imposm
{{- end }}
run: {{ .Release.Name }}-tiler-imposm-sts
{{- end }}
30 changes: 12 additions & 18 deletions osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-tiler-imposm-statefulset
name: {{ .Release.Name }}-tiler-imposm-sts
labels:
app: {{ template "osm-seed.name" . }}
component: tiler-imposm
Expand All @@ -11,16 +11,16 @@ metadata:
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-tiler-imposm-statefulset
app: {{ .Release.Name }}-tiler-imposm-sts
serviceName: {{ .Release.Name }}-tiler-imposm
replicas: 1
template:
metadata:
labels:
app: {{ .Release.Name }}-tiler-imposm-statefulset
app: {{ .Release.Name }}-tiler-imposm-sts
spec:
containers:
- name: {{ .Release.Name }}-tiler-imposm-statefulset
- name: {{ .Release.Name }}-tiler-imposm-sts
image: {{ .Values.tilerImposm.image.name }}:{{ .Values.tilerImposm.image.tag }}
command: ['./start.sh']
livenessProbe:
Expand All @@ -43,16 +43,7 @@ spec:
cpu: {{ .Values.tilerImposm.resources.limits.cpu }}
{{- end }}
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 }}
# Tiler
- name: TILER_IMPORT_FROM
value: {{ .Values.tilerImposm.env.TILER_IMPORT_FROM | quote }}
- name: TILER_IMPORT_PBF_URL
Expand All @@ -64,13 +55,13 @@ spec:
- name: OVERWRITE_STATE
value: {{ .Values.tilerImposm.env.OVERWRITE_STATE | quote }}
- name: UPLOAD_EXPIRED_FILES
value: {{ .Values.tilerImposm.env.UPLOAD_EXPIRED_FILES | default "true" | quote }}
value: {{ .Values.tilerImposm.env.UPLOAD_EXPIRED_FILES | quote }}
- name: IMPORT_NATURAL_EARTH
value: {{ .Values.tilerImposm.env.IMPORT_NATURAL_EARTH | default "true" | quote }}
value: {{ .Values.tilerImposm.env.IMPORT_NATURAL_EARTH | quote }}
- name: IMPORT_OSM_LAND
value: {{ .Values.tilerImposm.env.IMPORT_OSM_LAND | default "true" | quote }}
value: {{ .Values.tilerImposm.env.IMPORT_OSM_LAND | quote }}
- name: IMPOSM3_IMPORT_LAYERS
value: {{ .Values.tilerImposm.env.IMPOSM3_IMPORT_LAYERS | default "all" | quote }}
value: {{ .Values.tilerImposm.env.IMPOSM3_IMPORT_LAYERS | quote }}
- name: CLOUDPROVIDER
value: {{ .Values.cloudProvider }}
# In case cloudProvider=aws
Expand All @@ -83,6 +74,9 @@ spec:
- name: GCP_STORAGE_BUCKET
value: {{ .Values.GCP_STORAGE_BUCKET }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-tiler-db-cm
volumeMounts:
- mountPath: {{ .Values.tilerImposm.persistenceDisk.mountPath }}
name: tiler-imposm-storage
Expand Down
5 changes: 0 additions & 5 deletions osm-seed/templates/tiler-server/tiler-server-configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ kind: ConfigMap
metadata:
name: {{ .Release.Name }}-tiler-server-cm
data:
POSTGRES_HOST: {{ .Release.Name }}-tiler-db
POSTGRES_DB: {{ .Values.tilerDb.env.POSTGRES_DB | quote }}
POSTGRES_PASSWORD: {{ .Values.tilerDb.env.POSTGRES_PASSWORD | quote }}
POSTGRES_USER: {{ .Values.tilerDb.env.POSTGRES_USER | quote }}
POSTGRES_PORT: {{ .Values.tilerDb.env.POSTGRES_PORT | quote }}
TILER_SERVER_PORT: {{ .Values.tilerServer.env.TILER_SERVER_PORT | quote }}
TILER_CACHE_TYPE: {{ .Values.tilerServer.env.TILER_CACHE_TYPE | quote }}
TILER_CACHE_REGION: {{ .Values.tilerServer.env.TILER_CACHE_REGION | quote }}
Expand Down
4 changes: 3 additions & 1 deletion osm-seed/templates/tiler-server/tiler-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
httpGet:
path: /
port: {{ .Values.tilerServer.env.TILER_SERVER_PORT }}
initialDelaySeconds: 1500
initialDelaySeconds: 1000
timeoutSeconds: 30
{{- if .Values.tilerServer.resources.enabled }}
resources:
Expand All @@ -49,6 +49,8 @@ spec:
envFrom:
- configMapRef:
name: {{ .Release.Name }}-tiler-server-cm
- configMapRef:
name: {{ .Release.Name }}-tiler-db-cm
{{- if .Values.tilerServer.nodeSelector.enabled }}
nodeSelector:
{{ .Values.tilerServer.nodeSelector.label_key }} : {{ .Values.tilerServer.nodeSelector.label_value }}
Expand Down
7 changes: 7 additions & 0 deletions osm-seed/templates/tiler-server/tiler-server-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ metadata:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod-issuer
nginx.ingress.kubernetes.io/proxy-body-size: 5m
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod-issuer
nginx.ingress.kubernetes.io/proxy-body-size: 200m
nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
ingressClassName: nginx
tls:
Expand Down
3 changes: 2 additions & 1 deletion osm-seed/templates/tiler-server/tiler-server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ metadata:
{{- if and (eq .Values.serviceType "LoadBalancer") .Values.AWS_SSL_ARN }}
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .Values.AWS_SSL_ARN }}
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: https
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: https
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "600"
{{- end }}
{{- if eq .Values.serviceType "ClusterIP" }}
kubernetes.io/ingress.class: nginx
Expand Down
46 changes: 6 additions & 40 deletions osm-seed/templates/tiler-server/tiler-server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "osm-seed.fullname" . }}-tiler-server
name: {{ .Release.Name }}-tiler-server
labels:
app: {{ template "osm-seed.name" . }}
component: tiler-server-statefulset
Expand Down Expand Up @@ -47,45 +47,11 @@ spec:
memory: {{ .Values.tilerServer.resources.limits.memory }}
cpu: {{ .Values.tilerServer.resources.limits.cpu }}
{{- end }}
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
value: {{ .Values.tilerServer.env.TILER_CACHE_TYPE }}
- name: TILER_CACHE_BUCKET
value: {{ .Values.tilerServer.env.TILER_CACHE_BUCKET }}
- name: TILER_CACHE_BASEPATH
value: {{ quote .Values.tilerServer.env.TILER_CACHE_BASEPATH }}
- name: TILER_CACHE_AWS_ACCESS_KEY_ID
value: {{ quote .Values.tilerServer.env.TILER_CACHE_AWS_ACCESS_KEY_ID }}
- name: TILER_CACHE_AWS_SECRET_ACCESS_KEY
value: {{ quote .Values.tilerServer.env.TILER_CACHE_AWS_SECRET_ACCESS_KEY }}
- name: TILER_CACHE_MAX_ZOOM
value: {{ quote .Values.tilerServer.env.TILER_CACHE_MAX_ZOOM }}
- name: CLOUDPROVIDER
value: {{ .Values.cloudProvider }}
# In case cloudProvider=aws
{{- if eq .Values.cloudProvider "aws" }}
- name: AWS_S3_BUCKET
value: {{ .Values.AWS_S3_BUCKET }}
{{- end }}
# In case cloudProvider=gcp
{{- if eq .Values.cloudProvider "gcp" }}
- name: GCP_STORAGE_BUCKET
value: {{ .Values.GCP_STORAGE_BUCKET }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-tiler-server-cm
- configMapRef:
name: {{ .Release.Name }}-tiler-db-cm
volumeMounts:
- mountPath: /mnt/data
name: tiler-server-storage
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 702ddc6

Please sign in to comment.