Commit 2733aab5 authored by Waqar Ahmed's avatar Waqar Ahmed

Update postgres deployment to use library chart

parent 7e1c9080
apiVersion: apps/v1 {{ $values := . }}
{{ $_ := set $values "nameSuffix" "postgres" }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ template "nextcloud.fullname" . }}-postgres name: {{ template "common.names.fullname" $values }}
labels: labels: {{ include "common.labels.selectorLabels" $values | nindent 4 }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
{{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: database
spec: spec:
replicas: 1 replicas: 1
strategy: strategy:
type: {{ .Values.nextcloud.strategy }} type: {{ .Values.nextcloud.strategy }}
selector: selector:
matchLabels: matchLabels: {{- include "common.labels.selectorLabels" $values | nindent 6 }}
{{- include "nextcloud.postgres.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: database
template: template:
metadata: metadata:
labels: labels: {{- include "common.labels.selectorLabels" $values | nindent 8 }}
{{- include "nextcloud.postgres.selectorLabels" . | nindent 8 }} annotations: {{- include "common.annotations" $values | nindent 8 }}
app.kubernetes.io/component: database
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec: spec:
containers: containers:
- name: {{ .Chart.Name }}-postgres - name: {{ .Chart.Name }}-postgres
image: {{ template "postgres.imageName" . }} image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
env: env:
- name: POSTGRES_USER {{ $envList := list }}
valueFrom: {{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
secretKeyRef: {{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
name: db-details {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
key: db-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-details
key: db-password
volumeMounts: volumeMounts:
- name: postgres-data - name: postgres-data
mountPath: /var/lib/postgresql/data mountPath: /var/lib/postgresql/data
...@@ -48,17 +35,7 @@ spec: ...@@ -48,17 +35,7 @@ spec:
containerPort: 5432 containerPort: 5432
protocol: TCP protocol: TCP
volumes: volumes:
- name: postgres-data {{ $vols := list }}
{{- if ne (include "configuredPostgresHostPath" .) "" }} {{ $vols = mustAppend $vols (dict "name" "postgres-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresDataVolume | default dict).datasetName ) }}
hostPath: {{ $vols = mustAppend $vols (dict "name" "postgres-backup" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresBackupVolume | default dict).datasetName ) }}
path: {{ template "configuredPostgresHostPath" . }} {{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8 }}
{{- else }}
emptyDir: {}
{{- end }}
- name: postgres-backup
{{- if ne (include "configuredBackupPostgresHostPath" .) "" }}
hostPath:
path: {{ template "configuredBackupPostgresHostPath" . }}
{{- else }}
emptyDir: {}
{{- end }}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment