-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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 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.)
- Conflicting Tags Rule: Implement rules to detect fields marked with mutually exclusive tags. New Linter: Generic conflictingmarkers #97
-
+k8s:optional
and+k8s:required
-
+k8s:required
and+default
-
- 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 New Linter: pointeroptional #93
- All pointer fields must have the
+k8s:optional
tag.
- All pointer fields must have the
- Conflicting Tags Rule: Implement rules to detect fields marked with mutually exclusive tags. New Linter: Generic conflictingmarkers #97
-
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
, directkube-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.
- Specify the configuration mechanism for enabling, disabling, and parameterizing declarative validation lint rules within
JoelSpeed
Metadata
Metadata
Assignees
Labels
No labels