Skip to content

Commit

Permalink
Add convenience script to update AWS secrets
Browse files Browse the repository at this point in the history
Convenience script to update AWS secrets in examples/addons.yaml.

Usage:

 $ cd $GOPATH/sigs.k8s.io/cluster-api-provider-aws
 $ ./examples/update-aws-secrets.sh

Only works if both:

 - AWS_SECRET_ACCESS_KEY
 - AWS_ACCESS_KEY_ID

are set in the environment.
  • Loading branch information
frobware committed Aug 24, 2018
1 parent ce0966b commit 6790d03
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,27 @@ Note: this info is RH only, it needs to be backported every time the `README.md`
4. **Deploying the cluster-api stack manifests**
Add your aws credentials to the `addons.yaml` file in base64 format:
Add your AWS credentials to the `addons.yaml` file (in base64
format). You can either do this manually or use the
`examples/render-aws-secrets.sh`.
The easy deployment is:
```sh
./examples/render-aws-secrets.sh examples/addons.yaml | kubectl apply -f -
```
The manual deployment is:
``` sh
$ echo -n 'your_id' | base64
$ echo -n 'your_key' | base64
$ kubectl apply -f examples/addons.yaml
```
Deploy the components:
```sh
$ kubectl apply -f examples/addons.yaml
$ kubectl apply -f examples/cluster-api-server.yaml
$ kubectl apply -f examples/provider-components.yml
```
Expand Down
25 changes: 25 additions & 0 deletions examples/render-aws-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e

if [ $# -lt 1 ]; then
echo "usage: $0 <filename>"
exit 1
fi

if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "error: AWS_ACCESS_KEY_ID is not set in the environment" 2>&1
exit 1
fi

if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
echo "error: AWS_SECRET_ACCESS_KEY is not set in the environment" 2>&1
exit 1
fi

x=$(echo -n "$AWS_ACCESS_KEY_ID" | base64)
y=$(echo -n "$AWS_SECRET_ACCESS_KEY" | base64)

sed -e "s/awsAccessKeyId:.*/awsAccessKeyId: $x/" \
-e "s/awsSecretAccessKey:.*/awsSecretAccessKey: $y/" \
"$1"

0 comments on commit 6790d03

Please sign in to comment.