Skip to content

Commit 4996a02

Browse files
Jonathan S. Katzjkatz
authored andcommitted
Create Helm template for quickstart with S3
This makes it easier to get set up with using S3 via the Postgres Helm chart. closes CrunchyData#20
1 parent fbe33a4 commit 4996a02

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

helm/postgres/templates/_s3.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{/* Allow for S3 secret information to be stored in a Secret */}}
2+
{{- define "postgres.s3" }}
3+
[global]
4+
{{- if .Values.s3 }}
5+
{{- if .Values.s3.key }}
6+
repo1-s3-key={{ .Values.s3.key }}
7+
{{- end }}
8+
{{- if .Values.s3.keySecret }}
9+
repo1-s3-key-secret={{ .Values.s3.keySecret }}
10+
{{- end }}
11+
{{- if .Values.s3.encryptionPassphrase }}
12+
repo1-cipher-pass={{ .Values.s3.encryptionPassphrase }}
13+
{{- end }}
14+
{{- end }}
15+
{{ end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.s3 }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
6+
type: Opaque
7+
data:
8+
s3.conf: |-
9+
{{ include "postgres.s3" . | b64enc }}
10+
{{- end }}

helm/postgres/templates/postgres.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ spec:
4040
{{- end }}
4141
{{- if .Values.pgBackRestConfig }}
4242
{{ toYaml .Values.pgBackRestConfig | indent 6 }}
43+
{{- else if .Values.s3 }}
44+
configuration:
45+
- secret:
46+
name: {{ default .Release.Name .Values.name }}-pgbackrest-secret
47+
global:
48+
repo1-path: /pgbackrest/{{ .Release.Namespace }}/{{ default .Release.Name .Values.name }}/repo1
49+
{{- if .Values.s3.encryptionPassphrase }}
50+
repo1-cipher-type: aes-256-cbc
51+
{{- end }}
52+
repos:
53+
- name: repo1
54+
s3:
55+
bucket: {{ .Values.s3.bucket | quote }}
56+
endpoint: {{ .Values.s3.endpoint | quote }}
57+
region: {{ .Values.s3.region | quote }}
4358
{{- else }}
4459
repos:
4560
- name: repo1

helm/postgres/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,26 @@
169169
# overridden by "pgBackRestConfig", if set. Defaults to the value velow.
170170
# backupsSize: 1Gi
171171

172+
# s3 allows for AWS S3 or an S3 compatible storage system to be used for
173+
# backups. This allows for a quick setup with S3; if you need more advanced
174+
# setup, use pgBackRestConfig.
175+
# s3:
176+
# # bucket specifies the S3 bucket to use,
177+
# bucket: ""
178+
# # endpoint specifies the S3 endpoint to use.
179+
# endpoint: ""
180+
# # region specifies the S3 region to use. If your S3 storage system does not
181+
# # use "region", fill this in with a random vaule.
182+
# region: ""
183+
# # key is the S3 key. This is stored in a Secret.
184+
# key: ""
185+
# # keySecret is the S3 key secret. This is tored in a Secret.
186+
# keySecret: ""
187+
# # encryptionPassphrase is an optional parameter to enable encrypted backups
188+
# # with pgBackRest. This is encrypted by pgBackRest and does not use S3's
189+
# # built-in encrpytion system.
190+
# encryptionPassphrase: ""
191+
172192
# pgBackRestConfig allows for the configuration of every pgBackRest option
173193
# except for "image", which is set by "pgBackRest".
174194
# pgBackRestConfig: {}

0 commit comments

Comments
 (0)