The issue I'm having is that the DB_PASS variable has an extra unwanted space \n
and I'm not sure where it is coming from. I'm assuming I made a mistake in my shell script?
This is a code snippet of my shell script that replaces all the variables with their corresponding values:
#!/usr/bin/env bash
sed "s/GCLOUD_SERVICE_KEY_ENC_REPLACE/`echo $GCLOUD_SERVICE_KEY_ENC|base64`/g" mlflow_gcp_secret.yaml | \
sed "s/GCP_STORAGE_BUCKET_REPLACE/`echo $GCP_STORAGE_BUCKET|base64`/g" | \
sed "s/CLOUDSQL_USER_REPLACE/`echo $DB_USER|base64`/g" | \
sed "s/CLOUDSQL_PASS_REPLACE/`echo $DB_PASS|base64`/g" | \
sed "s/CLOUDSQL_DB_REPLACE/`echo $DB_NAME|base64`/g" | \
kubectl apply -f -
I would run this shell script as follows:
export GCLOUD_SERVICE_KEY_ENC=$(cat <PATH_TO_SECRET_JSON> | base64)
export GCP_STORAGE_BUCKET=<GS_BUCKET_NAME> # exclude gs:// prefix
export DB_USER=<DB_USER>
export DB_PASS=<DB_PASS>
export DB_NAME=<DB_NAME>
source ./populate_secret.sh