Skip to content

Commit

Permalink
feat(wal-e): add WALE_S3_SSE environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhongyi committed Nov 24, 2018
1 parent 336b7d8 commit 90431d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions charts/database/templates/database-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
value: "{{.Values.global.storage}}"
- name: PGCTLTIMEOUT
value: "{{.Values.postgres.timeout}}"
{{- if eq .Values.global.storage "s3" }}
- name: S3_SSE
value: "{{.Values.s3.use_sse}}"
{{- end}}
lifecycle:
preStop:
exec:
Expand Down
5 changes: 5 additions & 0 deletions rootfs/docker-entrypoint-initdb.d/001_setup_envdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if [[ "$DATABASE_STORAGE" == "s3" || "$DATABASE_STORAGE" == "minio" ]]; then
else
echo "https+path://s3-${AWS_REGION}.amazonaws.com:443" > WALE_S3_ENDPOINT
fi
if [[ $S3_SSE ]]; then
echo $S3_SSE > WALE_S3_SSE
else
echo "false" > WALE_S3_SSE
fi
else
AWS_REGION="us-east-1"
BUCKET_NAME="dbwal"
Expand Down
6 changes: 3 additions & 3 deletions rootfs/patcher-script.d/patch_wal_e_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ def wrap_uri_put_file(creds, uri, fp, content_type=None, conn=None):
k = s3_util._uri_to_key(creds, uri, conn=conn)
if content_type is not None:
k.content_type = content_type
encrypt_key = False
if os.getenv('DATABASE_STORAGE') == 's3':
encrypt_key=True
else:
encrypt_key=False
if os.getenv('WALE_S3_SSE', 'false') == 'true':
encrypt_key = True
k.set_contents_from_file(fp, encrypt_key=encrypt_key)
return k
s3.uri_put_file = wrap_uri_put_file
Expand Down

0 comments on commit 90431d8

Please sign in to comment.