feat: allow "duplicate" kinds in the config patches#13818
Open
smira wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR relaxes config patch loading to allow duplicate documents (same apiVersion/kind/name) within a single multi-document patch, and adjusts the strategic patch interface to avoid exposing assumptions about typed provider access.
Changes:
- Add an “unvalidated” readonly container + a
WithNoValidation()configloader option to bypass duplicate/conflict validation for patch inputs. - Allow duplicates in the YAML decoder path when validation is disabled.
- Update the strategic patch interface from
Provider()toBytes()and add tests covering mixed/duplicate patch documents.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/machinery/config/container/container.go | Adds NewReadonlyUnvalidated for relaxed patch-loading containers. |
| pkg/machinery/config/configpatcher/strategic.go | Adjusts StrategicMergePatch interface and strategic merge behavior for appended docs. |
| pkg/machinery/config/configpatcher/load.go | Loads strategic patches with WithNoValidation() to allow duplicates. |
| pkg/machinery/config/configpatcher/load_test.go | Updates strategic patch assertions to use Documents()/Bytes() instead of typed provider access. |
| pkg/machinery/config/configpatcher/apply_test.go | Adds coverage for applying mixed patches (including duplicates) via both WithConfig and WithBytes. |
| pkg/machinery/config/configpatcher/testdata/patchmixed/base.yaml | New base config fixture for mixed patch test. |
| pkg/machinery/config/configpatcher/testdata/patchmixed/patch.yaml | New patch fixture containing duplicates for the same kind/name. |
| pkg/machinery/config/configpatcher/testdata/patchmixed/expected.yaml | New expected output fixture for mixed patch test. |
| pkg/machinery/config/configloader/internal/decoder/decoder.go | Adds allowDuplicates to decoding to permit duplicates when validation is disabled. |
| pkg/machinery/config/configloader/internal/decoder/decoder_test.go | Extends decoder tests to cover “allow duplicates” mode. |
| pkg/machinery/config/configloader/configloader.go | Threads noValidation through decoding and returns an unvalidated container when set. |
| pkg/machinery/config/configdiff/mergepatch_test.go | Updates tests to use the new StrategicMergePatch.Bytes() method. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This applies to a single multi-document config patch. Allow the patch documents to have duplicates across kinds/names. The config patch code was re-using the path for machine configuration loading, so allow to load skipping all validations - the patches can be pretty much relaxed compared to real machine config. Adjust patch interface to leave less assumptions on what can be done - we can either iterate over patch documents, or convert patch back to bytes. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
smira
force-pushed
the
feat/config-patch-duplicate
branch
from
July 21, 2026 16:19
be50de4 to
1a07538
Compare
frezbo
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This applies to a single multi-document config patch.
Allow the patch documents to have duplicates across kinds/names. The config patch code was re-using the path for machine configuration loading, so allow to load skipping all validations - the patches can be pretty much relaxed compared to real machine config.
Adjust patch interface to leave less assumptions on what can be done - we can either iterate over patch documents, or convert patch back to bytes.