-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeremy Hert
committed
Jul 20, 2019
1 parent
a21aa6b
commit 2aa6a6b
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
: ${GOOGLE_CLOUD_PROJECT:?} | ||
: ${VAULT_ADDR:?} | ||
: ${ENVIRONMENT:?} | ||
: ${SUFFIX:?} | ||
|
||
# the paths we'll use will be relative to this script | ||
WD=$( dirname "${BASH_SOURCE[0]}" ) | ||
NOW=$(date +%Y-%m-%d_%H-%M-%S) | ||
DATA_REPO_TAG="${GOOGLE_CLOUD_PROJECT}_${NOW}" | ||
SCRATCH=/tmp/deploy-scratch | ||
|
||
# Make sure kubectl is pointing at the right project | ||
KUBECTL_CONTEXT=$(kubectl config current-context) | ||
if [[ $KUBECTL_CONTEXT != *${GOOGLE_CLOUD_PROJECT}* ]]; then | ||
echo "the kubernetes context (${KUBECTL_CONTEXT}) does not match your GOOGLE_CLOUD_PROJECT: ${GOOGLE_CLOUD_PROJECT}" | ||
echo "the easiest way to change it is using the context menu after clicking on the Docker icon in your top bar" | ||
exit 1 | ||
fi | ||
|
||
# make a temporary directory for rendering, we'll delete it later | ||
mkdir -p $SCRATCH | ||
|
||
# render environment-specific oidc deployment and ingress configs then create them | ||
consul-template -template "${WD}/k8s/deployments/oidc-proxy-deployment.yaml.ctmpl:${SCRATCH}/oidc-proxy-deployment.yaml" -once | ||
kubectl --namespace=data-repo apply -f "${SCRATCH}/oidc-proxy-deployment.yaml" | ||
|
||
rm -r $SCRATCH |