File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ RUN apt-get update \
1919 && curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
2020 && apt-get update \
2121 && apt-get install --no-install-recommends -y \
22+ postgresql-client-12 \
2223 postgresql-client-11 \
2324 postgresql-client-10 \
2425 postgresql-client-9.6 \
@@ -28,6 +29,6 @@ RUN apt-get update \
2829
2930COPY dump.sh ./
3031
31- ENV PG_DIR=/usr/lib/postgresql/
32+ ENV PG_DIR=/usr/lib/postgresql
3233
3334ENTRYPOINT ["/dump.sh" ]
Original file line number Diff line number Diff line change @@ -6,12 +6,10 @@ set -o nounset
66set -o pipefail
77IFS=$' \n\t '
88
9- # make script trace visible via `kubectl logs`
10- set -o xtrace
11-
129ALL_DB_SIZE_QUERY=" select sum(pg_database_size(datname)::numeric) from pg_database;"
1310PG_BIN=$PG_DIR /$PG_VERSION /bin
1411DUMP_SIZE_COEFF=5
12+ ERRORCOUNT=0
1513
1614TOKEN=$( cat /var/run/secrets/kubernetes.io/serviceaccount/token)
1715K8S_API_URL=https://$KUBERNETES_SERVICE_HOST :$KUBERNETES_SERVICE_PORT /api/v1
@@ -42,9 +40,9 @@ function aws_upload {
4240
4341 [[ ! -z " $EXPECTED_SIZE " ]] && args+=(" --expected-size=$EXPECTED_SIZE " )
4442 [[ ! -z " $LOGICAL_BACKUP_S3_ENDPOINT " ]] && args+=(" --endpoint-url=$LOGICAL_BACKUP_S3_ENDPOINT " )
45- [[ ! " $LOGICAL_BACKUP_S3_SSE " == " " ]] && args+=(" --sse=$LOGICAL_BACKUP_S3_SSE " )
43+ [[ ! -z " $LOGICAL_BACKUP_S3_SSE " ]] && args+=(" --sse=$LOGICAL_BACKUP_S3_SSE " )
4644
47- aws s3 cp - " $PATH_TO_BACKUP " " ${args[@]// \' / } " --debug
45+ aws s3 cp - " $PATH_TO_BACKUP " " ${args[@]// \' / } "
4846}
4947
5048function get_pods {
@@ -93,4 +91,9 @@ for search in "${search_strategy[@]}"; do
9391
9492done
9593
94+ set -x
9695dump | compress | aws_upload $(( $(estimate_size) / DUMP_SIZE_COEFF))
96+ [[ ${PIPESTATUS[0]} != 0 || ${PIPESTATUS[1]} != 0 || ${PIPESTATUS[2]} != 0 ]] && (( ERRORCOUNT += 1 ))
97+ set +x
98+
99+ exit $ERRORCOUNT
You can’t perform that action at this time.
0 commit comments