feat(deployment): support additionalContainers as a map - #593
Conversation
|
HI @aslafy-z and @rasheedamir what do you think about this MR? |
aslafy-z
left a comment
There was a problem hiding this comment.
Thank you for your contribution, please address the following comment so we can proceed.
|
Could you drop the YAML anchors here and write the asserts out literally? This is test code, and in tests we want to minimize logic and indirection: each test should be readable standalone, as plain input and expected output. Duplication is fine here, an anchor is not worth the extra hop.
Anchors as a convention would only make sense applied consistently across the test files, and I don't think that churn is worth it either way given the point above about keeping tests logic-free. |
|
One more thing on the tests: could you use the placeholder image convention instead of real images ( |
Allow deployment.additionalContainers to be specified as a map in addition to the existing list format. When a map is provided, each key becomes the container name, which makes per-container overrides easier (e.g. via ArgoCD). The list format remains fully supported and behaves as before. Update values.yaml documentation, the values schema to accept objects, and add unit tests covering both list and map formats, multiple map entries, and the empty-map case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Wilson Júnior <wilsonpjunior@gmail.com>
2a9ea2f to
338fe5c
Compare
|
Hi @aslafy-z I made the requested changes. Thanks |
There was a problem hiding this comment.
Pull request overview
Adds support for configuring deployment.additionalContainers as either a list (existing behavior) or a map (new), enabling deterministic per-container overrides in GitOps workflows while maintaining backward compatibility.
Changes:
- Updated the Deployment template to render
additionalContainersfrom either list or map input. - Updated values docs/schema (values.yaml, values.schema.json, README) to document and validate list/object/null.
- Added unit tests for list and map formats and updated CI example values to exercise the new map path.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents deployment.additionalContainers as list/object/null and mentions map support rationale. |
| application/values.yaml | Updates inline values documentation and provides examples for both map and list formats. |
| application/values.schema.json | Extends schema type for deployment.additionalContainers to include object. |
| application/tests/deployment_test.yaml | Adds unit tests covering list format, map format, multiple map entries, and empty map behavior. |
| application/templates/deployment.yaml | Implements map-vs-list rendering logic for additional containers. |
| application/ci/values.yaml | Switches CI example to map format so CI exercises the new rendering path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hi @aslafy-z I made Copilot suggestions =) |
|
Oh, it looks like tests are failing now. Can you also add one to ensure containers are sorted by names ? Thank you ! |
|
Hi @aslafy-z I fixed the bug caused by copilot suggestion. unit test saved us for a bug. |
|
Perfect! Can you add that additional test ? Thank you ! |
Sure @aslafy-z! added right now |
|
Thank you for your contribution, this change is part of the v9.2.0 release. |
What
Allow
deployment.additionalContainersto be specified as a map in additionto the existing list format. When a map is provided, each key becomes the
container
name; the list format continues to work exactly as before.Why
Map-keyed values are far easier to override and patch per-container in GitOps
tools such as ArgoCD, where merging into a keyed map is deterministic while
merging into a positional list is not. This mirrors the map style already used
elsewhere in the chart (initContainers, envFrom, volumes, ...).
How
map, range the entries and merge (dict "name" $name) $container; for a
list, keep the previous rendering. Empty map/list renders no extra containers.
(list, object, null) so the generated schema validates correctly.
Tests
format (key → name), multiple map entries, and the empty-map case.
format so snapshot tests and Kind API validation exercise the new path.
Rendered output is byte-identical to the list form (snapshots unchanged).
Backwards compatibility
Fully backwards compatible — the list format is unchanged; the map format is
purely additive.