allow bypassing generate-st2client-config init container for st2client and jobs pods by cognifloyd · Pull Request #261 · StackStorm/stackstorm-k8s
This allows users who pass credentials via extra_volumes or envFromSecrets to bypass the generate-st2client-config initContainer.
This adds two boolean values: st2client.generateST2ClientConfig and jobs.generateST2ClientConfig. By setting generateST2ClientConfig to false, users can exclude the generate-st2client-config initContainer from st2client and/or jobs. Normally, that initContainer creates the /root/.st2/config file. Users may want to skip that initContainer when they:
- provide their own
/root/.st2/configfile viaextra_volumes; or - provide an
ST2_API_KEYorST2_AUTH_TOKENviaenvFromSecrets.
Note: This PR is an alternate implementation of #256. (and I prefer this implementation over #256)
I want to provide the ST2_API_KEY via envFromSecrets, but the /root/.st2/client config with a username takes precedence over the ST2_API_KEY env var. When I looked into using kustomize I couldn't find a reliable way to remove the relevant initContainers. jsonPatch relies on array indexes which would be very brittle, and merge stragety patches can't remove items from an array. So, this PR provides a simple flag to exclude the initContainers in question.