-
Notifications
You must be signed in to change notification settings - Fork 9
fix(chart): allow metadata and additional labels #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,9 @@ | |||||||||||||||
| "imagePullSecrets": { | ||||||||||||||||
| "type": "array", | ||||||||||||||||
| "items": { "type": "string" } | ||||||||||||||||
| }, | ||||||||||||||||
| "metadata": { | ||||||||||||||||
| "type": "object" | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| }, | ||||||||||||||||
|
|
@@ -28,6 +31,9 @@ | |||||||||||||||
| "fullnameOverride": { | ||||||||||||||||
| "type": "string" | ||||||||||||||||
| }, | ||||||||||||||||
| "additionalLabels": { | ||||||||||||||||
| "type": "object" | ||||||||||||||||
| }, | ||||||||||||||||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
sed -n '1,80p' charts/sourcebot/values.schema.json
rg -n -C 3 'additionalLabels|metadata.labels|toYaml' charts/sourcebot/templates charts/sourcebot/values.yamlRepository: sourcebot-dev/sourcebot-helm-chart Length of output: 13267 Constrain The schema for this new top-level object lacks property type validation. Since it's merged into Kubernetes labels via the Proposed schema tightening- "additionalLabels": {
- "type": "object"
- },
+ "additionalLabels": {
+ "type": "object",
+ "additionalProperties": { "type": "string" }
+ },📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| "sourcebot": { | ||||||||||||||||
| "type": "object", | ||||||||||||||||
| "additionalProperties": false, | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 1112
🌐 Web query:
Helm Sprig mergeOverwrite precedence order which map wins💡 Result:
mergeOverwrite precedence (which map wins) In Helm templates, mergeOverwrite has argument precedence from right to left: later maps (to the right) overwrite earlier maps (to the left). So for: {{- $out := mergeOverwrite $dst $src1 $src2 -}} - For any conflicting key, $src2 wins. - If a key exists in $src2 and $src1, $src2’s value is used. - If a key does not exist in $src2 but exists in $src1, $src1’s value is used. - If a key exists only in $dst, $dst’s value remains. Example from Helm docs (key collisions): - dest: { default: "default", src: overwritten?, key: true } - src1: { key: false, name: value2 } - src2: { overwrite: overwritten, key: false, name: value1? } Helm’s documented result shows the overwriting effect: the merged value uses right-to-left precedence (e.g., default stays "default", key becomes the value from the rightmost map, and overwrite comes from the rightmost map). Note: mergeOverwrite performs a deep merge (nested maps are merged recursively), but it is not a deep copy; merged nested objects share references. Practical rule of thumb - Use mergeOverwrite $base $overrides1 $overrides2 when you want $overrides2 to win over $overrides1 and $base.
Citations:
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 117
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 1279
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 1874
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 2428
🏁 Script executed:
Repository: sourcebot-dev/sourcebot-helm-chart
Length of output: 62
Verify the merge order for overlapping label keys.
The merge order is confirmed:
mergeOverwriteapplies arguments left-to-right, soadditionalLabels(top-level) wins oversourcebot.additionalLabelson key collisions. However, the documentation describes both paths identically ("Add extra labels to all resources"), implying they should be treated equally. This precedence is undocumented in the code, and there is no test case covering key collisions between the two paths. If thesourcebot.*path should remain authoritative (as a chart-specific override), the merge order should be reversed, or the design intent should be explicitly documented.🤖 Prompt for AI Agents