Skip to content

Conversation

@nijdarshan
Copy link

Summary

Fixes #9213

PARAMETERS section in UI showed chart defaults instead of actual values when using inline helm.values. Now merges user's inline values and parameter overrides into displayed parameters.

Changes

  • Added flattenValues() helper to convert nested YAML to dot-notation
  • Modified populateHelmAppDetails() to merge inline values and parameters into the params map before display

Test plan

  • Local lint passes
  • Unit tests pass
  • Manual test: created app with values: replicaCount: 10 - PARAMETERS now shows replicaCount: 10 instead of chart default 1

Signed-off-by: Darshan Nij [email protected]

@nijdarshan nijdarshan requested a review from a team as a code owner January 10, 2026 19:38
@bunnyshell
Copy link

bunnyshell bot commented Jan 10, 2026

❗ Preview Environment deployment failed on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@nijdarshan
Copy link
Author

Current version:

Screenshot 2026-01-11 at 07 41 57 Screenshot 2026-01-11 at 07 42 21

Fixed:

Screenshot 2026-01-11 at 07 42 57

if err := yaml.Unmarshal(q.Source.Helm.ValuesYAML(), &userVals); err == nil {
flattenValues(userVals, params, "")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a warning/log message when spec.source.helm.values is not a valid Helm values object?

Copy link
Author

Choose a reason for hiding this comment

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

Added warning log when helm values parsing fails - will now log failed to parse helm values: <error> if the inline values YAML is malformed.

Copy link
Contributor

@Mangaal Mangaal left a comment

Choose a reason for hiding this comment

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

I have verified the changes locally and it is working as expected.
Could you please add some tests to cover this new logic? I have also left a small suggestion, please feel free to resolve it.

@nijdarshan nijdarshan force-pushed the fix/helm-params-show-effective-values branch from d7ef230 to 063d68a Compare January 12, 2026 07:53
@nijdarshan
Copy link
Author

I have verified the changes locally and it is working as expected. Could you please add some tests to cover this new logic? I have also left a small suggestion, please feel free to resolve it.

Added 3 unit tests:

  • TestFlattenValues - tests the helper function with simple, nested, deeply nested, array values, and empty map cases
  • Test_populateHelmAppDetails_WithInlineValues - verifies inline values are merged into parameters
  • Test_populateHelmAppDetails_WithParameterOverrides - verifies --set parameters override inline values (precedence)

Comment on lines 2311 to 2320
if q.Source.Helm != nil && !q.Source.Helm.ValuesIsEmpty() {
var userVals map[string]any
if err := yaml.Unmarshal(q.Source.Helm.ValuesYAML(), &userVals); err != nil {
log.Warnf("failed to parse helm values: %v", err)
} else {
flattenValues(userVals, params, "")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The code unmarshals inline values into a map[string]any then calls flattenValues(userVals, params, "")
If the YAML is not a map at the document root (e.g., a top-level array), unmarshalling into map[string]any will yield nil (no error), and flattenValues will be called with nil, which will panic.

Also nested maps may sometimes have non-string key types (map[interface{}]interface{}) depending on the yaml parsing library

I recommend using the any type and change the code to something like this

Suggested change
if q.Source.Helm != nil && !q.Source.Helm.ValuesIsEmpty() {
var userVals map[string]any
if err := yaml.Unmarshal(q.Source.Helm.ValuesYAML(), &userVals); err != nil {
log.Warnf("failed to parse helm values: %v", err)
} else {
flattenValues(userVals, params, "")
}
}
if q.Source.Helm != nil && !q.Source.Helm.ValuesIsEmpty() {
var raw any
if err := yaml.Unmarshal(q.Source.Helm.ValuesYAML(), &raw); err != nil {
log.Warnf("failed to parse helm values: %v", err)
} else {
// flatten supports arbitrary root types and map[interface{}] keys
flattenAnyValues(raw, params, "")
}
}

Copy link
Author

Choose a reason for hiding this comment

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

aaah, you are right! lemme fix this.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in latest commit. Now using any type with type assertion:

var raw any
if err := yaml.Unmarshal(..., &raw); err != nil {
    log.Warnf("failed to parse helm values: %v", err)
} else if userVals, ok := raw.(map[string]any); ok {
    flattenValues(userVals, params, "")
} else if raw != nil {
    log.Warnf("helm values is not a map, got %T", raw)
}

Added edge case tests in Test_populateHelmAppDetails_WithInvalidValues:

  • top-level array should not panic
  • scalar value should not panic
  • malformed yaml should not panic

Fixes argoproj#9213

PARAMETERS section showed chart defaults instead of actual values
when using inline helm.values. Now merges user's inline values and
parameter overrides into displayed parameters.

- Use any type for unmarshal to handle non-map YAML (arrays, scalars)
- Add warning log when values parsing fails or is not a map
- Add unit tests for flattenValues, inline values merge, and edge cases

Signed-off-by: Darshan Nij <[email protected]>
Signed-off-by: nijdarshan <[email protected]>
@nijdarshan nijdarshan force-pushed the fix/helm-params-show-effective-values branch from b07d5dc to e42a5b6 Compare January 12, 2026 09:06
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.

ArgoCD UI shows incorrect values when using ArgoCD + Helm for deployment

3 participants