rancher / charts-build-scripts

Apache License 2.0
9 stars 32 forks source link

Fix crd patches #143

Open joshmeranda opened 1 month ago

joshmeranda commented 1 month ago

Problem

When generating patches for a chart with crds we currently copy the crds pulled from upstream back into the main chart which are then included in the main chart patch.

Solution

We can't simply check for c.Upstream == nil before copying since we will not be able to generate validate-install-crd.yaml when c.CRDOptions.UseTarArchive is true since there won't be any crds to generate the validation on. To fix this, we always generate the validation file based on the crds in the generated chart and only copy those crds to the main chart if there is no upstream.

Unfortunately we have to unarchive the CRDs whenever we need to generate the validation file, but in my testing this does not affect the runtime much. I think the better separation between the Prepare, ApplyMainChanges, and RevertMainChanges makes up for it in terms of readbility. (of course open to disagreement on this point)

Issue: https://github.com/rancher/charts-build-scripts/issues/142

joshmeranda commented 3 weeks ago

@rancher/release-team can I get a review on this?