Copy in postgresql-rclone chart from separate repo.
Showing
19 changed files
with
826 additions
and
0 deletions
charts/postgresql-rclone/.gitignore
0 → 100644
1 | .*.sw? |
charts/postgresql-rclone/.helmignore
0 → 100644
1 | # Patterns to ignore when building packages. | ||
2 | # This supports shell glob matching, relative path matching, and | ||
3 | # negation (prefixed with !). Only one pattern per line. | ||
4 | .DS_Store | ||
5 | # Common VCS dirs | ||
6 | .git/ | ||
7 | .gitignore | ||
8 | .bzr/ | ||
9 | .bzrignore | ||
10 | .hg/ | ||
11 | .hgignore | ||
12 | .svn/ | ||
13 | # Common backup files | ||
14 | *.swp | ||
15 | *.bak | ||
16 | *.tmp | ||
17 | *.orig | ||
18 | *~ | ||
19 | # Various IDEs | ||
20 | .project | ||
21 | .idea/ | ||
22 | *.tmproj | ||
23 | .vscode/ |
charts/postgresql-rclone/Chart.yaml
0 → 100644
1 | apiVersion: v2 | ||
2 | name: postgresql-rclone | ||
3 | description: A Helm chart for Kubernetes | ||
4 | |||
5 | # A chart can be either an 'application' or a 'library' chart. | ||
6 | # | ||
7 | # Application charts are a collection of templates that can be packaged into versioned archives | ||
8 | # to be deployed. | ||
9 | # | ||
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
11 | # a dependency of application charts to inject those utilities and functions into the rendering | ||
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
13 | type: application | ||
14 | |||
15 | # This is the chart version. This version number should be incremented each time you make changes | ||
16 | # to the chart and its templates, including the app version. | ||
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
18 | version: 0.0.0 | ||
19 | |||
20 | # This is the version number of the application being deployed. This version number should be | ||
21 | # incremented each time you make changes to the application. Versions are not expected to | ||
22 | # follow Semantic Versioning. They should reflect the version the application is using. | ||
23 | # It is recommended to use it with quotes. | ||
24 | appVersion: "0.0.0" |
1 | 1. Get the application URL by running these commands: | ||
2 | {{- if .Values.ingress.enabled }} | ||
3 | {{- range $host := .Values.ingress.hosts }} | ||
4 | {{- range .paths }} | ||
5 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
6 | {{- end }} | ||
7 | {{- end }} | ||
8 | {{- else if contains "NodePort" .Values.service.type }} | ||
9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "postgresql-backup-restore.fullname" . }}) | ||
10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
11 | echo http://$NODE_IP:$NODE_PORT | ||
12 | {{- else if contains "LoadBalancer" .Values.service.type }} | ||
13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
14 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "postgresql-backup-restore.fullname" . }}' | ||
15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "postgresql-backup-restore.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
16 | echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
17 | {{- else if contains "ClusterIP" .Values.service.type }} | ||
18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "postgresql-backup-restore.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
19 | export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
20 | echo "Visit http://127.0.0.1:8080 to use your application" | ||
21 | kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
22 | {{- end }} |
1 | {{/* | ||
2 | Expand the name of the chart. | ||
3 | */}} | ||
4 | {{- define "postgresql-backup-restore.name" -}} | ||
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
6 | {{- end }} | ||
7 | |||
8 | {{/* | ||
9 | Create a default fully qualified app name. | ||
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
11 | If release name contains chart name it will be used as a full name. | ||
12 | */}} | ||
13 | {{- define "postgresql-backup-restore.fullname" -}} | ||
14 | {{- if .Values.fullnameOverride }} | ||
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
16 | {{- else }} | ||
17 | {{- $name := default .Chart.Name .Values.nameOverride }} | ||
18 | {{- if contains $name .Release.Name }} | ||
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
20 | {{- else }} | ||
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
22 | {{- end }} | ||
23 | {{- end }} | ||
24 | {{- end }} | ||
25 | |||
26 | {{/* | ||
27 | Create chart name and version as used by the chart label. | ||
28 | */}} | ||
29 | {{- define "postgresql-backup-restore.chart" -}} | ||
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
31 | {{- end }} | ||
32 | |||
33 | {{/* | ||
34 | Common labels | ||
35 | */}} | ||
36 | {{- define "postgresql-backup-restore.labels" -}} | ||
37 | helm.sh/chart: {{ include "postgresql-backup-restore.chart" . }} | ||
38 | {{ include "postgresql-backup-restore.selectorLabels" . }} | ||
39 | {{- if .Chart.AppVersion }} | ||
40 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
41 | {{- end }} | ||
42 | app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
43 | {{- end }} | ||
44 | |||
45 | {{/* | ||
46 | Selector labels | ||
47 | */}} | ||
48 | {{- define "postgresql-backup-restore.selectorLabels" -}} | ||
49 | app.kubernetes.io/name: {{ include "postgresql-backup-restore.name" . }} | ||
50 | app.kubernetes.io/instance: {{ .Release.Name }} | ||
51 | {{- end }} | ||
52 | |||
53 | {{/* | ||
54 | Create the name of the service account to use | ||
55 | */}} | ||
56 | {{- define "postgresql-backup-restore.serviceAccountName" -}} | ||
57 | {{- if .Values.serviceAccount.create }} | ||
58 | {{- default (include "postgresql-backup-restore.fullname" .) .Values.serviceAccount.name }} | ||
59 | {{- else }} | ||
60 | {{- default "default" .Values.serviceAccount.name }} | ||
61 | {{- end }} | ||
62 | {{- end }} |
1 | apiVersion: apps/v1 | ||
2 | kind: Deployment | ||
3 | metadata: | ||
4 | name: {{ include "postgresql-backup-restore.fullname" . }} | ||
5 | labels: | ||
6 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
7 | spec: | ||
8 | {{- if not .Values.autoscaling.enabled }} | ||
9 | replicas: {{ .Values.replicaCount }} | ||
10 | {{- end }} | ||
11 | selector: | ||
12 | matchLabels: | ||
13 | {{- include "postgresql-backup-restore.selectorLabels" . | nindent 6 }} | ||
14 | template: | ||
15 | metadata: | ||
16 | {{- with .Values.podAnnotations }} | ||
17 | annotations: | ||
18 | {{- toYaml . | nindent 8 }} | ||
19 | {{- end }} | ||
20 | labels: | ||
21 | {{- include "postgresql-backup-restore.selectorLabels" . | nindent 8 }} | ||
22 | spec: | ||
23 | {{- with .Values.imagePullSecrets }} | ||
24 | imagePullSecrets: | ||
25 | {{- toYaml . | nindent 8 }} | ||
26 | {{- end }} | ||
27 | serviceAccountName: {{ include "postgresql-backup-restore.serviceAccountName" . }} | ||
28 | securityContext: | ||
29 | {{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
30 | containers: | ||
31 | - name: {{ .Chart.Name }} | ||
32 | securityContext: | ||
33 | {{- toYaml .Values.securityContext | nindent 12 }} | ||
34 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
35 | imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
36 | ports: | ||
37 | - name: http | ||
38 | containerPort: 80 | ||
39 | protocol: TCP | ||
40 | livenessProbe: | ||
41 | httpGet: | ||
42 | path: / | ||
43 | port: http | ||
44 | readinessProbe: | ||
45 | httpGet: | ||
46 | path: / | ||
47 | port: http | ||
48 | resources: | ||
49 | {{- toYaml .Values.resources | nindent 12 }} | ||
50 | {{- with .Values.nodeSelector }} | ||
51 | nodeSelector: | ||
52 | {{- toYaml . | nindent 8 }} | ||
53 | {{- end }} | ||
54 | {{- with .Values.affinity }} | ||
55 | affinity: | ||
56 | {{- toYaml . | nindent 8 }} | ||
57 | {{- end }} | ||
58 | {{- with .Values.tolerations }} | ||
59 | tolerations: | ||
60 | {{- toYaml . | nindent 8 }} | ||
61 | {{- end }} |
1 | {{- if .Values.autoscaling.enabled }} | ||
2 | apiVersion: autoscaling/v2beta1 | ||
3 | kind: HorizontalPodAutoscaler | ||
4 | metadata: | ||
5 | name: {{ include "postgresql-backup-restore.fullname" . }} | ||
6 | labels: | ||
7 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
8 | spec: | ||
9 | scaleTargetRef: | ||
10 | apiVersion: apps/v1 | ||
11 | kind: Deployment | ||
12 | name: {{ include "postgresql-backup-restore.fullname" . }} | ||
13 | minReplicas: {{ .Values.autoscaling.minReplicas }} | ||
14 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||
15 | metrics: | ||
16 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
17 | - type: Resource | ||
18 | resource: | ||
19 | name: cpu | ||
20 | targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
21 | {{- end }} | ||
22 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
23 | - type: Resource | ||
24 | resource: | ||
25 | name: memory | ||
26 | targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
27 | {{- end }} | ||
28 | {{- end }} |
1 | {{- if .Values.ingress.enabled -}} | ||
2 | {{- $fullName := include "postgresql-backup-restore.fullname" . -}} | ||
3 | {{- $svcPort := .Values.service.port -}} | ||
4 | {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
5 | {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} | ||
6 | {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} | ||
7 | {{- end }} | ||
8 | {{- end }} | ||
9 | {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||
10 | apiVersion: networking.k8s.io/v1 | ||
11 | {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
12 | apiVersion: networking.k8s.io/v1beta1 | ||
13 | {{- else -}} | ||
14 | apiVersion: extensions/v1beta1 | ||
15 | {{- end }} | ||
16 | kind: Ingress | ||
17 | metadata: | ||
18 | name: {{ $fullName }} | ||
19 | labels: | ||
20 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
21 | {{- with .Values.ingress.annotations }} | ||
22 | annotations: | ||
23 | {{- toYaml . | nindent 4 }} | ||
24 | {{- end }} | ||
25 | spec: | ||
26 | {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
27 | ingressClassName: {{ .Values.ingress.className }} | ||
28 | {{- end }} | ||
29 | {{- if .Values.ingress.tls }} | ||
30 | tls: | ||
31 | {{- range .Values.ingress.tls }} | ||
32 | - hosts: | ||
33 | {{- range .hosts }} | ||
34 | - {{ . | quote }} | ||
35 | {{- end }} | ||
36 | secretName: {{ .secretName }} | ||
37 | {{- end }} | ||
38 | {{- end }} | ||
39 | rules: | ||
40 | {{- range .Values.ingress.hosts }} | ||
41 | - host: {{ .host | quote }} | ||
42 | http: | ||
43 | paths: | ||
44 | {{- range .paths }} | ||
45 | - path: {{ .path }} | ||
46 | {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} | ||
47 | pathType: {{ .pathType }} | ||
48 | {{- end }} | ||
49 | backend: | ||
50 | {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||
51 | service: | ||
52 | name: {{ $fullName }} | ||
53 | port: | ||
54 | number: {{ $svcPort }} | ||
55 | {{- else }} | ||
56 | serviceName: {{ $fullName }} | ||
57 | servicePort: {{ $svcPort }} | ||
58 | {{- end }} | ||
59 | {{- end }} | ||
60 | {{- end }} | ||
61 | {{- end }} |
1 | apiVersion: v1 | ||
2 | kind: Service | ||
3 | metadata: | ||
4 | name: {{ include "postgresql-backup-restore.fullname" . }} | ||
5 | labels: | ||
6 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
7 | spec: | ||
8 | type: {{ .Values.service.type }} | ||
9 | ports: | ||
10 | - port: {{ .Values.service.port }} | ||
11 | targetPort: http | ||
12 | protocol: TCP | ||
13 | name: http | ||
14 | selector: | ||
15 | {{- include "postgresql-backup-restore.selectorLabels" . | nindent 4 }} |
1 | {{- if .Values.serviceAccount.create -}} | ||
2 | apiVersion: v1 | ||
3 | kind: ServiceAccount | ||
4 | metadata: | ||
5 | name: {{ include "postgresql-backup-restore.serviceAccountName" . }} | ||
6 | labels: | ||
7 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
8 | {{- with .Values.serviceAccount.annotations }} | ||
9 | annotations: | ||
10 | {{- toYaml . | nindent 4 }} | ||
11 | {{- end }} | ||
12 | {{- end }} |
1 | apiVersion: v1 | ||
2 | kind: Pod | ||
3 | metadata: | ||
4 | name: "{{ include "postgresql-backup-restore.fullname" . }}-test-connection" | ||
5 | labels: | ||
6 | {{- include "postgresql-backup-restore.labels" . | nindent 4 }} | ||
7 | annotations: | ||
8 | "helm.sh/hook": test | ||
9 | spec: | ||
10 | containers: | ||
11 | - name: wget | ||
12 | image: busybox | ||
13 | command: ['wget'] | ||
14 | args: ['{{ include "postgresql-backup-restore.fullname" . }}:{{ .Values.service.port }}'] | ||
15 | restartPolicy: Never |
1 | {{/* | ||
2 | Expand the name of the chart. | ||
3 | */}} | ||
4 | {{- define "postgresql-rclone.name" -}} | ||
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
6 | {{- end }} | ||
7 | |||
8 | {{/* | ||
9 | Create a default fully qualified app name. | ||
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
11 | If release name contains chart name it will be used as a full name. | ||
12 | */}} | ||
13 | {{- define "postgresql-rclone.fullname" -}} | ||
14 | {{- if .Values.fullnameOverride }} | ||
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
16 | {{- else }} | ||
17 | {{- $name := default .Chart.Name .Values.nameOverride }} | ||
18 | {{- if contains $name .Release.Name }} | ||
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
20 | {{- else }} | ||
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
22 | {{- end }} | ||
23 | {{- end }} | ||
24 | {{- end }} | ||
25 | |||
26 | {{/* | ||
27 | Create chart name and version as used by the chart label. | ||
28 | */}} | ||
29 | {{- define "postgresql-rclone.chart" -}} | ||
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
31 | {{- end }} | ||
32 | |||
33 | {{/* | ||
34 | Common labels | ||
35 | */}} | ||
36 | {{- define "postgresql-rclone.labels" -}} | ||
37 | helm.sh/chart: {{ include "postgresql-rclone.chart" . }} | ||
38 | {{ include "postgresql-rclone.selectorLabels" . }} | ||
39 | {{- if .Chart.AppVersion }} | ||
40 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
41 | {{- end }} | ||
42 | app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
43 | {{- end }} | ||
44 | |||
45 | {{/* | ||
46 | Selector labels | ||
47 | */}} | ||
48 | {{- define "postgresql-rclone.selectorLabels" -}} | ||
49 | app.kubernetes.io/name: {{ include "postgresql-rclone.name" . }} | ||
50 | app.kubernetes.io/instance: {{ .Release.Name }} | ||
51 | {{- end }} | ||
52 | |||
53 | {{/* | ||
54 | Create the name of the service account to use | ||
55 | */}} | ||
56 | {{- define "postgresql-rclone.serviceAccountName" -}} | ||
57 | {{- if .Values.serviceAccount.create }} | ||
58 | {{- default (include "postgresql-backup-restore.fullname" .) .Values.serviceAccount.name }} | ||
59 | {{- else }} | ||
60 | {{- default "default" .Values.serviceAccount.name }} | ||
61 | {{- end }} | ||
62 | {{- end }} |
1 | apiVersion: v1 | ||
2 | kind: ConfigMap | ||
3 | metadata: | ||
4 | name: {{ include "postgresql-rclone.fullname" . }}-backup-local | ||
5 | data: | ||
6 | POSTGRES_DB: |- | ||
7 | {{- range $database := .Values.postgresql.databases }} | ||
8 | {{ $database }} | ||
9 | {{- end }}{{ .Values.local.postgresDb | quote }} | ||
10 | BACKUP_KEEP_DAYS: {{ .Values.local.backupKeepDays | quote }} | ||
11 |
1 | --- | ||
2 | apiVersion: v1 | ||
3 | kind: PersistentVolumeClaim | ||
4 | metadata: | ||
5 | name: {{ include "postgresql-rclone.fullname" . }}-backups | ||
6 | spec: | ||
7 | storageClassName: {{ .Values.backup.pvc.storageClassName }} | ||
8 | accessModes: | ||
9 | - ReadWriteOnce | ||
10 | resources: | ||
11 | requests: | ||
12 | storage: {{ .Values.backup.pvc.size }} | ||
13 | --- | ||
14 | apiVersion: batch/v1 | ||
15 | kind: CronJob | ||
16 | metadata: | ||
17 | name: {{ include "postgresql-rclone.fullname" . }}-backup | ||
18 | labels: | ||
19 | {{- include "postgresql-rclone.labels" . | nindent 4 }} | ||
20 | spec: | ||
21 | schedule: {{ .Values.backup.job.schedule }} | ||
22 | startingDeadlineSeconds: {{ .Values.backup.job.startingDeadlineSeconds }} | ||
23 | concurrencyPolicy: Forbid | ||
24 | successfulJobsHistoryLimit: {{ .Values.backup.job.successfulJobsHistoryLimit }} | ||
25 | failedJobsHistoryLimit: {{ .Values.backup.job.failedJobsHistoryLimit }} | ||
26 | jobTemplate: | ||
27 | spec: | ||
28 | template: | ||
29 | spec: | ||
30 | restartPolicy: OnFailure | ||
31 | imagePullSecrets: | ||
32 | {{- toYaml .Values.imagePullSecrets | nindent 12 }} | ||
33 | volumes: | ||
34 | - name: backups | ||
35 | persistentVolumeClaim: | ||
36 | claimName: {{ include "postgresql-rclone.fullname" . }}-backups | ||
37 | - name: postgresql-auth | ||
38 | secret: | ||
39 | secretName: {{ include "postgresql-rclone.fullname" . }}-auth | ||
40 | - name: local-config | ||
41 | configMap: | ||
42 | name: {{ include "postgresql-rclone.fullname" . }}-backup-local | ||
43 | {{- if .Values.rclone.enabled }} | ||
44 | - name: rclone-auth | ||
45 | secret: | ||
46 | secretName: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
47 | - name: rclone-config | ||
48 | configMap: | ||
49 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
50 | {{- end }} | ||
51 | initContainers: | ||
52 | - name: dump-databases | ||
53 | image: "{{ .Values.local.image.repository }}:{{ .Values.local.image.tag }}" | ||
54 | imagePullPolicy: {{ .Values.local.image.pullPolicy }} | ||
55 | volumeMounts: | ||
56 | - name: backups | ||
57 | mountPath: /backups | ||
58 | - name: local-config | ||
59 | mountPath: /config | ||
60 | - name: postgresql-auth | ||
61 | mountPath: /secret | ||
62 | env: | ||
63 | - name: BACKUP_KEEP_DAYS | ||
64 | valueFrom: | ||
65 | configMapKeyRef: | ||
66 | name: {{ include "postgresql-rclone.fullname" . }}-backup-local | ||
67 | key: BACKUP_KEEP_DAYS | ||
68 | - name: BACKUP_DIR | ||
69 | value: /backups | ||
70 | - name: POSTGRES_HOST | ||
71 | value: {{ .Values.postgresql.host }} | ||
72 | - name: POSTGRES_DB_FILE | ||
73 | value: /config/POSTGRES_DB | ||
74 | - name: POSTGRES_USER_FILE | ||
75 | value: /secret/POSTGRES_USER | ||
76 | - name: POSTGRES_PASSWORD_FILE | ||
77 | value: /secret/POSTGRES_PASSWORD | ||
78 | command: ["/backup.sh"] | ||
79 | {{- if .Values.rclone.enabled }} | ||
80 | - name: rclone | ||
81 | image: "{{ .Values.rclone.image.repository }}:{{ .Values.rclone.image.tag }}" | ||
82 | imagePullPolicy: {{ .Values.rclone.image.pullPolicy }} | ||
83 | volumeMounts: | ||
84 | - name: backups | ||
85 | mountPath: /backups | ||
86 | - name: rclone-config | ||
87 | mountPath: /config | ||
88 | - name: rclone-auth | ||
89 | mountPath: /secret | ||
90 | envFrom: | ||
91 | - configMapRef: | ||
92 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
93 | - secretRef: | ||
94 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
95 | {{- if .Values.rclone.crypt.enabled }} | ||
96 | env: | ||
97 | - name: RCLONE_CRYPT_REMOTE | ||
98 | value: ":s3:$(S3_BUCKET)/$(S3_PREFIX)/" | ||
99 | {{- end }} | ||
100 | {{- if .Values.rclone.crypt.enabled }} | ||
101 | args: ["copy", "/backups/", ":crypt:"] | ||
102 | {{- else }} | ||
103 | args: ["copy", "/backups/", ":s3:$(S3_BUCKET)/$(S3_PREFIX)/"] | ||
104 | {{- end }} | ||
105 | {{- end }} | ||
106 | containers: | ||
107 | - name: show-dumps | ||
108 | image: bash | ||
109 | volumeMounts: | ||
110 | - name: backups | ||
111 | mountPath: /backups | ||
112 | command: ["ls"] | ||
113 | args: ["-alR", "/backups"] | ||
114 |
1 | --- | ||
2 | apiVersion: v1 | ||
3 | kind: PersistentVolumeClaim | ||
4 | metadata: | ||
5 | name: {{ include "postgresql-rclone.fullname" . }}-restores | ||
6 | spec: | ||
7 | storageClassName: {{ .Values.restore.pvc.storageClassName }} | ||
8 | accessModes: | ||
9 | - ReadWriteOnce | ||
10 | resources: | ||
11 | requests: | ||
12 | storage: {{ .Values.restore.pvc.size }} | ||
13 | --- | ||
14 | apiVersion: batch/v1 | ||
15 | kind: Job | ||
16 | metadata: | ||
17 | name: {{ include "postgresql-rclone.fullname" . }}-restore | ||
18 | labels: | ||
19 | {{- include "postgresql-rclone.labels" . | nindent 4 }} | ||
20 | spec: | ||
21 | ttlSecondsAfterFinished: {{ .Values.restore.job.ttlSecondsAfterFinished }} | ||
22 | template: | ||
23 | spec: | ||
24 | restartPolicy: OnFailure | ||
25 | imagePullSecrets: | ||
26 | {{- toYaml .Values.imagePullSecrets | nindent 12 }} | ||
27 | volumes: | ||
28 | - name: restores | ||
29 | persistentVolumeClaim: | ||
30 | claimName: {{ include "postgresql-rclone.fullname" . }}-restores | ||
31 | {{- if .Values.rclone.enabled }} | ||
32 | - name: rclone-auth | ||
33 | secret: | ||
34 | secretName: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
35 | - name: rclone-config | ||
36 | configMap: | ||
37 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
38 | {{- end }} | ||
39 | initContainers: | ||
40 | {{- if .Values.rclone.enabled }} | ||
41 | - name: rclone | ||
42 | image: "{{ .Values.rclone.image.repository }}:{{ .Values.rclone.image.tag }}" | ||
43 | imagePullPolicy: {{ .Values.rclone.image.pullPolicy }} | ||
44 | volumeMounts: | ||
45 | - name: restores | ||
46 | mountPath: /restores | ||
47 | - name: rclone-config | ||
48 | mountPath: /config | ||
49 | - name: rclone-auth | ||
50 | mountPath: /secret | ||
51 | envFrom: | ||
52 | - configMapRef: | ||
53 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
54 | - secretRef: | ||
55 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
56 | {{- if .Values.rclone.crypt.enabled }} | ||
57 | env: | ||
58 | - name: RCLONE_CRYPT_REMOTE | ||
59 | value: ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/" | ||
60 | {{- end }} | ||
61 | {{- if .Values.rclone.crypt.enabled }} | ||
62 | args: ["copy", ":crypt:", "/restores/"] | ||
63 | {{- else }} | ||
64 | args: ["-v", "copy", ":s3:$(S3_BUCKET)/$(S3_PREFIX)/last/", "/restores/.work/"] | ||
65 | {{- end }} | ||
66 | {{- end }} | ||
67 | - name: link-latest | ||
68 | image: "{{ .Values.bash.image.repository }}:{{ .Values.bash.image.tag }}" | ||
69 | imagePullPolicy: {{ .Values.bash.image.pullPolicy }} | ||
70 | volumeMounts: | ||
71 | - name: restores | ||
72 | mountPath: /restores | ||
73 | command: | ||
74 | - bash | ||
75 | - -cx | ||
76 | - |- | ||
77 | find /restores/.work -maxdepth 1 -mindepth 1 -name '*.sql.gz' | \ | ||
78 | sort | \ | ||
79 | awk '{split($1, a, /-([^-]*)-([^-]*)$/)} !uniq[a[1] a[2] a[3]]++' | \ | ||
80 | while read file; do \ | ||
81 | ln -f "$file" "/restores/" | ||
82 | done | ||
83 | - name: show-restores | ||
84 | image: "{{ .Values.bash.image.repository }}:{{ .Values.bash.image.tag }}" | ||
85 | imagePullPolicy: {{ .Values.bash.image.pullPolicy }} | ||
86 | volumeMounts: | ||
87 | - name: restores | ||
88 | mountPath: /restores | ||
89 | command: ["ls"] | ||
90 | args: ["-alR", "/restores"] | ||
91 | |||
92 | containers: | ||
93 | - name: ready | ||
94 | image: "{{ .Values.bash.image.repository }}:{{ .Values.bash.image.tag }}" | ||
95 | imagePullPolicy: {{ .Values.bash.image.pullPolicy }} | ||
96 | volumeMounts: | ||
97 | - name: restores | ||
98 | mountPath: /restores | ||
99 | command: | ||
100 | - bash | ||
101 | - -cx | ||
102 | - |- | ||
103 | touch /restores/.restored | ||
104 | |||
105 |
1 | {{- if .Values.rclone.enabled }} | ||
2 | apiVersion: v1 | ||
3 | kind: ConfigMap | ||
4 | metadata: | ||
5 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
6 | data: | ||
7 | {{ .Values.rclone.config | toYaml | nindent 2 }} | ||
8 | {{- end }} | ||
9 | --- | ||
10 | {{- if .Values.rclone.enabled }} | ||
11 | apiVersion: v1 | ||
12 | kind: Secret | ||
13 | metadata: | ||
14 | name: {{ include "postgresql-rclone.fullname" . }}-rclone | ||
15 | stringData: | ||
16 | {{ .Values.rclone.secret | toYaml | nindent 2 }} | ||
17 | {{- end }} | ||
18 |
charts/postgresql-rclone/values.yaml
0 → 100644
1 | # Default values for postgresql-backup-restore. | ||
2 | # This is a YAML-formatted file. | ||
3 | # Declare variables to be passed into your templates. | ||
4 | |||
5 | bash: | ||
6 | image: | ||
7 | repository: bash | ||
8 | tag: latest | ||
9 | pullPolicy: IfNotPresent | ||
10 | |||
11 | postgresql: | ||
12 | host: postgresql.postgresql.svc.cluster.local | ||
13 | auth: | ||
14 | postgresqlUser: postgres | ||
15 | postgresqlPassword: foobar | ||
16 | databases: | ||
17 | - postgres | ||
18 | - moqui | ||
19 | - keycloak | ||
20 | |||
21 | local: | ||
22 | image: | ||
23 | repository: prodrigestivill/postgres-backup-local | ||
24 | tag: "latest" | ||
25 | pullPolicy: IfNotPresent | ||
26 | backupKeepDays: 288 | ||
27 | |||
28 | backup: | ||
29 | job: | ||
30 | schedule: "13 3 * * *" | ||
31 | startingDeadlineSeconds: 3600 | ||
32 | successfulJobsHistoryLimit: 10 | ||
33 | failedJobsHistoryLimit: 10 | ||
34 | pvc: | ||
35 | storageClassName: "" | ||
36 | size: 10Gi | ||
37 | |||
38 | restore: | ||
39 | job: | ||
40 | ttlSecondsAfterFinished: 60 | ||
41 | pvc: | ||
42 | storageClassName: "" | ||
43 | size: 10Gi | ||
44 | |||
45 | rclone: | ||
46 | enabled: false | ||
47 | image: | ||
48 | repository: rclone/rclone | ||
49 | tag: latest | ||
50 | pullPolicy: IfNotPresent | ||
51 | crypt: | ||
52 | enabled: false | ||
53 | password: "" | ||
54 | password2: "" | ||
55 |
charts/postgresql-rclone/values.yaml.save
0 → 100644
1 | # Default values for postgresql-backup-restore. | ||
2 | # This is a YAML-formatted file. | ||
3 | # Declare variables to be passed into your templates. | ||
4 | |||
5 | s3: | ||
6 | bucket: "" | ||
7 | prefix: "" | ||
8 | region: "us-east-1" | ||
9 | provider: "aws" | ||
10 | accessKey: "" | ||
11 | secretKey: "" | ||
12 | |||
13 | postgresql: | ||
14 | host: postgresql.postgresql.svc.cluster.local | ||
15 | auth: | ||
16 | postgresqlUser: postgres | ||
17 | postgresqlPassword: foobar | ||
18 | databases: | ||
19 | - postgres | ||
20 | - moqui | ||
21 | - keycloak | ||
22 | |||
23 | local: | ||
24 | image: | ||
25 | repository: prodrigestivill/postgres-backup-local | ||
26 | tag: "latest" | ||
27 | pullPolicy: IfNotPresent | ||
28 | backupKeepDays: 288 | ||
29 | |||
30 | backup: | ||
31 | schedule: "13 3 * * *" | ||
32 | pvc: | ||
33 | storageClassName: "" | ||
34 | size: 10Gi | ||
35 | |||
36 | rclone: | ||
37 | enabled: false | ||
38 | image: | ||
39 | repository: registry.alyvr.local:5000/alyvr/alyvr-rclone | ||
40 | tag: latest | ||
41 | pullPolicy: IfNotPresent | ||
42 | crypt: | ||
43 | enabled: false | ||
44 | password: "" | ||
45 | password2: "" | ||
46 | |||
47 | --- | ||
48 | restore: | ||
49 | enabled: true | ||
50 | |||
51 | --- | ||
52 | replicaCount: 1 | ||
53 | |||
54 | image: | ||
55 | repository: nginx | ||
56 | pullPolicy: IfNotPresent | ||
57 | # Overrides the image tag whose default is the chart appVersion. | ||
58 | tag: "" | ||
59 | |||
60 | imagePullSecrets: [] | ||
61 | nameOverride: "" | ||
62 | fullnameOverride: "" | ||
63 | |||
64 | serviceAccount: | ||
65 | # Specifies whether a service account should be created | ||
66 | create: true | ||
67 | # Annotations to add to the service account | ||
68 | annotations: {} | ||
69 | # The name of the service account to use. | ||
70 | # If not set and create is true, a name is generated using the fullname template | ||
71 | name: "" | ||
72 | |||
73 | podAnnotations: {} | ||
74 | |||
75 | podSecurityContext: {} | ||
76 | # fsGroup: 2000 | ||
77 | |||
78 | securityContext: {} | ||
79 | # capabilities: | ||
80 | # drop: | ||
81 | # - ALL | ||
82 | # readOnlyRootFilesystem: true | ||
83 | # runAsNonRoot: true | ||
84 | # runAsUser: 1000 | ||
85 | |||
86 | service: | ||
87 | type: ClusterIP | ||
88 | port: 80 | ||
89 | |||
90 | ingress: | ||
91 | enabled: false | ||
92 | className: "" | ||
93 | annotations: {} | ||
94 | # kubernetes.io/ingress.class: nginx | ||
95 | # kubernetes.io/tls-acme: "true" | ||
96 | hosts: | ||
97 | - host: chart-example.local | ||
98 | paths: | ||
99 | - path: / | ||
100 | pathType: ImplementationSpecific | ||
101 | tls: [] | ||
102 | # - secretName: chart-example-tls | ||
103 | # hosts: | ||
104 | # - chart-example.local | ||
105 | |||
106 | resources: {} | ||
107 | # We usually recommend not to specify default resources and to leave this as a conscious | ||
108 | # choice for the user. This also increases chances charts run on environments with little | ||
109 | # resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
110 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
111 | # limits: | ||
112 | # cpu: 100m | ||
113 | # memory: 128Mi | ||
114 | # requests: | ||
115 | # cpu: 100m | ||
116 | # memory: 128Mi | ||
117 | |||
118 | autoscaling: | ||
119 | enabled: false | ||
120 | minReplicas: 1 | ||
121 | maxReplicas: 100 | ||
122 | targetCPUUtilizationPercentage: 80 | ||
123 | # targetMemoryUtilizationPercentage: 80 | ||
124 | |||
125 | nodeSelector: {} | ||
126 | |||
127 | tolerations: [] | ||
128 | |||
129 | affinity: {} |
-
Please register or sign in to post a comment