You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Declarative Validation (KEP-5073) requires a linter for its IDL tags (e.g., +k8s:minimum). While validation-gen has some initial linting logic (e.g., for optional/required conflicts), kube-api-linter is a robust, existing tool for linting Kubernetes API types. This issue tracks leveraging kube-api-linter as the core linter for declarative validation IDL tags, aiming to replace or augment custom logic in validation-gen.
What you expected to happen:
Use kube-api-linter to:
Validate correct usage of declarative validation IDL tags based on defined rules.
Provide clear errors and potential auto-fixes for IDL tag mistakes.
Replace/augment validation-gen's current linting capabilities for these specific rules.
Ensure these linting rules are maintainable and extensible if new, similar interaction rules are defined.
To integrate, contributors need to address:
Parsing/AST Interoperability & Data Model Definition
Define and document the structured data model for IDL tags and their Go code context (field, type, source location) required by linter rules. This model must be consistent with and leverage existing Kubernetes API Conventions, including any necessary extensions or specific interpretations for IDL tag linting.
Document the mechanism for kube-api-linter to reliably access or receive this structured data, ensuring accuracy despite potential interpretation differences between gengo (used by validation-gen) and go/ast (used by kube-api-linter).
Linter Rules for Declarative Validation Tag Interactions(Additional rules may be identified as work progresses or KEP-5073 evolves.)
Conflicting Tags Rule: Implement rules to detect fields marked with mutually exclusive tags.
Dependent Tags Rule: Implement rules to ensure that if a primary tag is present, its dependent tag(s) must also be present.
+k8s:unionMember requires the field to also be marked with +k8s:optional.
Fields requirement Rule: Implement rules to ensure some tags must be present in specific fields
All pointer fields must have the +k8s:optional tag.
Configuration and Integration
Specify the configuration mechanism for enabling, disabling, and parameterizing declarative validation lint rules within kube-api-linter.
Detail the planned invocation methods (e.g., via validation-gen --lint, direct kube-api-linter CLI, golangci-lint plugin) and how lint results (errors, warnings, fixes) will be processed and reported.
Develop a strategy for integrating these linters into the Kubernetes CI/presubmit checks.
The text was updated successfully, but these errors were encountered:
The Declarative Validation (KEP-5073) requires a linter for its IDL tags (e.g.,
+k8s:minimum
). Whilevalidation-gen
has some initial linting logic (e.g., for optional/required conflicts),kube-api-linter
is a robust, existing tool for linting Kubernetes API types. This issue tracks leveragingkube-api-linter
as the core linter for declarative validation IDL tags, aiming to replace or augment custom logic invalidation-gen
.What you expected to happen:
Use
kube-api-linter
to:validation-gen
's current linting capabilities for these specific rules.To integrate, contributors need to address:
Parsing/AST Interoperability & Data Model Definition
kube-api-linter
to reliably access or receive this structured data, ensuring accuracy despite potential interpretation differences betweengengo
(used byvalidation-gen
) andgo/ast
(used bykube-api-linter
).Linter Rules for Declarative Validation Tag Interactions (Additional rules may be identified as work progresses or KEP-5073 evolves.)
+k8s:optional
and+k8s:required
Add declarative validation linting to optionalorrequired #76+k8s:required
and+default
+k8s:unionMember
requires the field to also be marked with+k8s:optional
.+k8s:optional
tag.Configuration and Integration
kube-api-linter
.validation-gen --lint
, directkube-api-linter
CLI,golangci-lint
plugin) and how lint results (errors, warnings, fixes) will be processed and reported.The text was updated successfully, but these errors were encountered: