first commit
This commit is contained in:
23
pg_backup/.helmignore
Normal file
23
pg_backup/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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/
|
||||
24
pg_backup/Chart.yaml
Normal file
24
pg_backup/Chart.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: v2
|
||||
name: pg_backup
|
||||
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: "0.0.1"
|
||||
68
pg_backup/templates/cron.yaml
Normal file
68
pg_backup/templates/cron.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: pg-backup
|
||||
spec:
|
||||
schedule: "@daily"
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: pg-backup
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||
env:
|
||||
- name: POSTGRES_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pg-config
|
||||
key: postgres_host
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pg-config
|
||||
key: postgres_user
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: pg-secret
|
||||
key: postgres_password
|
||||
- name: POSTGRES_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pg-config
|
||||
key: postgres_port
|
||||
- name: AWS_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: restic-config
|
||||
key: aws_access_key_id
|
||||
- name: AWS_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: restic-secret
|
||||
key: aws_secret_access_key
|
||||
- name: RESTIC_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: restic-secret
|
||||
key: restic_password
|
||||
- name: RESTIC_REPOSITORY
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: restic-config
|
||||
key: restic_repository
|
||||
- name: RESTIC_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: restic-config
|
||||
key: restic_host
|
||||
resources:
|
||||
{{- .Values.resources | toYaml | nindent 14 }}
|
||||
restartPolicy: OnFailure
|
||||
18
pg_backup/templates/pg-conf.yaml
Normal file
18
pg_backup/templates/pg-conf.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: pg-config
|
||||
data:
|
||||
postgres_host: {{ .Values.postgres_host | toString | quote }}
|
||||
postgres_port: {{ .Values.postgres_port | toString | quote }}
|
||||
postgres_user: {{ .Values.postgres_user | toString | quote }}
|
||||
postgres_ssl_mode: {{ .Values.postgres_ssl_mode | toString | quote }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: pg-secret
|
||||
type: Opaque
|
||||
data:
|
||||
postgres_password: {{ .Values.postgres_password | b64enc }}
|
||||
19
pg_backup/templates/restic-conf.yaml
Normal file
19
pg_backup/templates/restic-conf.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: restic-config
|
||||
data:
|
||||
aws_access_key_id: {{ .Values.aws_access_key_id }}
|
||||
restic_repository: {{ .Values.restic_repository }}
|
||||
restic_host: {{ .Values.restic_host }}
|
||||
restic_tag: {{ .Values.restic_tag }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: restic-secret
|
||||
type: Opaque
|
||||
data:
|
||||
aws_secret_access_key: {{ .Values.aws_secret_access_key | b64enc }}
|
||||
restic_password: {{ .Values.restic_password | b64enc }}
|
||||
29
pg_backup/values.yaml
Normal file
29
pg_backup/values.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
image:
|
||||
repository: cr.yandex/crp6ch9mi9nt1cu5mnif/pg_backup
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "0.0.7"
|
||||
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "200m"
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: "750m"
|
||||
memory: "600Mi"
|
||||
|
||||
postgres_host: ""
|
||||
postgres_port: "5432"
|
||||
postgres_user: postgres
|
||||
postgres_password: ""
|
||||
postgres_ssl_mode: require
|
||||
|
||||
aws_access_key_id: ""
|
||||
aws_secret_access_key: ""
|
||||
|
||||
restic_password: ""
|
||||
restic_repository: ""
|
||||
restic_host: weasel
|
||||
restic_tag: pg_basebackup
|
||||
Reference in New Issue
Block a user