From db8678463d1c7c399d8b550d0bcbc7fba3b87927 Mon Sep 17 00:00:00 2001 From: jwaldrip Date: Mon, 6 Mar 2017 10:09:25 -0700 Subject: [PATCH 1/4] add backup annotation --- k8s/redis-node-statefulset.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/k8s/redis-node-statefulset.yaml b/k8s/redis-node-statefulset.yaml index e822b1e..cf37f86 100644 --- a/k8s/redis-node-statefulset.yaml +++ b/k8s/redis-node-statefulset.yaml @@ -79,6 +79,7 @@ spec: name: data annotations: volume.beta.kubernetes.io/storage-class: "ssd" + gcp-auto-snapshot: "true" spec: accessModes: [ "ReadWriteOnce" ] resources: From 156ef67c6e5e141ac189214ac68d800f375c2a48 Mon Sep 17 00:00:00 2001 From: jwaldrip Date: Mon, 6 Mar 2017 15:55:42 -0700 Subject: [PATCH 2/4] fix --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 332ce37..c0da19d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -kubectl --namespace="$1" --context="$2" ${ACTION-"apply"} -Rf=./k8s +kubectl --namespace="$1" --context="$2" ${ACTION-"apply"} -Rf=./k8s --force From 2099b039e66365a3060779531806f741de8e3506 Mon Sep 17 00:00:00 2001 From: jwaldrip Date: Wed, 15 Mar 2017 18:03:34 -0600 Subject: [PATCH 3/4] push changes --- .travis.yml | 33 +++++++++++++++++++++------------ deploy.sh | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb64bba..b93f95a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,31 +6,40 @@ env: global: - CLOUDSDK_CONTAINER_USE_CLIENT_CERTIFICATE=True before_deploy: + # Authorize with gcloud + - > + if [[ -n "$TRAVIS_TAG" ]] ; then + echo $GCLOUD_ENCODED_CREDS | base64 -d > /tmp/gcloud.json && + gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json && + gcloud container clusters get-credentials production --project=commercial-tribe --zone=us-east1-c; + else + echo $GCLOUD_ENCODED_STAGING_CREDS | base64 -d > /tmp/gcloud.json && + gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json && + gcloud container clusters get-credentials staging --project=commercial-tribe-staging --zone=us-central1-a; + fi + + # Install and configure kubectl - CLOUDSDK_CORE_DISABLE_PROMPTS=true sudo gcloud components update kubectl --version 142.0.0 - - export PATH=$PATH:/usr/lib/google-cloud-sdk/bin + - export PATH=/usr/lib/google-cloud-sdk/bin:$PATH - sudo chown -R $USER /home/travis/.config/gcloud - - echo $GCLOUD_ENCODED_CREDS | base64 -d > /tmp/gcloud.json - - gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json - - gcloud config set project commercial-tribe - - gcloud config set compute/zone us-east1-c - - gcloud container clusters get-credentials staging - - gcloud container clusters get-credentials production - - git fetch + + # Authorize docker for access to gcloud + - gcloud docker --authorize-only deploy: - provider: script script: ./build-and-push.sh on: branch: master - provider: script - script: ./deploy.sh develop gke_commercial-tribe_us-east1-c_staging + script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging develop on: branch: develop - provider: script - script: ./deploy.sh staging gke_commercial-tribe_us-east1-c_staging + script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging staging on: branch: master - provider: script - script: ./deploy.sh production gke_commercial-tribe_us-east1-c_production + script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging production on: tags: true - condition: $TRAVIS_TAG =~ ^v20.*$ + condition: $TRAVIS_TAG =~ ^v20[0-9]{2}\.[1-4]\.[1-6]\.[0-9]+$ diff --git a/deploy.sh b/deploy.sh index c0da19d..89ce564 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -kubectl --namespace="$1" --context="$2" ${ACTION-"apply"} -Rf=./k8s --force +kubectl --context="$1" --namespace="$2" apply -Rf=./k8s --force From 25f01c93a56cb054820be3d3bb736561fad6c4d8 Mon Sep 17 00:00:00 2001 From: jwaldrip Date: Wed, 15 Mar 2017 18:06:18 -0600 Subject: [PATCH 4/4] use production context --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b93f95a..59d2ee4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ deploy: on: branch: master - provider: script - script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging production + script: ./deploy.sh gke_commercial-tribe_us-east1-c_production production on: tags: true condition: $TRAVIS_TAG =~ ^v20[0-9]{2}\.[1-4]\.[1-6]\.[0-9]+$