Skip to content

feat: allow "duplicate" kinds in the config patches#13818

Open
smira wants to merge 1 commit into
siderolabs:mainfrom
smira:feat/config-patch-duplicate
Open

feat: allow "duplicate" kinds in the config patches#13818
smira wants to merge 1 commit into
siderolabs:mainfrom
smira:feat/config-patch-duplicate

Conversation

@smira

@smira smira commented Jul 21, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings July 21, 2026 16:00
@github-project-automation github-project-automation Bot moved this to To Do in Planning Jul 21, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 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() to Bytes() 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.

Comment thread pkg/machinery/config/configpatcher/strategic.go Outdated
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
smira force-pushed the feat/config-patch-duplicate branch from be50de4 to 1a07538 Compare July 21, 2026 16:19
@github-project-automation github-project-automation Bot moved this from In Review to Approved in Planning Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

4 participants