Skip to content

Commit

Permalink
Modify BPs to not use .ArtifactsOut as func args (#4045)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavannd1 authored and Ilya Kislenko committed Oct 8, 2018
1 parent f691ba2 commit 2f639d0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ actions:
- |
env_prefix="{{ snakecase .StatefulSet.Name | trimSuffix "_data" | upper}}"
cluster_ip=$(env | grep ${env_prefix}_CLIENT_PORT_9200_TCP_ADDR= | sed 's/.*=//')
snapshot_prefix="{{ .ArtifactsOut.esBackup.KeyValue.path }}"
snapshot_prefix="/elasticsearch-backups/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}"
list="$(curl -GET ${cluster_ip}:9200/_cat/indices | awk '{ print $3 }')"
for index in $list
do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ actions:
then
dump_cmd+=(-u "${MONGO_ADMIN_USER}" -p "${MONGO_ADMIN_PASSWORD}")
fi
${dump_cmd[@]} | kando location push --profile '{{ toJson .Profile }}' --path '{{ .ArtifactsOut.cloudObject.KeyValue.path }}' -
${dump_cmd[@]} | kando location push --profile '{{ toJson .Profile }}' --path '/mongodb-replicaset-backups/{{ .StatefulSet.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}/rs_backup.gz' -
restore:
type: StatefulSet
inputArtifactNames:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ actions:
- pipefail
- -c
- |
s3_path="{{ .ArtifactsOut.mysqlCloudDump.KeyValue.path }}"
s3_path="/mysql-backups/{{ .Deployment.Namespace }}/{{ .Deployment.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}/dump.sql.gz"
mysqldump -u root --password="${MYSQL_ROOT_PASSWORD}" --single-transaction --all-databases | gzip - | kando location push --profile '{{ toJson .Profile }}' --path ${s3_path} -
restore:
type: Deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ actions:
then
# Setup wal-e s3 connection parameters.
timeline={{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}
wale_s3_prefix="s3://{{ .Profile.Location.S3Compliant.Bucket }}/{{ .ArtifactsOut.manifest.KeyValue.prefix }}/${timeline}"
wale_s3_prefix="s3://{{ .Profile.Location.S3Compliant.Bucket }}/postgres-backups/{{ .Deployment.Name }}/${timeline}"
echo "${wale_s3_prefix}" > "${env_wal_prefix}"
fi
Expand Down Expand Up @@ -89,7 +89,7 @@ actions:
{{- if .Profile.Location.S3Compliant.Region }}
s3_cmd+=(--region "{{ .Profile.Location.S3Compliant.Region | quote}}")
{{- end }}
s3_path="s3://{{ .Profile.Location.S3Compliant.Bucket }}/{{ .ArtifactsOut.manifest.KeyValue.path }}"
s3_path="s3://{{ .Profile.Location.S3Compliant.Bucket }}/postgres-backups/{{ .Deployment.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}/manifest.txt"
s3_cmd+=(s3 cp - "${s3_path}")
set +o xtrace
Expand Down
2 changes: 1 addition & 1 deletion examples/mongo-sidecar/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ actions:
then
cmd=(aws --endpoint https://storage.googleapis.com s3 cp)
fi
${cmd[@]} ${file} "{{ .ArtifactsOut.cloudObject.KeyValue.path }}"
${cmd[@]} ${file} "{{ .ConfigMaps.location.Data.bucket }}/backups/{{ .StatefulSet.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}/rs0.tar"
restore:
type: StatefulSet
inputArtifactNames:
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres-basic-pgdump/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ actions:
export PGPORT=${{ .StatefulSet.Name | upper | replace "-" "_" }}_PORT_5432_TCP_PORT
export PGPASSWORD={{ .Secrets.postgres.Data.password_superuser | toString }}
pg_dumpall -U postgres -c -f backup.tar
aws s3 cp backup.tar "{{ .ArtifactsOut.cloudObject.KeyValue.path }}"
aws s3 cp backup.tar "{{ .ConfigMaps.location.Data.bucket }}/backups/{{ .StatefulSet.Namespace }}/{{ .StatefulSet.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}/pg_backup.tar"
restore:
type: StatefulSet
secretNames:
Expand Down
4 changes: 2 additions & 2 deletions examples/time-log/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ actions:
pod: "{{ index .Deployment.Pods 0 }}"
container: test-container
includePath: /var/log
backupArtifactPrefix: "{{ .ArtifactsOut.timeLog.KeyValue.path }}"
backupIdentifier: "{{ .ArtifactsOut.backupIdentifier.KeyValue.id }}"
backupArtifactPrefix: "{{ .Profile.Location.S3Compliant.Bucket }}/time-log"
backupIdentifier: "{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02" }}"
restore:
type: Deployment
inputArtifactNames:
Expand Down

0 comments on commit 2f639d0

Please sign in to comment.