docs: add example of patching a helm chart#4840
Conversation
✅ Deploy Preview for zarf-docs canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
e072805 to
44eebd6
Compare
|
Changes split into a new Instead, a description was added to Let me know if you want more detail in the README, but I don't think a full git tutorial there is appropriate? I included a link to online |
This is a simple method to apply modifications to a helm chart that is not under your control, if value overrides are not sufficient. *.patch files are stored beside the zarf.yaml and applied in an onCreate action that clones the chart's git repository, applies the patches and then loads the patched chart from the local filesystem with localPath in the component definition. Signed-off-by: Blake Burkhart <bburky@bburky.com>
44eebd6 to
3f3f0cf
Compare
|
Also, not sure if I need to do anything to handle Windows? I saw one of the tests fail at one point. This should be POSIX-compatible |
Signed-off-by: Blake Burkhart <bburky@bburky.com>
brandtkeller
left a comment
There was a problem hiding this comment.
One observation otherwise this is a neat callout.
| # This is a simple method to apply modifications to a Helm chart that is not under your control, if value overrides are not sufficient | ||
| actions: | ||
| onCreate: | ||
| before: |
There was a problem hiding this comment.
What are your thoughts on cleaning up the cloned repository? Could we have an after action for cleaning up? It removes some of the step-by-step subtlety but I also don't want an (even an ignored) directory remaining behind if possible.
There was a problem hiding this comment.
If you get an error during the onCreate before action, I think the after action would be skipped. This action is expected to fail if the patches fail to apply cleanly (which may happen when bumping the git tag and the user would need to examine the repo and see what has changed).
uds-k3d does an rm in their onDeploy after, I've seen it litter my current directory with files when deploy fails. This rm never gets run on error.
For onCreate, a gitignore is pretty easy and should work well. But I can add an rm in to after if you'd like.
Because the after can be skipped, it is not possible to remove the first rm command currently present in the before
There was a problem hiding this comment.
agree with the semantics around errors. I was thinking merely for testing that we have cleanup as that example is used in our testing.
We are seeing the side-effect of that in the tests though - where we can't run a find images on the manifest as Zarf hasn't performed the clone yet and as such the local path doesn't exist for templating the chart....
| export GIT_COMMITTER_NAME="zarf" | ||
| export GIT_COMMITTER_EMAIL="zarf@invalid" | ||
| git am --3way ../*.patch # will error if the patch does not apply cleanly | ||
|
|
There was a problem hiding this comment.
Anyways, if you'd like an rm in after, you can apply this GitHub suggestion
| after: | |
| - cmd: rm -rf podinfo | |
I tested locally.
| # This is the cosign signature for the podinfo image for image signature verification | ||
| - ghcr.io/stefanprodan/podinfo:sha256-57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8.sig | ||
|
|
||
| - name: demo-patched-helm-chart |
There was a problem hiding this comment.
Existing tests that attempt to run zarf dev find-images on this package will now fail because the localPath doesn't exist until the action runs.
We'll need to make a decision here around this being solely documentation or looking at the behaviors/testing for updates.
Not sure if you're interested in this, or if this is the best place in the examples, but I thought I'd document this pattern we discovered that pretty cleanly can be used to carry patches on upstream Helm charts. This is useful when the upstream chart doesn't provide sufficient options in values overrides to make the required changes.
Description
Adding an example of patching a helm chart
This is a simple method to apply modifications to a helm chart that is not under your control, if value overrides are not sufficient.
*.patchfiles are stored beside thezarf.yamland applied in anonCreateaction that clones the chart's git repository, applies the patches and then loads the patched chart from the local filesystem withlocalPathin the component definition.Related Issue
Checklist before merging