Skip to content

[deckhouse-cli] Add noneOf and validate plugin contract module requirements#403

Open
Fkuloff wants to merge 1 commit into
mainfrom
feature/plugin-contract-noneof
Open

[deckhouse-cli] Add noneOf and validate plugin contract module requirements#403
Fkuloff wants to merge 1 commit into
mainfrom
feature/plugin-contract-noneof

Conversation

@Fkuloff

@Fkuloff Fkuloff commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the noneOf module-requirements bucket to the plugin contract and brings the
requirements.modules shape to parity with the package.yaml contract in
deckhouse-controller.

Before this the CLI had mandatory / conditional / anyOf (no noneOf), its groups
carried only a description (no name), and the contract was never validated. Now:

  • noneOf bucket (forbidden module dependencies) alongside anyOf — parsed, serialized,
    and enforced. A noneOf group lists modules that must NOT be enabled; a member
    constraint narrows the forbidden version range, an empty constraint forbids any version.
  • anyOf and noneOf share a single ModuleGroup type (like the controller's
    PackageModuleGroup), with a required name.
  • ContractToDomain now validates the requirement groups, mirroring the controller's
    buildModuleGroups + validateBucketCollisions (unique non-empty group name, at least
    one 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.
  • Enforcement: checkNoneOfModules, symmetric to checkAnyOfModules, blocks
    install/update when a forbidden module is enabled within its forbidden version range.
    Wired into validateModuleRequirement and HasClusterRequirements.

Testing

gofmt, go build, go vet, and go test pass. Coverage: contract parsing
(TestPluginContract_V2FieldsParsed), DTO → domain conversion
(TestContractToDomain_CarriesModuleGroups), requirement validation with per-rule error
assertions (TestContractToDomain_RejectsInvalidGroups), the cluster-check gate
(TestHasClusterRequirements), and noneOf enforcement
(TestValidateModuleRequirementNoneOf*).

@Fkuloff Fkuloff requested a review from ldmonster as a code owner July 13, 2026 15:10
@Fkuloff Fkuloff marked this pull request as draft July 13, 2026 15:32
@Fkuloff Fkuloff self-assigned this Jul 13, 2026
@Fkuloff Fkuloff added the enhancement New feature or request label Jul 14, 2026
@Fkuloff Fkuloff marked this pull request as ready for review July 14, 2026 08:50
@Fkuloff Fkuloff changed the title [deckhouse-cli] Add noneOf module requirements group to plugin contract [deckhouse-cli] Add noneOf and validate plugin contract module requirements Jul 14, 2026
@Fkuloff Fkuloff marked this pull request as draft July 14, 2026 10:07
@Fkuloff Fkuloff marked this pull request as ready for review July 14, 2026 10:48
…ements

Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
@Fkuloff Fkuloff force-pushed the feature/plugin-contract-noneof branch from cfa13f6 to 0e97b8b Compare July 14, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant