Remove Postgres-Operator from common-chart (for now) (#332)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
kubeVersion: ">=1.16.0-0"
|
kubeVersion: ">=1.16.0-0"
|
||||||
name: common
|
name: common
|
||||||
version: 2.1.4
|
version: 2.2.0
|
||||||
# upstream_version:
|
# upstream_version:
|
||||||
appVersion: none
|
appVersion: none
|
||||||
description: Function library for TrueCharts
|
description: Function library for TrueCharts
|
||||||
|
|||||||
@@ -42,6 +42,5 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
|||||||
{{ include "common.ingress" . | nindent 0 }}
|
{{ include "common.ingress" . | nindent 0 }}
|
||||||
{{ include "common.resources.portal" . | nindent 0 }}
|
{{ include "common.resources.portal" . | nindent 0 }}
|
||||||
{{ include "common.storage.permissions" . | nindent 0 }}
|
{{ include "common.storage.permissions" . | nindent 0 }}
|
||||||
{{ include "common.resources.postgres" . | nindent 0 }}
|
|
||||||
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
{{- define "common.resources.postgres" -}}
|
|
||||||
{{- if .Values.enableDB -}}
|
|
||||||
|
|
||||||
{{- $instanceName := ( printf "%v%v" ( include "common.names.fullname" .|lower ) "-postgres" ) -}}
|
|
||||||
{{- $superuser := ( default (keys .Values.postgresql.users | first ) .Values.dbsuperuser.user ) -}}
|
|
||||||
{{- $secretName := ( printf "%s.%s.credentials.postgresql.acid.zalan.do" ( $superuser ) ( $instanceName ) ) -}}
|
|
||||||
{{- $backupPVCSubpath := ( default (printf "%s/%s" .Values.dbBackup.subpathPrefix (include "common.names.fullname" .)) .Values.dbBackup.subpath ) -}}
|
|
||||||
{{- $storageClass := ( printf "%v-%v" "ix-storage-class" .Release.Name ) -}}
|
|
||||||
|
|
||||||
{{- if not .Values.postgresql.teamId -}}
|
|
||||||
{{- $_ := set .Values.postgresql "teamId" (include "common.names.fullname" .) }}
|
|
||||||
{{- end}}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
{{- include "common.labels" . | nindent 4 }}
|
|
||||||
application: spilo
|
|
||||||
team: {{ include "common.names.fullname" . }}
|
|
||||||
"helm.sh/hook": "pre-install"
|
|
||||||
"helm.sh/hook-delete-policy": "pre-delete"
|
|
||||||
name: {{ $secretName }}
|
|
||||||
stringData:
|
|
||||||
username: {{ $superuser }}
|
|
||||||
password: {{ default (randAlphaNum 50) .Values.dbsuperuser.password }}
|
|
||||||
type: Opaque
|
|
||||||
|
|
||||||
---
|
|
||||||
{{/*
|
|
||||||
CRD that requiests postgres-operator to spin-up a postgresql instance (or multiple in HA)
|
|
||||||
*/}}
|
|
||||||
apiVersion: "acid.zalan.do/v1"
|
|
||||||
kind: postgresql
|
|
||||||
metadata:
|
|
||||||
name: {{ $instanceName }}
|
|
||||||
labels:
|
|
||||||
{{- include "common.labels" . | nindent 4 }}
|
|
||||||
spec:
|
|
||||||
volume:
|
|
||||||
size: "100Gi"
|
|
||||||
storageClass: {{ $storageClass | quote }}
|
|
||||||
{{- .Values.postgresql | toYaml | nindent 2 }}
|
|
||||||
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Special magic cronjob that does a extra backup in addition to postgres-operator to a PVC of your choice.
|
|
||||||
*/}}
|
|
||||||
{{- if .Values.dbBackup.existingClaim -}}
|
|
||||||
---
|
|
||||||
# ------------------- CronJob ------------------- #
|
|
||||||
apiVersion: batch/v1beta1
|
|
||||||
kind: CronJob
|
|
||||||
metadata:
|
|
||||||
name: {{ include "common.names.fullname" . }}-backup
|
|
||||||
labels:
|
|
||||||
{{- include "common.labels" . | nindent 4 }}
|
|
||||||
spec:
|
|
||||||
schedule: {{ .Values.dbBackup.schedule | quote }}
|
|
||||||
concurrencyPolicy: Replace
|
|
||||||
jobTemplate:
|
|
||||||
spec:
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
name: {{ include "common.names.fullname" . }}-backup
|
|
||||||
labels:
|
|
||||||
{{- include "common.labels.selectorLabels" . | nindent 12 }}
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: backup
|
|
||||||
image: "{{ .Values.dbBackup.image.repository}}:{{ .Values.dbBackup.image.tag}}"
|
|
||||||
imagePullPolicy: {{ .Values.dbBackup.image.imagePullPolicy}}
|
|
||||||
command:
|
|
||||||
- /bin/sh
|
|
||||||
- -ce
|
|
||||||
- |
|
|
||||||
echo "$(date) - Start dump"
|
|
||||||
pg_dumpall > /backup/new && mv /backup/new /backup/backup
|
|
||||||
echo "$(date) - End dump"
|
|
||||||
ls -lh /backup
|
|
||||||
resources:
|
|
||||||
{{- .Values.dbBackup.resources | toYaml | nindent 16 }}
|
|
||||||
env:
|
|
||||||
- name: PGHOST
|
|
||||||
value: {{ $instanceName }}
|
|
||||||
- name: PGUSER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ $secretName }}
|
|
||||||
key: username
|
|
||||||
- name: PGPASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ $secretName }}
|
|
||||||
key: password
|
|
||||||
volumeMounts:
|
|
||||||
- mountPath: /backup
|
|
||||||
name: backup-volume
|
|
||||||
subPath: {{ $backupPVCSubpath }}
|
|
||||||
restartPolicy: OnFailure
|
|
||||||
volumes:
|
|
||||||
- name: backup-volume
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: {{ .Values.dbBackup.existingClaim }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -336,58 +336,3 @@ fixMountPermissions: true
|
|||||||
# hostPathEnabled: false
|
# hostPathEnabled: false
|
||||||
# hostPath: ""
|
# hostPath: ""
|
||||||
# setPermissions: true
|
# setPermissions: true
|
||||||
|
|
||||||
|
|
||||||
#### DB Values
|
|
||||||
|
|
||||||
# See all operator values at https://github.com/zalando/postgres-operator/blob/master/docs/reference/cluster_manifest.md
|
|
||||||
postgresql:
|
|
||||||
# -- team Id for the DB cluster
|
|
||||||
teamId:
|
|
||||||
# -- Number of replicas
|
|
||||||
# It will be automatically set with the number of replicaNodes so any values set here are ignored.
|
|
||||||
numberOfInstances: 1
|
|
||||||
# -- DB users to create (see operator)
|
|
||||||
users:
|
|
||||||
postgres:
|
|
||||||
- superuser
|
|
||||||
- createdb
|
|
||||||
|
|
||||||
# -- databases to create and their user
|
|
||||||
databases:
|
|
||||||
postgres: postgres
|
|
||||||
postgresql:
|
|
||||||
# -- Postgres version to deploy - see which versions are supported by the operator
|
|
||||||
version: "13"
|
|
||||||
|
|
||||||
dbsuperuser:
|
|
||||||
# -- Superuser user used for cronjobs
|
|
||||||
# @default -- first user in postgresql.users
|
|
||||||
user:
|
|
||||||
# -- Superuser password
|
|
||||||
# @default -- randomly generated on first install of the chart
|
|
||||||
password:
|
|
||||||
# -- Superuser k8s secret name. It must match the patter used by the operator
|
|
||||||
# @default -- <user>.<db name>.credentials.postgresql.acid.zalan.do
|
|
||||||
secret:
|
|
||||||
|
|
||||||
|
|
||||||
dbBackup:
|
|
||||||
# Enable backups to a PVC
|
|
||||||
# defaults to our default buildinbackup PVC, but can be overridden in the future
|
|
||||||
existingClaim:
|
|
||||||
# -- Backup schedule for postgres dumps
|
|
||||||
schedule: "@daily"
|
|
||||||
# -- Persistent volume claim subpath prefix for the backups
|
|
||||||
subpathPrefix: "backup/db"
|
|
||||||
# -- Persistent volume claim subpath for the backups
|
|
||||||
# @default: <subpathPrefix/<release-name>
|
|
||||||
subpath:
|
|
||||||
image:
|
|
||||||
repository: postgres
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: latest
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: "10Mi"
|
|
||||||
cpu: "5m"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user