Skip to content

Expose helm template option "--skip-tests" to avoid deploying test resources #231

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

Merged
merged 1 commit into from
May 24, 2023
Merged

Expose helm template option "--skip-tests" to avoid deploying test resources #231

merged 1 commit into from
May 24, 2023

Conversation

markszabo
Copy link

@markszabo markszabo commented May 23, 2023

Helm charts can include tests that are executed after a deploy to ensure the deploy was successful. However when running helm template these test resources (usually Pods) end up in the resulting kubernetes yaml, and then get applied each time the terraform pipeline is run. These Pods might get scheduled before the main app becomes healthy, so they error out. Moreover these often don't have the same security controls as the main application leading to OPA policy failures (if OPA is used on the cluster).

To avoid this, helm template has the --skip-tests flag which is also exposed by kustomize (issue, pr).

This PR adds this flag to the kustomize provider.

I decided not to change the default behavior, so tests will only be excluded from the output if one explicitly sets the skip_tests option to true. In the unit tests I'm reusing the existing chart, so I had to add skip_tests=true to all other tests to avoid having the test Pod in their output. Let me know if there is a better solution to this.

@markszabo markszabo marked this pull request as draft May 23, 2023 02:07
@markszabo markszabo marked this pull request as ready for review May 23, 2023 03:07
@markszabo
Copy link
Author

Copy link
Member

@pst pst left a comment

Choose a reason for hiding this comment

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

I despise helm for all the shenanigans it does and now the provider I built specifically to have a sane alternative is littered with helm specific crap. To whoever accepted the helm integration into kustomize originally, you've ruined a great thing.

I guess when the tests pass and the option is in upstream kustomize I'll merge it here too.

Could you do me one favor though and squash everything into one commit? Thanks @markszabo

@markszabo
Copy link
Author

Done, commits squashed, tests passing (gave you access to my fork of the repo, incase you can't see it otherwise). This has been merged to upstream since February, so I think it fulfills all your requests @pst

On the helm crap: I agree, but unfortunately I need to deploy vendor software packaged as helm charts

@pst pst merged commit 4409977 into kbst:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants