Command Sh Script questions

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.16.5
Cloud being used: bare metal
Host OS: Mac

I am trying to do a POC that demonstrates we can use an init container to wait until the expected secrets are present. My poc has an init container with a command that looks like this:

command: ['sh', '-c', "secret=$(kubectl get secret myapp -n mynamespace -o json | jq '.data.secret'); until [ \"$secret\" = \"jMxMGRjNzQtM2FiMy00YTNiLWIxZjQtMGMyZGZlZGExYjI1\"]; do echo waiting for secret; sleep 2;"]

but it does not seem to be retrieving or setting the secret variable so this does not work. I tried accessing the secrets via env variables, but since those can’t be updated, that won’t work for my use case. What am I doing wrong? Can kubectl commands or jq be run here or not?

Thanks for any and all help, I am new to all of this.

Hello, @rodriga
I think you are not doing in a correct way.