Skip to content

Config validate#725

Open
AleksandarSavchev wants to merge 11 commits into
gardener:mainfrom
AleksandarSavchev:config-validate
Open

Config validate#725
AleksandarSavchev wants to merge 11 commits into
gardener:mainfrom
AleksandarSavchev:config-validate

Conversation

@AleksandarSavchev
Copy link
Copy Markdown
Member

How to categorize this PR?

/kind enhancement

What this PR does / why we need it:

Adds a diki config validate command that validated the structure and content of a diki configuration file. This is useful for catching configuration errors early (e.g. in CI) before attempting a full diki run.

The command validates:

  • Provider IDs are known/registered
  • No duplicate provider IDs
  • Provider args parse correctly and required fields are present
  • Ruleset IDs+Versions are supported for each provider
  • No duplicate ruleset ID+Version combinations
  • Per-rule option type/field validation
  • Required ruleset args (e.g. shootName, projectNamespace for the garden provider)

Usage:

diki config validate config.yaml

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Added `diki config validate` command for structural and content validation of configuration files

@AleksandarSavchev AleksandarSavchev requested a review from a team as a code owner May 19, 2026 08:23
@gardener-prow gardener-prow Bot added the kind/enhancement Enhancement, improvement, extension label May 19, 2026
@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented May 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign georgibaltiev for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 19, 2026
…ad of InternalError

Validation paths returned field.InternalError for user-supplied values that
failed to parse or unmarshal, which rendered as "Internal error:" in CLI
output. Convert these to field.Invalid and propagate field.ErrorList through
ValidateRulesetConfig and ValidateProviderConfig so callers can append
errors directly without wrapping.
The previous "id/version" string concatenation could collide on the "/"
separator (e.g. id="foo", version="v1/v2" vs. id="foo/v1", version="v2").
Use a struct{ID, Version} map key so dedup is unambiguous regardless of
the contents of either field.
ValidateConfig only walked Providers; OutputConfig.MinStatus was unchecked
even though the run path errors on invalid values. Reject unknown statuses
with field.NotSupported listing the accepted set, hoist knownProviderIDs
out of the loop, and add tests covering output validation, provider id
duplication, and unknown provider ids.
@gardener-prow gardener-prow Bot added cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. and removed cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. cla: no Indicates the PR's author has not signed the cla-assistant.io CLA. labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants