Skip to content

docs: clarify bundle values and variables - #1457

Merged
joelmccoy merged 3 commits into
mainfrom
agent/object-override-substitution
Aug 13, 2026
Merged

joelmccoy merged 3 commits into
mainfrom
agent/object-override-substitution

Conversation

@slaskawi

@slaskawi slaskawi commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Clarify the intended bundle override model:

  • Use values for static configuration set at bundle creation.
  • Use variables for configuration supplied or changed at deploy time.
  • Mark credentials with sensitive: true.
  • Use type: file when exact literal contents, including backslashes, must be preserved.

Includes a migration example. No code changes.

Related Issue

Related to #1456

Validation

  • uds run docs:test
  • git diff --check origin/main...HEAD

Signed-off-by: Sebastian Łaskawiec <sebastian.laskawiec@defenseunicorns.com>
@slaskawi
slaskawi force-pushed the agent/object-override-substitution branch from 65dc92c to f59d66f Compare August 12, 2026 06:52
@slaskawi
slaskawi marked this pull request as ready for review August 12, 2026 07:12
@slaskawi
slaskawi requested a review from a team as a code owner August 12, 2026 07:12
Copilot AI lite review requested due to automatic review settings August 12, 2026 07:12
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR resolves templates recursively within structured Helm values before JSON encoding, preserving quoted and escaped contents while detecting resolved map-key collisions. It also propagates package-preview override errors without exposing resolved values and clarifies recommended use of static values, runtime variables, sensitive variables, and file variables.

  • Recursively substitutes templates in structured map and list values without mutating their inputs.
  • Preserves templated map keys and rejects collisions after substitution.
  • Safely handles unavailable imported variables during package preview.
  • Adds contextual override errors while suppressing potentially sensitive Helm parser details.
  • Documents recommended bundle override patterns and migration guidance.

Confidence Score: 5/5

The PR appears safe to merge, with the changed template-resolution and preview-error paths covered by focused tests and no actionable defects identified.

Structured templates are resolved before JSON serialization without mutating source values, key collisions are rejected, unavailable preview imports remain unresolved rather than becoming empty, and propagated errors retain useful location context while avoiding disclosure of resolved values.

Important Files Changed

Filename Overview
src/pkg/bundle/overrides.go Resolves templates before structured JSON encoding, detects map-key collisions, safely skips unavailable imports, and adds contextual error handling without exposing Helm parser details.
src/pkg/bundle/deploy.go Package-view generation now propagates chart-override processing failures instead of silently discarding them.
src/pkg/bundle/overrides_test.go Adds coverage for escaped credentials, recursive structured substitutions, input immutability, templated keys, collision handling, unavailable imports, and redacted preview errors.
docs/how-to-guides/use-bundle-overrides.mdx Clarifies static versus runtime configuration and documents sensitive and exact-literal file variable usage.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Bundle chart overrides] --> B[Load available variables]
  B --> C[Process value overrides]
  C --> D{Structured value?}
  D -->|Map or list| E[Recursively substitute strings and map keys]
  E --> F{Resolved key collision?}
  F -->|Yes| G[Return contextual error]
  F -->|No| H[JSON encode resolved structure]
  D -->|Scalar| I[Substitute scalar template]
  H --> J[Merge Helm values]
  I --> J
  J -->|Success| K[Chart override map]
  J -->|Failure| L[Return redacted contextual error]
Loading

Reviews (1): Last reviewed commit: "fix: preserve templated object values" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes templated variable substitution for structured Helm overrides by resolving templates inside nested maps/lists before JSON encoding, preventing quotes/backslashes from corrupting JSON and avoiding accidental leakage of resolved values via Helm parse errors. It also tightens error propagation during preview generation and updates the bundle override guide to better distinguish static values vs deploy-time variables.

Changes:

  • Recursively substitutes templated string leaves (and templated map keys) in nested override values prior to JSON marshaling; rejects templated key collisions.
  • Propagates override-processing errors in formPkgViewsWithMetadata (preview) instead of ignoring them, and avoids including resolved values in Helm merge errors.
  • Adds regression tests for quote/backslash preservation, templated map keys, collision handling, and preview error propagation; clarifies docs guidance around values/variables/sensitive/file variables.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/pkg/bundle/overrides.go Resolves templates in structured overrides before JSON encoding; improves context wrapping for override processing and redacts Helm merge errors.
src/pkg/bundle/overrides_test.go Adds regression tests covering nested map/list substitutions, templated keys, collision rejection, and preview error propagation/redaction.
src/pkg/bundle/deploy.go Ensures preview/package view generation propagates chart override processing errors.
docs/how-to-guides/use-bundle-overrides.mdx Clarifies guidance on static values vs deploy-time variables, plus sensitive: true and type: file usage.

πŸ’‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/pkg/bundle/overrides.go Resolved

@chance-coleman chance-coleman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

few small comments, generally looking good

Comment thread src/pkg/bundle/overrides_test.go Resolved
Comment thread src/pkg/bundle/overrides_test.go Resolved
Comment thread src/pkg/bundle/overrides_test.go Resolved
Comment thread src/pkg/bundle/overrides.go Resolved
Signed-off-by: Sebastian Łaskawiec <sebastian.laskawiec@defenseunicorns.com>
@slaskawi slaskawi changed the title fix: preserve templated object values docs: clarify bundle override variables Aug 13, 2026
Signed-off-by: Sebastian Łaskawiec <sebastian.laskawiec@defenseunicorns.com>
@slaskawi slaskawi changed the title docs: clarify bundle override variables docs: clarify bundle values and variables Aug 13, 2026
@joelmccoy
joelmccoy merged commit d0b9ac2 into main Aug 13, 2026
13 checks passed
@joelmccoy
joelmccoy deleted the agent/object-override-substitution branch August 13, 2026 16:46
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.

5 participants