Skip to content

Commit a5ae8b9

Browse files
(docs/helm): Fix note about crds and ensure places in both versions
1 parent 2342d00 commit a5ae8b9

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

docs/book/src/plugins/available/helm-v1-alpha.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,31 @@ under the [testdata][testdata] directory on the root directory of the Kubebuilde
5050
under `dist/chart/values.yaml`, and the `templates/manager/manager.yaml`, you will need to manually reapply your customizations on top
5151
of the latest changes after regenerating the Helm chart.
5252

53+
<aside class="note">
54+
<H1> Why CRDs are added under templates? </H1>
55+
56+
Although [Helm best practices](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#method-1-let-helm-do-it-for-you) recommend placing CRDs under a top-level `crds/` directory, the Kubebuilder Helm plugin intentionally places them under `templates/crd`.
57+
58+
The rationale is tied to how Helm itself handles CRDs.
59+
By default, Helm will install CRDs once during the initial release,
60+
but it will **ignore CRD changes** on subsequent upgrades.
61+
62+
This can lead to surprising behavior where chart upgrades silently
63+
skip CRD updates, leaving clusters out of sync.
64+
65+
To avoid endorsing this behavior, the Kubebuilder plugin follows the approach of packaging
66+
CRDs inside `templates/`. In this mode, Helm treats CRDs like
67+
any other resource, ensuring they are applied and upgraded as expected.
68+
While this prevents mixing CRDs and CRs of the same type in a single chart (since Helm cannot wait between creation steps), it ensures predictable and explicit lifecycle management of CRDs.
69+
70+
In short:
71+
- **Helm `crds/` directory** → one-time install only, no upgrades.
72+
- **Kubebuilder `templates/crd`** → CRDs managed like other manifests, upgrades included.
73+
74+
This design choice prioritizes correctness and maintainability over Helm's default convention,
75+
while leaving room for future improvements (such as scaffolding separate charts for APIs and controllers).
76+
</aside>
77+
5378
## How to use it ?
5479

5580
### Basic Usage

docs/book/src/plugins/available/helm-v2-alpha.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ The plugin creates a chart layout that matches your `config/`:
116116
└── servicemonitor.yaml
117117
```
118118

119-
<aside>
119+
<aside class="note">
120120
<H1> Why CRDs are added under templates? </H1>
121121

122122
Although [Helm best practices](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#method-1-let-helm-do-it-for-you) recommend placing CRDs under a top-level `crds/` directory, the Kubebuilder Helm plugin intentionally places them under `templates/crd`.
@@ -137,7 +137,7 @@ In short:
137137
- **Helm `crds/` directory** → one-time install only, no upgrades.
138138
- **Kubebuilder `templates/crd`** → CRDs managed like other manifests, upgrades included.
139139

140-
This design choice prioritizes correctness and maintainability over Helms default convention,
140+
This design choice prioritizes correctness and maintainability over Helm's default convention,
141141
while leaving room for future improvements (such as scaffolding separate charts for APIs and controllers).
142142
</aside>
143143

0 commit comments

Comments
 (0)