Files
harmony/iot/iot-operator-v0/chart/templates/_helpers.tpl
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

59 lines
1.8 KiB
Smarty

{{/*
Expand the name of the chart.
*/}}
{{- define "iot-operator-v0.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Fully qualified app name defaults to <release>-<chart>. Truncated to
the 63-char k8s label limit.
*/}}
{{- define "iot-operator-v0.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- define "iot-operator-v0.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels applied to every chart-owned resource.
*/}}
{{- define "iot-operator-v0.labels" -}}
helm.sh/chart: {{ include "iot-operator-v0.chart" . }}
{{ include "iot-operator-v0.selectorLabels" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{- define "iot-operator-v0.selectorLabels" -}}
app.kubernetes.io/name: {{ include "iot-operator-v0.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
ServiceAccount name honors .Values.serviceAccount.name when set,
falls back to the fullname.
*/}}
{{- define "iot-operator-v0.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "iot-operator-v0.fullname" .) .Values.serviceAccount.name -}}
{{- else -}}
{{- default "default" .Values.serviceAccount.name -}}
{{- end -}}
{{- end -}}
{{/*
Image ref. Defaults to .Chart.AppVersion when tag is empty.
*/}}
{{- define "iot-operator-v0.image" -}}
{{- $tag := default .Chart.AppVersion .Values.image.tag -}}
{{- printf "%s:%s" .Values.image.repository $tag -}}
{{- end -}}