[deckhouse-cli] Add noneOf and validate plugin contract module requirements#403
Open
Fkuloff wants to merge 1 commit into
Open
[deckhouse-cli] Add noneOf and validate plugin contract module requirements#403Fkuloff wants to merge 1 commit into
Fkuloff wants to merge 1 commit into
Conversation
…ements Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
cfa13f6 to
0e97b8b
Compare
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.
Description
Adds the
noneOfmodule-requirements bucket to the plugin contract and brings therequirements.modulesshape to parity with thepackage.yamlcontract indeckhouse-controller.
Before this the CLI had
mandatory/conditional/anyOf(nononeOf), its groupscarried only a
description(noname), and the contract was never validated. Now:noneOfbucket (forbidden module dependencies) alongsideanyOf— parsed, serialized,and enforced. A
noneOfgroup lists modules that must NOT be enabled; a memberconstraint narrows the forbidden version range, an empty constraint forbids any version.
anyOfandnoneOfshare a singleModuleGrouptype (like the controller'sPackageModuleGroup), with a requiredname.ContractToDomainnow validates the requirement groups, mirroring the controller'sbuildModuleGroups+validateBucketCollisions(unique non-empty group name, at leastone member, unique members, valid constraints, no module in contradictory buckets), and
returns an error so an ill-formed contract is rejected instead of loading silently.
checkNoneOfModules, symmetric tocheckAnyOfModules, blocksinstall/update when a forbidden module is enabled within its forbidden version range.
Wired into
validateModuleRequirementandHasClusterRequirements.Testing
gofmt,go build,go vet, andgo testpass. Coverage: contract parsing(
TestPluginContract_V2FieldsParsed), DTO → domain conversion(
TestContractToDomain_CarriesModuleGroups), requirement validation with per-rule errorassertions (
TestContractToDomain_RejectsInvalidGroups), the cluster-check gate(
TestHasClusterRequirements), andnoneOfenforcement(
TestValidateModuleRequirementNoneOf*).