Skip to content

Commit

Permalink
external postgres (#2)
Browse files Browse the repository at this point in the history
* external postgres

* Rename accidentally misnamed "enable" config

---------

Co-authored-by: Gokhan Sari
  • Loading branch information
vixns authored Oct 14, 2024
1 parent 8d917b6 commit 4a3153b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions charts/listmonk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ $ helm uninstall --namespace listmonk listmonk
| listmonk.image.repository | string | `"listmonk/listmonk"` | the listmonk image repository |
| listmonk.image.tag | string | `"v3.0.0"` | the listmonk image tag |
| listmonk.replicas | int | `1` | the number of listmonk deployment replicas |
| postgres.enabled | bool | `true` | enable internal postgres |
| postgres.hostname | string | `""` | external postgres hostname |
| postgres.database | string | `"listmonk"` | the postgres database name |
| postgres.image.repository | string | `"postgres"` | the postgres image repository |
| postgres.image.tag | string | `"16-alpine"` | the postgres image tag |
Expand Down
8 changes: 8 additions & 0 deletions charts/listmonk/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "listmonk.postgresHostname" -}}
{{- if .Values.postgres.enabled }}
{{- printf "%s-postgres" (include "listmonk.fullname" .) -}}
{{- else }}
{{- required ".Values.postgres.hostname is required when chart's postgres is disabled" .Values.postgres.hostname }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/listmonk/templates/configmap-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ metadata:
{{- include "listmonk.labels" . | nindent 4 }}
data:
DATABASE: "{{ .Values.postgres.database}}"
HOST: "{{ include "listmonk.fullname" . }}-postgres"
HOST: {{ include "listmonk.postgresHostname" . | quote }}
2 changes: 1 addition & 1 deletion charts/listmonk/templates/ingress-listmonk.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.ingress.enable }}
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down
2 changes: 2 additions & 0 deletions charts/listmonk/templates/secret-postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.postgres.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,3 +8,4 @@ metadata:
data:
PASSWORD: {{ required "A valid .Values.postgres.password is required" .Values.postgres.password | b64enc }}
USER: {{ required "A valid .Values.postgres.user is required" .Values.postgres.user | b64enc }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/listmonk/templates/service-postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.postgres.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -14,3 +15,4 @@ spec:
port: 5432
protocol: TCP
targetPort: 5432
{{- end }}
2 changes: 2 additions & 0 deletions charts/listmonk/templates/statefulset-postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.postgres.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -60,3 +61,4 @@ spec:
requests:
storage: 10Gi
volumeMode: Filesystem
{{- end }}
6 changes: 5 additions & 1 deletion charts/listmonk/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ingress:
# -- annotations for the ingress
annotations: {}
# -- enable the ingress
enable: false
enabled: false
# -- host for the ingress
host: listmonk.local
# -- tls configuration for the ingress
Expand All @@ -21,6 +21,10 @@ listmonk:
# -- the number of listmonk deployment replicas
replicas: 1
postgres:
# -- enable postgres
enabled: true
# -- when not enabled, the external postgress service hostname is required
hostname: ""
# -- the postgres database name
database: listmonk
image:
Expand Down

0 comments on commit 4a3153b

Please sign in to comment.