Created
October 14, 2019 13:24
-
-
Save asjadathick/ec2fbaf0fd41525c4ee20dc2f50b3c9b to your computer and use it in GitHub Desktop.
Bash script to generate a secret manifest for k8s secrets. Everything in ./CREDS/ gets picked as a credential
This file contains hidden or 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
| #!/bin/bash | |
| #removes secrets manifest file if already available | |
| rm secrets.yaml | |
| echo " | |
| apiVersion: v1 | |
| kind: Secret | |
| metadata: | |
| name: metricbeat-secrets | |
| data:" >> secrets.yaml | |
| for file in CREDS/*; do | |
| if [ -f "$file" ]; then | |
| name=${file#CREDS/} | |
| echo " $name: \"$(cat $file | base64)\"" >> secrets.yaml | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment