Files
harmony/iot/iot-operator-v0/chart/regen-crd.sh
Jean-Gabriel Gill-Couture 99e661ce4d
All checks were successful
Run Check Script / check (pull_request) Successful in 2m44s
feat(iot-operator): helm chart + gen-chart-crd subcommand
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.
2026-04-21 23:33:06 -04:00

18 lines
622 B
Bash
Executable File

#!/usr/bin/env bash
# Regenerate the chart's CRD yaml from the typed-Rust Deployment::crd().
# Runs at chart-release time, not at runtime. The runtime install path
# is `iot-operator-v0 install`, which uses the same Rust source of
# truth via a harmony Score — no yaml.
#
# Usage: iot/iot-operator-v0/chart/regen-crd.sh
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
REPO="$(cd "$HERE/../../.." && pwd)"
OUT="$HERE/crd-source/deployments.iot.nationtech.io.yaml"
cd "$REPO"
cargo build -q -p iot-operator-v0
./target/debug/iot-operator-v0 gen-chart-crd >"$OUT"
echo "regenerated $OUT ($(wc -l <"$OUT") lines)"