garden
garden copied to clipboard
Bug | Helm Module | Installation of CRD's.
Bug
Current Behavior
The user "sundbp" reported an issue with Garden's Helm chart module in Discord.
The problem is that Garden's Helm chart module does not propagate the "crds" directory alongside the typical "templates" directory into the ".garden/build/" hierarchy, resulting in CRDs not being installed when deploying a Helm chart that includes them.
Expected behavior
The "crds" directory should be propagated alongside the "templates" directory into the ".garden/build/" hierarchy to ensure that CRDs are installed when deploying a Helm chart that includes them.
Reproducible example
To help reproducing this issue I created this repository that deploys "kong" with the Helm module. Kong has a Helm Chart that includes CRDs which makes it perfect to reproduce this issue.
Once you install the chart you will noticed that the CRDs were not installed, and the "crds" directory is not included in the ".garden/build/" hierarchy.
Make sure to read the README.md of the repository for more context, steps to reproduce are:
gh repo clone ShankyJS/garden-charts-crds
cd garden-charts-crds
garden deploy
Then you will notice that the Kong CRD's were not installed as part of the deployment:
┌🤘-🐧shankyjs@ 💻 pop-os - 🧱 garden-charts-crdsmaster ⌀4 ✗
└🤘-> k get crds
NAME CREATED AT
addons.k3s.cattle.io 2023-01-16T19:11:39Z
helmcharts.helm.cattle.io 2023-01-16T19:11:39Z
helmchartconfigs.helm.cattle.io 2023-01-16T19:11:39Z
Workaround
There are some workarounds for this issue:
- sundbp used an explicit kubernetes module referencing the crd files (via a repositoryUrl to the git repo of the chart).
- For in-house Helm Charts you can create a different Helm Chart that installs the CRD's for you. And make it depend from the main chart. This idea is coming from Helm Method 2 for installing CRD's.
Suggested solution(s)
We could include the "crds" directory alongside the "templates" directory in the ".garden/build/" hierarchy to ensure that CRDs are installed when deploying a Helm chart that includes them. Alternatively, Garden could provide an option to explicitly include the "crds" directory when deploying a Helm chart.
Additional context
The "crds" directory is the standard way to install CRDs in Helm 3, so this issue affects any Helm chart that includes CRDs.
The crds directory was introduced as part of Helm 3 to simplify the installation of CRD's.
Your environment
- OS: Linux -> PopOS
- How I'm running Kubernetes: rancher-desktop & docker-desktop
garden version
┌🤘-🐧shankyjs@ 💻 pop-os - 🧱 garden-charts-crds on 🌵 master ✓
└🤘-> garden version
0.12.52
With the introduction of Actions in 0.13.x, we don't use the build staging directory for Helm charts, so everything that's in the action folder will be included.
Why is this not planned? It's still a bug, I can reproduce it with other charts. If there is a crds, it should be installed, too.