Skip to content

Commit

Permalink
Merge pull request #39 from tidepool-org/move-tpctl
Browse files Browse the repository at this point in the history
Moved tpctl to eks-template repo
  • Loading branch information
derrickburns authored Oct 9, 2019
2 parents 83f0d8d + dec8b5c commit 0312a11
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 2,246 deletions.
25 changes: 6 additions & 19 deletions bin/get_k8s_secret_from_aws
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,22 @@
#
# Get Secret from AWS Secrets Manager
#
# Usage: $0 $SECRET $ENVIRONMENT
# Usage: $0 $SECRETID

if [ $# -ne 2 ]
if [ $# -ne 1 ]
then
echo "Usage: $0 \$SECRET \$ENVIRONMENT"
echo "Usage: $0 \$SECRETID, e.g. $0 development/qa1/mongo"
exit 1
fi

SECRET=$1
ENVIRONMENT=$2

if [ -z "$CLUSTER_NAME" ]
then
echo "\$CLUSTER_NAME required."
exit
fi

out=$(aws secretsmanager get-secret-value --secret-id ${CLUSTER_NAME}/${ENVIRONMENT}/${SECRET} | jq '.SecretString')

val=$(echo "echo $out" | bash)
yaml=$(python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' <<< $val)

indented=$(echo "$yaml" | sed -e 's/^/ /')
yaml=$(aws secretsmanager get-secret-value --secret-id $1 | jq '.SecretString | fromjson' | yq r - | sed -e 's/^/ /')

cat <<!
apiVersion: v1
kind: Secret
type: Opaque
data:
$indented
$yaml
metadata:
name: ${SECRET}
namespace: ${ENVIRONMENT}
Expand Down
44 changes: 0 additions & 44 deletions cmd/Dockerfile

This file was deleted.

Loading

0 comments on commit 0312a11

Please sign in to comment.