Skip to content

Commit

Permalink
Add config for postgres configmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jul 10, 2024
1 parent fa5aa38 commit e1f4a49
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
14 changes: 14 additions & 0 deletions osm-seed/templates/db/db-mapconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.db.enabled -}}
{{- if .Values.db.postgresqlConfig.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-db-postgresql-config
labels:
app: {{ template "osm-seed.name" . }}
release: {{ .Release.Name }}
data:
postgresql.conf: |
{{ .Values.db.postgresqlConfig.values | indent 4 }}
{{- end }}
{{- end }}
17 changes: 16 additions & 1 deletion osm-seed/templates/db/db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ spec:
valueFrom: { fieldRef: { fieldPath: status.podIP } }
- name: LOG_STATEMENT
value: {{ default "none" .Values.db.env.LOG_STATEMENT | quote }}
{{- if .Values.db.postgresqlConfig.enabled }}
command:
- "sh"
- "-c"
- "su postgres -c 'postgres -c config_file=/etc/postgresql/postgresql.conf'"
{{- end }}
livenessProbe:
exec:
command:
Expand All @@ -71,10 +77,14 @@ spec:
periodSeconds: 5
volumeMounts:
- name: postgres-storage
mountPath: {{ .Values.db.persistenceDisk.mountPath }}
mountPath: /var/lib/postgresql/data
subPath: {{ .Values.db.persistenceDisk.subPath }}
- name: shared-memory
mountPath: /dev/shm
{{- if .Values.db.postgresqlConfig.enabled }}
- name: db-postgresql-config
mountPath: /etc/postgresql/
{{- end }}
{{- if .Values.db.resources.enabled }}
resources:
requests:
Expand All @@ -96,6 +106,11 @@ spec:
emptyDir:
medium: Memory
sizeLimit: {{ .Values.db.sharedMemorySize }}
{{- if .Values.db.postgresqlConfig.enabled }}
- name: db-postgresql-config
configMap:
name: {{ .Release.Name }}-db-postgresql-config
{{- end }}
{{- if .Values.db.nodeSelector.enabled }}
nodeSelector:
{{ .Values.db.nodeSelector.label_key }} : {{ .Values.db.nodeSelector.label_value }}
Expand Down
28 changes: 24 additions & 4 deletions osm-seed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ db:
localVolumeHostPath: /mnt/db-data
localVolumeSize: 10Gi
# AWS
AWS_ElasticBlockStore_volumeID: vol-1234bcd
AWS_ElasticBlockStore_size: 500Gi
AWS_ElasticBlockStore_volumeID: vol-06a278f66b15d4b3c
AWS_ElasticBlockStore_size: 50Gi
# GCP
GCP_gcePersistentDisk_pdName: osmseed-disk-db-v1
GCP_gcePersistentDisk_size: 50Gi
Expand All @@ -105,11 +105,31 @@ db:
nodeSelector:
enabled: false
sharedMemorySize: 64Mi
postgresqlConfig:
enabled: false
values: |
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
effective_cache_size = 256MB
maintenance_work_mem = 64MB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 4MB
min_wal_size = 80MB
max_wal_size = 1GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
# ====================================================================================================
# Variables for osm-seed website
# ====================================================================================================
web:
enabled: true
enabled: false
image:
name: ""
tag: ""
Expand Down Expand Up @@ -152,7 +172,7 @@ web:
# Variables for memcached. Memcached is used to store session cookies
# ====================================================================================================
memcached:
enabled: true
enabled: false
nodeSelector:
enabled: false
label_key: nodegroup_type
Expand Down

0 comments on commit e1f4a49

Please sign in to comment.