feat(config): allow replacing provider lists, not only merging - #117
Open
n3rdc4ptn wants to merge 1 commit into
Open
feat(config): allow replacing provider lists, not only merging#117n3rdc4ptn wants to merge 1 commit into
n3rdc4ptn wants to merge 1 commit into
Conversation
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>
ValentinGerlach
left a comment
Member
There was a problem hiding this comment.
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
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.
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 itsServiceProviderCR instead).pkg/config/environment.go: add per-sectionclusterProvidersMode/serviceProvidersMode/platformServicesMode(MergeMode), defaulting tomerge, with opt-inreplace.mergeComponents: inreplacemode return the overlay list wholesale, including an empty list;mergekeeps the current by-name behavior.Environment.Validate(rejects unknown modes); wire it intoenv apply.ocpctl env validate --configsubcommand.README.md: document replace mode andenv validate.mergeComponentscases,Mergereplace-to-zero, omitted-mode regression,Validatecases.Which issue(s) this PR fixes:
Fixes #116
Special notes for your reviewer:
MergeModezero value ("") meansmerge, so existing configs are unaffected.Release note: