Skip to content

Commit 4e3fcf4

Browse files
committed
fix CRD lifecycle: retain on uninstall (resource-policy keep) + document upgrade adoption
Inject helm.sh/resource-policy: keep into each templated CRD via a fromYaml/toYaml round-trip so the CRDs (and their custom resources) survive helm uninstall and installCrds true->false, without touching the canonical crd/ files. Document the pre-2.8 -> 2.8 adoption path (--take-ownership or label/annotate) and the installCrds:false out-of-band option in the v2.8.1 release notes, and correct the v2.8.0 uninstall caveat.
1 parent e1a4c68 commit 4e3fcf4

3 files changed

Lines changed: 51 additions & 7 deletions

File tree

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{{- if .Values.installCrds }}
22
{{- range $path, $_ := .Files.Glob "crd-manifests/*.yaml" }}
3+
{{- $crd := $.Files.Get $path | fromYaml }}
4+
{{- $meta := $crd.metadata }}
5+
{{- $_ := set $meta "annotations" (merge (dict "helm.sh/resource-policy" "keep") (default (dict) $meta.annotations)) }}
36
---
4-
{{ $.Files.Get $path }}
7+
{{ $crd | toYaml }}
58
{{- end }}
69
{{- end }}

release-notes/v2.8.0.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ ownership:
2929
installCrds: false
3030
```
3131
32-
Caveat: templated CRDs are removed on `helm uninstall`, which cascades to and
33-
deletes any existing custom resources (RestateClusters, RestateDeployments,
34-
RestateCloudEnvironments). Set `installCrds: false` if you need CRDs to survive an
35-
uninstall.
32+
Caveat (fixed in v2.8.1): in v2.8.0 the templated CRDs were removed on
33+
`helm uninstall`, which cascaded to and deleted any existing custom resources
34+
(RestateClusters, RestateDeployments, RestateCloudEnvironments). As of v2.8.1 the
35+
templated CRDs carry `helm.sh/resource-policy: keep` and are retained on uninstall.
36+
See the [v2.8.1 release notes](https://github.com/restatedev/restate-operator/blob/release-2.8.1/release-notes/v2.8.1.md)
37+
for the retain policy and, if upgrading a pre-2.8 install, the CRD adoption steps.
3638

3739
*Related: PR [#161](https://github.com/restatedev/restate-operator/pull/161)*
3840

release-notes/v2.8.1.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,49 @@ This is a bug fix release, see [v2.8.0 release notes](https://github.com/restate
66

77
- **Fix: the release build now works with the Rust 1.95.0 toolchain** — the release Docker base image is bumped from `ghcr.io/restatedev/dev-tools:1.16.1` to `1.17.0`, which bakes the Rust 1.95.0 toolchain and its musl standard library needed by the musl cross-compile.
88

9-
## Upgrading
9+
- **Fix: templated CRDs are now retained on uninstall** — with the default `installCrds: true`, the chart's CRDs (`RestateCluster`, `RestateDeployment`, `RestateCloudEnvironment`) now carry the `helm.sh/resource-policy: keep` annotation. They are no longer deleted on `helm uninstall` or when switching to `installCrds: false`, so your custom resources are not cascade-deleted. This corrects the uninstall caveat noted in v2.8.0.
1010

11-
No CRD or functional changes in this release. Upgrade the operator via Helm:
11+
## Upgrading an existing (<= 2.7) install
12+
13+
CRDs now retain across uninstall, but adopting a pre-2.8 install into the new templated CRDs needs one manual step the first time.
14+
15+
Chart versions <= 2.7 installed the CRDs via Helm's special `crds/` directory, which leaves no Helm ownership metadata on them. On the first upgrade to 2.8 with the default `installCrds: true`, Helm tries to take over those CRDs and aborts with an `invalid ownership metadata` error. Pick one of the following before (or during) the upgrade.
16+
17+
Option A — take ownership during the upgrade (requires Helm >= 3.17):
18+
19+
```bash
20+
helm upgrade restate-operator restatedev/restate-operator --version 2.8.1 --take-ownership
21+
```
22+
23+
Option B — label and annotate the CRDs first, then upgrade normally. Replace `<release>` and `<namespace>` with your Helm release name and namespace:
24+
25+
```bash
26+
for crd in restateclusters.restate.dev restatedeployments.restate.dev restatecloudenvironments.restate.dev; do
27+
kubectl label crd "$crd" app.kubernetes.io/managed-by=Helm --overwrite
28+
kubectl annotate crd "$crd" \
29+
meta.helm.sh/release-name=<release> \
30+
meta.helm.sh/release-namespace=<namespace> --overwrite
31+
done
32+
33+
helm upgrade restate-operator restatedev/restate-operator --version 2.8.1
34+
```
35+
36+
Once adopted, the CRDs update on every `helm upgrade` and, thanks to the retain policy, survive uninstall.
37+
38+
### Managing CRDs outside the chart
39+
40+
If you manage CRDs out-of-band (GitOps/ArgoCD, or as nuon-byoc vendors them), set `installCrds: false` instead. The chart then never touches the CRDs, so there is nothing to adopt. Apply the CRD manifests published as GitHub release artifacts yourself (`crd/restateclusters.yaml`, `crd/restatedeployments.yaml`, `crd/restatecloudenvironments.yaml`). This is the recommended path for external CRD management.
41+
42+
```yaml
43+
installCrds: false
44+
```
45+
46+
## Upgrading (new install or already on 2.8.0)
47+
48+
No CRD schema or functional changes since 2.8.0. Upgrade the operator via Helm:
1249
1350
```bash
1451
helm upgrade restate-operator restatedev/restate-operator --version 2.8.1
1552
```
53+
54+
With the default `installCrds: true`, the CRDs are applied as part of the upgrade. If you manage CRDs outside this chart, set `installCrds: false` and apply them yourself.

0 commit comments

Comments
 (0)