Skip to content

Conversation

@cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Oct 26, 2021

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/config file via extra_volumes; or
  • provide an ST2_API_KEY or ST2_AUTH_TOKEN via envFromSecrets.

Closes #233
Closes #256

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.

This allows users who pass credentials via extra_volumes or envFromSecrets
to bypass the `generate-st2client-config` initContainer.
@pull-request-size pull-request-size bot added the size/S PR that changes 10-29 lines. Very easy to review. label Oct 26, 2021
@cognifloyd cognifloyd requested a review from arm4b October 26, 2021 19:01
@cognifloyd cognifloyd added enhancement New feature or request Helm RFR labels Oct 26, 2021
@cognifloyd cognifloyd self-assigned this Oct 26, 2021
@cognifloyd cognifloyd changed the title add st2client/jobs.generateST2ClientConfig values allow bypassing generate-st2client-config init container for st2client and jobs pods Oct 26, 2021
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort!

This looks better than the previous one with #256, but still odd, focused on the specific rare use case.

What if we'll allow user to provide/template the /root/.st2/config file in the Helm values?
It can potentially bring more possibilities for customizations.
https://docs.stackstorm.com/reference/cli.html#configuration-file

Do you think it would be possible to put that together and make the specific case work for you?

@cognifloyd
Copy link
Member Author

Closing in favor of #262

@cognifloyd cognifloyd closed this Nov 9, 2021
@cognifloyd cognifloyd deleted the optional-generate-st2client-config branch November 11, 2021 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Helm RFR size/S PR that changes 10-29 lines. Very easy to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Allow hook/jobs to use an st2 api_key instead of user/pass

2 participants