mirror of https://github.com/requarks/wiki
fix(helm): Replace bitname PostgreSQL chart with custom statefulset (#7936)
* fix(helm): Replace Bitnami PostgreSQL chart with custom StatefulSet (#7831) * refactor: migrate from Bitnami PostgreSQL to official PostgreSQL image Replace Bitnami PostgreSQL dependency with custom PostgreSQL StatefulSet implementation Add new PostgreSQL templates: statefulset, service, and PVC Update values.yaml to include PostgreSQL image configuration with official postgres:17.4 image Implement custom PostgreSQL deployment using official Docker Hub image instead of Bitnami chart Add PostgreSQL resource, nodeSelector, tolerations, and affinity configuration options Update helper templates to support new PostgreSQL implementation Update deployment template to connect to the new PostgreSQL implementation Update README.md to document the new PostgreSQL configuration parameters BREAKING CHANGE: This replaces the Bitnami PostgreSQL dependency with a custom PostgreSQL implementation using the official PostgreSQL image from Docker Hub, changing how PostgreSQL is deployed and configured. Signed-off-by: Ilya Gilev jazer23569@gmail.com * feature: added a option to use an existing secret for postresql installation --------- Signed-off-by: Ilya Gilev jazer23569@gmail.com * refactor(helm): adjust helm templates for clarity --------- Signed-off-by: Ilya Gilev jazer23569@gmail.com Co-authored-by: acidsugarx <58903233+acidsugarx@users.noreply.github.com>main
parent
d14b0a5509
commit
8fc931a0d9
@ -1,6 +0,0 @@
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 8.10.14
|
||||
digest: sha256:db7c1e0bc9ec0ed45520521bd76bb390d04711fd0f04affaadafa1dc498ce68b
|
||||
generated: "2020-07-21T20:34:41.41180748-04:00"
|
||||
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
{{- if and .Values.postgresql.enabled .Values.postgresql.persistence.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.postgresql.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgresql.persistence.size | quote }}
|
||||
{{- if .Values.postgresql.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.postgresql.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: {{ .Values.postgresql.persistence.storageClass | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,12 @@
|
||||
{{- if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
postgresql-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }}
|
||||
postgresql-username: {{ .Values.postgresql.postgresqlUser | b64enc | quote }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,21 @@
|
||||
{{- if .Values.postgresql.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
{{- with .Values.postgresql.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.postgresql.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.postgresql.service.port }}
|
||||
targetPort: 5432
|
||||
protocol: TCP
|
||||
name: postgresql
|
||||
selector:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,101 @@
|
||||
{{- if .Values.postgresql.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: {{ include "wiki.postgresql.fullname" . }}
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.postgresql.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
|
||||
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgresql
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: {{ .Values.postgresql.postgresqlDatabase | quote }}
|
||||
- name: POSTGRES_USER
|
||||
{{- if .Values.postgresql.existingSecret }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.existingSecret }}
|
||||
key: {{ default "postgresql-username" .Values.postgresql.existingSecretUserKey | quote }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
key: postgresql-username
|
||||
{{- end }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
{{- if .Values.postgresql.existingSecret }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.existingSecret }}
|
||||
key: {{ default "postgresql-password" .Values.postgresql.existingSecretKey | quote }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 6
|
||||
resources:
|
||||
{{- toYaml .Values.postgresql.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: postgresql-data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
subPath: postgresql
|
||||
volumes:
|
||||
- name: postgresql-data
|
||||
{{- if .Values.postgresql.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "wiki.postgresql.fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Loading…
Reference in new issue