From c943294e5d5cef180cc58e7903f032ddcceebc95 Mon Sep 17 00:00:00 2001 From: ljupcovangelski Date: Thu, 26 Jan 2023 21:17:50 +0100 Subject: [PATCH] [#4020] Add PostgreSQL helm chart --- .../charts/tools/charts/postgresql/Chart.yaml | 5 ++ .../charts/postgresql/templates/secret.yaml | 9 ++++ .../charts/postgresql/templates/service.yaml | 15 ++++++ .../postgresql/templates/statefulset.yaml | 49 +++++++++++++++++++ .../tools/charts/postgresql/values.yaml | 4 ++ 5 files changed, 82 insertions(+) create mode 100644 infrastructure/helm-chart/charts/tools/charts/postgresql/Chart.yaml create mode 100644 infrastructure/helm-chart/charts/tools/charts/postgresql/templates/secret.yaml create mode 100644 infrastructure/helm-chart/charts/tools/charts/postgresql/templates/service.yaml create mode 100644 infrastructure/helm-chart/charts/tools/charts/postgresql/templates/statefulset.yaml create mode 100644 infrastructure/helm-chart/charts/tools/charts/postgresql/values.yaml diff --git a/infrastructure/helm-chart/charts/tools/charts/postgresql/Chart.yaml b/infrastructure/helm-chart/charts/tools/charts/postgresql/Chart.yaml new file mode 100644 index 0000000000..823c96c1b2 --- /dev/null +++ b/infrastructure/helm-chart/charts/tools/charts/postgresql/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +appVersion: "1.0" +description: PostgreSQL Server +name: postgresql +version: 15.1 diff --git a/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/secret.yaml b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/secret.yaml new file mode 100644 index 0000000000..b3eaeb9012 --- /dev/null +++ b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: postgres + labels: + app: postgres +type: Opaque +data: + postgres-password: {{ default (randAlphaNum 32) | b64enc | quote }} diff --git a/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/service.yaml b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/service.yaml new file mode 100644 index 0000000000..0f8805f575 --- /dev/null +++ b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: postgres + labels: + app: postgres +spec: + type: ClusterIP + clusterIP: None + ports: + - name: postgres + port: {{ .Values.port }} + targetPort: {{ .Values.port }} + selector: + app: postgres diff --git a/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/statefulset.yaml b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/statefulset.yaml new file mode 100644 index 0000000000..db74c96041 --- /dev/null +++ b/infrastructure/helm-chart/charts/tools/charts/postgresql/templates/statefulset.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres + labels: + app: postgres +spec: + replicas: 1 + selector: + matchLabels: + app: postgres + serviceName: postgres + template: + metadata: + labels: + app: postgres + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: postgres + image: "postgres:{{ .Values.version }}" + imagePullPolicy: "IfNotPresent" + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgres + key: postgres-password + ports: + - name: postgres + containerPort: {{ .Values.port }} + livenessProbe: + tcpSocket: + port: {{ .Values.port }} + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 5 + resources: {{ .Values.resources }} + volumeClaimTemplates: + - metadata: + name: postgres-data + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: {{ .Values.storage }} diff --git a/infrastructure/helm-chart/charts/tools/charts/postgresql/values.yaml b/infrastructure/helm-chart/charts/tools/charts/postgresql/values.yaml new file mode 100644 index 0000000000..d03860f654 --- /dev/null +++ b/infrastructure/helm-chart/charts/tools/charts/postgresql/values.yaml @@ -0,0 +1,4 @@ +version: 15.1 +port: 5432 +storage: "5Gi" +resources: