Skip to content
Snippets Groups Projects
Commit 6b35eeed authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

add postgres-backups

parent 96e9bc4c
Branches
No related tags found
No related merge requests found
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v2
name: cronjobs
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
defaultNamespace: database
targetCustomizations:
- name: jupyterjsc-staging
clusterSelector:
matchLabels:
name: jupyterjsc-staging
helm:
values:
enabled: true
persistence:
path: /nfs/database-backups/jupyterjsc-staging
\ No newline at end of file
{{/*
Expand the name of the chart.
*/}}
{{- define "cronjobs.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cronjobs.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cronjobs.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create namespace variable
*/}}
{{- define "cronjobs.namespace" -}}
{{- default .Release.Namespace -}}
{{- end -}}
{{/*
Expand the name of the chart.
*/}}
{{- define "cronjobs.releasename" -}}
{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
\ No newline at end of file
{{- $chart_name := .Chart.Name }}
{{- $chart_version := .Chart.Version | replace "+" "_" }}
{{- $release_name := .Release.Name }}
{{- if .Values.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: "{{ $release_name }}-{{ .Values.name }}"
namespace: {{ .Values.namespace }}
labels:
chart: "{{ $chart_name }}-{{ $chart_version }}"
spec:
concurrencyPolicy: Forbid
failedJobsHistoryLimit: {{ default 1 .Values.failedJobsHistoryLimit }}
jobTemplate:
spec:
backoffLimit: {{ default 0 .Values.backoffLimit }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- . | toYaml | nindent 12 }}
{{- end }}
labels:
app: {{ $release_name }}
cron: {{ .Values.name }}
spec:
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.imagePullPolicy }}
name: {{ .Values.name }}
env:
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.pgpassword.name }}
key: {{ .Values.pgpassword.key }}
command: ["/bin/sh"]
args:
- -c
- >-
pg_dumpall -h postgresql -U postgres -f /mnt/persistent/$(date +"%Y%m%d_%H%M%S").alldatabases.dump ;
resources:
requests:
cpu: 50m
memory: 256Mi
volumeMounts:
- name: persistent
mountPath: /mnt/persistent
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 12 }}
{{- end }}
restartPolicy: Never
volumes:
- name: persistent
nfs:
path: {{ .Values.persistence.path }}
server: {{ .Values.persistence.server }}
schedule: {{ .Values.schedule | quote }}
successfulJobsHistoryLimit: {{ default 1 .Values.successfulJobsHistoryLimit }}
{{- end }}
\ No newline at end of file
nameOverride: ""
fullnameOverride: ""
enabled: true
name: daily
namespace: database
image:
repository: postgres
tag: 16.0-alpine
imagePullPolicy: Always
schedule: "0 2 * * *"
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 1
backoffLimit: 0
resources:
requests:
cpu: 50m
memory: 256Mi
pgpassword:
name: postgresql-auth
key: postgres-password
podAnnotations: {}
nodeSelector: {}
affinity: {}
tolerations: {}
persistence:
path: /nfs/database-backups/placeholder
server: 10.0.1.124
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment