Skip to content

template values for library chart - #184

Open
pmeier wants to merge 4 commits into
mainfrom
deep-tpl
Open

template values for library chart#184
pmeier wants to merge 4 commits into
mainfrom
deep-tpl

Conversation

@pmeier

@pmeier pmeier commented Aug 20, 2026

Copy link
Copy Markdown
Member

Issue

TL;DR

  • NebariApp spec values like hostname or service configuration often need dynamically computed default values
  • Computation can only happens as part of templates
  • There is no good native way in helm to blend static and dynamic default values to pass them on as arguments to a template

What does this implement/fix?

TL;DR

  • reusable deepTplJson template that recursively applies the tpl function to all strings in a nested structure
  • usage of deepTplJson for the metadata and spec of the nebariApp template to allow dynamically computed default values natively

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

{{- if lt (int .spec.service.port) 1 -}}{{- fail "spec.service.port must be >= 1" -}}{{- end -}}
{{- $ctx := .ctx | default dict -}}
{{- $metadata := include "nebari-app.deepTplJson" (dict "ctx" $ctx "value" .metadata) | fromJson -}}
{{- $_ := required "metadata.name is required" $metadata.name -}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the checks after the templating as a template might expand into an empty value, while the template itself is not empty.

Comment thread Makefile
helm-test-generate-golden: ## Generate golden files for nebari-app chart tests.
@command -v helm >/dev/null 2>&1 || { echo >&2 "helm is required but not installed. See https://helm.sh/docs/intro/install/"; exit 1; }
helm dependency build test/helm/nebari-app >/dev/null
helm dependency build --skip-refresh test/helm/nebari-app >/dev/null

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the only dependency we have is local, we can skip the refresh of all registered repositories the user has, as they don't apply anyway.

@pmeier
pmeier marked this pull request as ready for review August 20, 2026 14:31
@pmeier
pmeier requested a review from dcmcand August 20, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants