Skip to content

feat(config): allow replacing provider lists, not only merging - #117

Open
n3rdc4ptn wants to merge 1 commit into
mainfrom
feat/replace-provider-lists
Open

feat(config): allow replacing provider lists, not only merging#117
n3rdc4ptn wants to merge 1 commit into
mainfrom
feat/replace-provider-lists

Conversation

@n3rdc4ptn

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Environment overlays could only merge into the embedded defaults, never install fewer providers. serviceProviders: [] was indistinguishable from "no override", so all four defaults always survived. There was no way to bring up an environment with zero service providers (e.g. to install a locally built one via its ServiceProvider CR instead).

  • pkg/config/environment.go: add per-section clusterProvidersMode/serviceProvidersMode/platformServicesMode (MergeMode), defaulting to merge, with opt-in replace.
  • mergeComponents: in replace mode return the overlay list wholesale, including an empty list; merge keeps the current by-name behavior.
  • Add Environment.Validate (rejects unknown modes); wire it into env apply.
  • Add ocpctl env validate --config subcommand.
  • README.md: document replace mode and env validate.
  • Tests: replace/merge mergeComponents cases, Merge replace-to-zero, omitted-mode regression, Validate cases.

Which issue(s) this PR fixes:
Fixes #116

Special notes for your reviewer:

MergeMode zero value ("") means merge, so existing configs are unaffected.

Release note:

Environment config lists (clusterProviders/serviceProviders/platformServices) can now be replaced instead of only merged, via a per-section `*Mode: replace` field. Defaults to `merge`. Adds `ocpctl env validate --config`.

Allow environment overlays to replace, not only merge, the
clusterProviders/serviceProviders/platformServices lists so an
environment can install fewer components than the embedded defaults.

- add per-section *Mode fields (merge default, replace opt-in)
- mergeComponents returns overlay wholesale in replace mode, incl. empty
- add Environment.Validate and wire it into apply
- add 'env validate --config' subcommand
- document replace mode in README

Closes #116

Signed-off-by: Moritz Marby <moritz.marby@sap.com>
@n3rdc4ptn n3rdc4ptn self-assigned this Sep 2, 2026
@n3rdc4ptn
n3rdc4ptn enabled auto-merge (squash) September 2, 2026 13:45

@ValentinGerlach ValentinGerlach left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm a bit hesitant to approve because of the increased complexity of the tool (not your code!). Maybe we should get rid of the default list of service providers. Instead, we could share a few examples of "ready to use" OpenControlPlane environments in the repo and allow users to do something like ocpctl env apply sample --config https://github.com/openmcp-project/ocpctl/raw/refs/heads/main/samples/crossplane-flux.yaml

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.

Allow environment config to replace (not only merge) the service/cluster provider lists

2 participants