From dd67eee5704cb507920efb70314b873a892a55ec Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Thu, 1 Oct 2026 13:57:18 +0200 Subject: [PATCH 1/3] follow-up to NebariApp template adoption --- dev/Makefile | 2 + docs/nebariapp-crd-reference.md | 66 ++++++++++--------- .../content/docs/nebariapp-crd-reference.md | 66 ++++++++++--------- 3 files changed, 74 insertions(+), 60 deletions(-) diff --git a/dev/Makefile b/dev/Makefile index 343eccd..56528d7 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -151,6 +151,7 @@ up-kustomize: cluster # up-basic - deploy basic nginx Helm example with NebariApp # -------------------------------------------------------------------------- up-basic: cluster + helm dependency update $(CHART_BASIC) helm upgrade --install my-pack $(CHART_BASIC) \ --set nebariapp.enabled=true \ --set nebariapp.hostname=$(HOSTNAME) \ @@ -165,6 +166,7 @@ up-basic: cluster # up-fastapi - deploy auth-aware FastAPI Helm example with NebariApp # -------------------------------------------------------------------------- up-fastapi: cluster + helm dependency update $(CHART_FASTAPI) helm upgrade --install my-pack $(CHART_FASTAPI) \ --set nebariapp.enabled=true \ --set nebariapp.hostname=$(HOSTNAME) \ diff --git a/docs/nebariapp-crd-reference.md b/docs/nebariapp-crd-reference.md index d1f3acb..24b862c 100644 --- a/docs/nebariapp-crd-reference.md +++ b/docs/nebariapp-crd-reference.md @@ -287,45 +287,30 @@ spec: ### Helm -In Helm charts, you can make the NebariApp conditional so the chart works both -standalone and on Nebari: +Charts render the NebariApp through the shared `nebari-app.nebariApp` template +provided by the `nebari-app` chart, instead of hand-writing the manifest. + +Add the dependency in `Chart.yaml`: ```yaml -{{- if .Values.nebariapp.enabled }} -apiVersion: reconcilers.nebari.dev/v1 -kind: NebariApp -metadata: - name: {{ include "my-pack.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "my-pack.labels" . | nindent 4 }} -spec: - hostname: {{ required "nebariapp.hostname is required" .Values.nebariapp.hostname }} - service: - name: {{ .Values.nebariapp.service.name | default (include "my-pack.fullname" .) }} - port: {{ .Values.nebariapp.service.port | default 80 }} - {{- with .Values.nebariapp.auth }} - auth: - enabled: {{ .enabled | default false }} - provider: {{ .provider | default "keycloak" }} - provisionClient: {{ .provisionClient | default true }} - {{- with .scopes }} - scopes: - {{- toYaml . | nindent 6 }} - {{- end }} - {{- end }} -{{- end }} +dependencies: + - name: nebari-app + repository: oci://quay.io/nebari/charts + version: ">=0.1.1" ``` -The corresponding `values.yaml` section: +Set any NebariApp `spec` field under `nebariapp:` in `values.yaml`. Everything +under `nebariapp:` (except `enabled`) is passed through to the NebariApp spec, +so all fields documented above can be set here. Templated values are quoted and +end with `| toJson` so they render as valid YAML: ```yaml nebariapp: enabled: false - # hostname: my-pack.nebari.example.com # Required when enabled + hostname: '{{ fail "nebariapp.hostname is required when nebariapp.enabled is true" }}' service: - name: "" # Defaults to release fullname - port: 80 + name: '{{ include "my-pack.fullname" . | toJson }}' + port: '{{ .Values.service.port }}' auth: enabled: false provider: keycloak @@ -336,3 +321,24 @@ nebariapp: - email gateway: public ``` + +Render the NebariApp in `templates/nebariapp.yaml`. The `if` makes it optional, +so the chart works both standalone and on Nebari: + +```yaml +{{- if .Values.nebariapp.enabled }} +{{- include "nebari-app.nebariApp" (dict + "metadata" (dict + "name" (include "my-pack.fullname" .) + "namespace" .Release.Namespace + "labels" (include "my-pack.labels" . | fromYaml) + ) + "spec" (omit .Values.nebariapp "enabled") + "tplCtx" . +) -}} +{{- end }} +``` + +`"tplCtx" .` passes the chart context into the template, so the `{{ ... }}` +values in `values.yaml` are rendered with access to `.Values`, `.Release`, and +the chart's named templates. diff --git a/docs/site/src/content/docs/nebariapp-crd-reference.md b/docs/site/src/content/docs/nebariapp-crd-reference.md index b777859..061e8dd 100644 --- a/docs/site/src/content/docs/nebariapp-crd-reference.md +++ b/docs/site/src/content/docs/nebariapp-crd-reference.md @@ -291,45 +291,30 @@ spec: ### Helm -In Helm charts, you can make the NebariApp conditional so the chart works both -standalone and on Nebari: +Charts render the NebariApp through the shared `nebari-app.nebariApp` template +provided by the `nebari-app` chart, instead of hand-writing the manifest. + +Add the dependency in `Chart.yaml`: ```yaml -{{- if .Values.nebariapp.enabled }} -apiVersion: reconcilers.nebari.dev/v1 -kind: NebariApp -metadata: - name: {{ include "my-pack.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "my-pack.labels" . | nindent 4 }} -spec: - hostname: {{ required "nebariapp.hostname is required" .Values.nebariapp.hostname }} - service: - name: {{ .Values.nebariapp.service.name | default (include "my-pack.fullname" .) }} - port: {{ .Values.nebariapp.service.port | default 80 }} - {{- with .Values.nebariapp.auth }} - auth: - enabled: {{ .enabled | default false }} - provider: {{ .provider | default "keycloak" }} - provisionClient: {{ .provisionClient | default true }} - {{- with .scopes }} - scopes: - {{- toYaml . | nindent 6 }} - {{- end }} - {{- end }} -{{- end }} +dependencies: + - name: nebari-app + repository: oci://quay.io/nebari/charts + version: ">=0.1.1" ``` -The corresponding `values.yaml` section: +Set any NebariApp `spec` field under `nebariapp:` in `values.yaml`. Everything +under `nebariapp:` (except `enabled`) is passed through to the NebariApp spec, +so all fields documented above can be set here. Templated values are quoted and +end with `| toJson` so they render as valid YAML: ```yaml nebariapp: enabled: false - # hostname: my-pack.nebari.example.com # Required when enabled + hostname: '{{ fail "nebariapp.hostname is required when nebariapp.enabled is true" }}' service: - name: "" # Defaults to release fullname - port: 80 + name: '{{ include "my-pack.fullname" . | toJson }}' + port: '{{ .Values.service.port }}' auth: enabled: false provider: keycloak @@ -340,3 +325,24 @@ nebariapp: - email gateway: public ``` + +Render the NebariApp in `templates/nebariapp.yaml`. The `if` makes it optional, +so the chart works both standalone and on Nebari: + +```yaml +{{- if .Values.nebariapp.enabled }} +{{- include "nebari-app.nebariApp" (dict + "metadata" (dict + "name" (include "my-pack.fullname" .) + "namespace" .Release.Namespace + "labels" (include "my-pack.labels" . | fromYaml) + ) + "spec" (omit .Values.nebariapp "enabled") + "tplCtx" . +) -}} +{{- end }} +``` + +`"tplCtx" .` passes the chart context into the template, so the `{{ ... }}` +values in `values.yaml` are rendered with access to `.Values`, `.Release`, and +the chart's named templates. From f030d10dd9afa2dc9a3b20320acbb8993cf9e8a6 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Tue, 6 Oct 2026 16:16:49 +0200 Subject: [PATCH 2/3] Apply batched suggestions from code review Co-authored-by: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> --- docs/nebariapp-crd-reference.md | 13 ++++++++++--- .../src/content/docs/nebariapp-crd-reference.md | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/nebariapp-crd-reference.md b/docs/nebariapp-crd-reference.md index 24b862c..33f7c76 100644 --- a/docs/nebariapp-crd-reference.md +++ b/docs/nebariapp-crd-reference.md @@ -290,7 +290,7 @@ spec: Charts render the NebariApp through the shared `nebari-app.nebariApp` template provided by the `nebari-app` chart, instead of hand-writing the manifest. -Add the dependency in `Chart.yaml`: +Add the dependency in `Chart.yaml`, then run `helm dependency build` to fetch it: ```yaml dependencies: @@ -301,8 +301,9 @@ dependencies: Set any NebariApp `spec` field under `nebariapp:` in `values.yaml`. Everything under `nebariapp:` (except `enabled`) is passed through to the NebariApp spec, -so all fields documented above can be set here. Templated values are quoted and -end with `| toJson` so they render as valid YAML: +so all fields documented above can be set here. Each `{{ ... }}` value is rendered +with the chart context and must produce valid JSON, so a template that renders a string +ends with `| toJson`. Numbers such as the port below don't need it: ```yaml nebariapp: @@ -311,6 +312,12 @@ nebariapp: service: name: '{{ include "my-pack.fullname" . | toJson }}' port: '{{ .Values.service.port }}' + routing: + routes: + - pathPrefix: / + pathType: PathPrefix + tls: + enabled: true auth: enabled: false provider: keycloak diff --git a/docs/site/src/content/docs/nebariapp-crd-reference.md b/docs/site/src/content/docs/nebariapp-crd-reference.md index 061e8dd..2b01f54 100644 --- a/docs/site/src/content/docs/nebariapp-crd-reference.md +++ b/docs/site/src/content/docs/nebariapp-crd-reference.md @@ -294,7 +294,7 @@ spec: Charts render the NebariApp through the shared `nebari-app.nebariApp` template provided by the `nebari-app` chart, instead of hand-writing the manifest. -Add the dependency in `Chart.yaml`: +Add the dependency in `Chart.yaml`, then run `helm dependency build` to fetch it: ```yaml dependencies: @@ -305,8 +305,9 @@ dependencies: Set any NebariApp `spec` field under `nebariapp:` in `values.yaml`. Everything under `nebariapp:` (except `enabled`) is passed through to the NebariApp spec, -so all fields documented above can be set here. Templated values are quoted and -end with `| toJson` so they render as valid YAML: +so all fields documented above can be set here. Each `{{ ... }}` value is rendered +with the chart context and must produce valid JSON, so a template that renders a string +ends with `| toJson`. Numbers such as the port below don't need it: ```yaml nebariapp: @@ -315,6 +316,12 @@ nebariapp: service: name: '{{ include "my-pack.fullname" . | toJson }}' port: '{{ .Values.service.port }}' + routing: + routes: + - pathPrefix: / + pathType: PathPrefix + tls: + enabled: true auth: enabled: false provider: keycloak From 4a489ebe1a6abfcbce108cbcd282a434d6754b18 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Tue, 6 Oct 2026 16:17:10 +0200 Subject: [PATCH 3/3] use helm dependency build --- dev/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/Makefile b/dev/Makefile index 56528d7..9a143b3 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -151,7 +151,7 @@ up-kustomize: cluster # up-basic - deploy basic nginx Helm example with NebariApp # -------------------------------------------------------------------------- up-basic: cluster - helm dependency update $(CHART_BASIC) + helm dependency build $(CHART_BASIC) helm upgrade --install my-pack $(CHART_BASIC) \ --set nebariapp.enabled=true \ --set nebariapp.hostname=$(HOSTNAME) \ @@ -166,7 +166,7 @@ up-basic: cluster # up-fastapi - deploy auth-aware FastAPI Helm example with NebariApp # -------------------------------------------------------------------------- up-fastapi: cluster - helm dependency update $(CHART_FASTAPI) + helm dependency build $(CHART_FASTAPI) helm upgrade --install my-pack $(CHART_FASTAPI) \ --set nebariapp.enabled=true \ --set nebariapp.hostname=$(HOSTNAME) \ @@ -183,7 +183,7 @@ up-fastapi: cluster # up-podinfo - deploy podinfo wrapper Helm example with NebariApp # -------------------------------------------------------------------------- up-podinfo: cluster - helm dependency update $(CHART_PODINFO) + helm dependency build $(CHART_PODINFO) helm upgrade --install my-pack $(CHART_PODINFO) \ --set nebariapp.enabled=true \ --set nebariapp.hostname=$(HOSTNAME) \