All checks were successful
Run Check Script / check (pull_request) Successful in 2m44s
Chapter 3 scaffolding. Chart layout mirrors the CloudNativePG convention after reviewing the CRD-in-chart vs CRD-as-hook tradeoff: CRDs live inside templates/ (so helm upgrade re-applies schema changes) with helm.sh/resource-policy: keep so helm uninstall never deletes them. Chart publication target is hub.nationtech.io. CRD yaml is generated at chart-release time by a new `iot-operator-v0 gen-chart-crd` subcommand reading Deployment::crd() — the runtime install path remains the typed Score; only the chart deliverable uses generated yaml. Wrapped with the helm conditional + annotations by templates/crds.yaml via .Files.Get so the generated yaml stays pure. Install / upgrade / uninstall-preserves-CRD validated against a scratch k3d cluster; the operator pod naturally stays pending because the hub.nationtech.io image hasn't been published yet.
22 lines
1.2 KiB
YAML
22 lines
1.2 KiB
YAML
{{/*
|
|
CRD installation. Cnpg-aligned pattern:
|
|
|
|
- CRDs sit inside templates/ (not Helm's native top-level crds/ dir)
|
|
so `helm upgrade` re-applies schema changes transparently.
|
|
- resource-policy: keep stops `helm uninstall` from deleting them
|
|
(and with them every customer CR).
|
|
- Gated by .Values.crds.create so GitOps setups that manage CRDs
|
|
out-of-band (ArgoCD, Flux) can flip it off.
|
|
|
|
The actual CRD YAML lives at chart/crd-source/ — regenerated from
|
|
the typed-Rust Deployment::crd() by `iot-operator-v0 gen-chart-crd`
|
|
at release time, never hand-edited.
|
|
*/}}
|
|
{{- if .Values.crds.create }}
|
|
{{- $crd := .Files.Get "crd-source/deployments.iot.nationtech.io.yaml" | fromYaml }}
|
|
{{- $_ := set $crd "metadata" (merge (dict "annotations" (dict "helm.sh/resource-policy" "keep")) ($crd.metadata | default dict)) }}
|
|
{{- $_ = set $crd.metadata "annotations" (merge (dict "helm.sh/resource-policy" "keep") ($crd.metadata.annotations | default dict)) }}
|
|
{{- $_ = set $crd.metadata "labels" (merge (dict "app.kubernetes.io/managed-by" .Release.Service "app.kubernetes.io/part-of" (include "iot-operator-v0.name" .)) ($crd.metadata.labels | default dict)) }}
|
|
{{ toYaml $crd }}
|
|
{{- end }}
|