Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom initContainer for register-content job #211

Closed
cognifloyd opened this issue Jun 29, 2021 · 2 comments · Fixed by #213
Closed

custom initContainer for register-content job #211

cognifloyd opened this issue Jun 29, 2021 · 2 comments · Fixed by #213

Comments

@cognifloyd
Copy link
Member

cognifloyd commented Jun 29, 2021

I need to disable most aliases and sensors that are enabled by default in system packs (st2, linux, and packs).
Since I need to adjust the system packs, I need this to do this whenever helm install or helm upgrade changes the system packs but before the content in the system packs gets registered.

Also, I want to ensure that these aliases are never enabled, so merely disabling them via API/UI once enabled is not good enough as that opens up a brief window where people can use !pack install and similar aliases that we don't want users to do via chatops.

I'm planning to use this with #199 (st2.packs.volumes), but it would also make sense when using st2.packs.images. With st2.packs.images, the custom images are copied into the emptyDir first, followed by the system packs (in the packs-initContainers helper template). So, custom images in st2.packs.images cannot change the system packs to disable unwanted aliases.

The helm chart uses {{ .Release.Name }}-job-st2-register-content to run st2-register-content. So, I think the ideal would be to allow for a custom initContainer on that Job. Then the question becomes: Where does such an initContainer definition go in values? st2.packs.registerContentInitContainer? jobs.registerContent.initContainer? Something else?

What should the UX for this look like?

@cognifloyd
Copy link
Member Author

cognifloyd commented Jun 29, 2021

OK. I added one possible approach in #213.

It would allow for something like this in values:

jobs:
  registerContentJob:
    initCommand:
      - '/bin/bash'
      - '-c'
      - |
        sed -i -e 's/^\(\s*\)enabled: true/\1enabled: false/' /opt/stackstorm/packs/packs/aliases/*.yaml
        sed -i -e 's/^\(\s*\)enabled: true/\1enabled: false/' /opt/stackstorm/packs/linux/aliases/*.yaml

I'm not fond of jobs.registerContentJob.initCommand - is there somewhere better to put this?

@cognifloyd
Copy link
Member Author

Maybe jobs.preRegisterContentCommand would be a better name for this, or at least it is less nested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant