8000 feat(components): implement platform requirements and cluster CRD rules validation by VLukiantsev · Pull Request #593 · google/xmc · GitHub
[go: up one dir, main page]

Skip to content

feat(components): implement platform requirements and cluster CRD rules validation - #593

Merged
VLukiantsev merged 6 commits into
feat/components-linter-pass3b-matrix-rules-b548436540from
feat/components-linter-pass3-platform-b548436540
Sep 1, 2026
Merged

VLukiantsev merged 6 commits into
feat/components-linter-pass3b-matrix-rules-b548436540from
feat/components-linter-pass3-platform-b548436540

Conversation

@VLukiantsev
@VLukiantsev VLukiantsev commented Aug 25, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

Implements Pass 3: Platform Requirements & Cluster CRD Rules for the xmc-linter static validation engine. This pass validates target Kubernetes version boundaries and required Kubernetes Custom Resource Definitions (CRDs) for components specified in rules.yaml.

Key Capabilities

  • Kubernetes Version Compatibility: Validates 2-segment (1.28) and 3-segment (1.28.0) SemVer version bounds (minK8sVersion, maxK8sVersion, kubernetesVersion), enforcing that minK8sVersion <= maxK8sVersion.
  • RFC-1123 DNS Conformance for CRDs: Validates requiredCRDs naming format against RFC-1123 subdomain rules, enforcing maximum length <= 253 characters and segment lengths <= 63 characters.
  • Platform Matrix Validation: Verifies that platform rules for disabled components are safely bypassed and enforces platform constraints on active component sets.

Architectural & Security Invariants

  • Fail-Fast Configuration Validation: Detects contradictory platform version bounds (minK8sVersion > maxK8sVersion) and malformed CRD names before manifest evaluation.
  • Isolated Platform Bounds: Distinguishes Kubernetes cluster platform requirements from application-level component dependencies.

Verification & Validation Evidence

1. Bazel Unit & Coverage Test Matrix

  • Unit Tests: bazel test //cmd/xmc-linter/... //pkg/components/linter/... (PASSED)
  • Coverage: 94.1% overall line coverage (matrix.go: 95.0%)

2. Manual Testing & Live GKE Deployment Verification

  • Test Environment: Live GKE cluster ... (us-central1, Kubernetes v1.35.6-gke.1710000, CRDs: jobsets.jobset.x-k8s.io, clusterqueues.kueue.x-k8s.io, components.xmc.dev) deployed via /XMC Upgrade Environment.
  • Scenario 4.1 (Valid Platform Bounds & Live Cluster CRD 10000 Specification):
    xmc-linter -manifests-dir=scratch/manual_test/pr_593/manifests -rules-config=valid_platform_rules.yaml -output=text
    # Target K8s: >=1.28.0 <1.36.0 (Live cluster: v1.35.6)
    # Required CRDs: jobsets.jobset.x-k8s.io, clusterqueues.kueue.x-k8s.io, components.xmc.dev
    # Exit Code: 0
    # Output: All component manifests passed static validation successfully!
  • Scenario 4.2 (Inverted K8s Version Bound in Rules: min 1.38 > max 1.32):
    xmc-linter -manifests-dir=scratch/manual_test/pr_593/manifests -rules-config=invalid_k8s_version_rules.yaml -output=json
    # Exit Code: 1
    # Diagnostic: INVALID_VERSION_CONSTRAINT: "minK8sVersion \"1.38\" cannot be greater than maxK8sVersion \"1.32\" for component \"jobset\""
  • Scenario 4.3 (RFC-1123 Segment Length Violation on requiredCRDs >63 characters):
    xmc-linter -manifests-dir=scratch/manual_test/pr_593/manifests -rules-config=invalid_crd_rules.yaml -output=json
    # Exit Code: 1
    # Diagnostic: INVALID_CRD_REQUIREMENT: "invalid requiredCRD \"...\" for component \"jobset\": segment \"...\" exceeds 63 characters"

BUG=548436540
TAG=agy
CONV=75de09f1-5b4f-442c-991a-fcef20ac1c7d

@github-actions
github-actions Bot requested a review from andrzejfudro August 25, 2026 10:46
@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces platform-level integration rules to the compatibility matrix linter, allowing components to define Kubernetes version constraints and required CRDs. The review feedback highlights a mismatch in README.md where the documented YAML structure for platformRequirements does not align with the Go struct definition, which would cause decoding failures. Additionally, it is recommended to enhance CRD validation in matrix.go to ensure that configured CRD names adhere to the standard Kubernetes naming format.

Comment thread cmd/xmc-linter/README.md Resolved
Comment thread pkg/components/linter/matrix.go Resolved
@VLukiantsev
VLukiantsev marked this pull request as draft August 25, 2026 10:57
@VLukiantsev
VLukiantsev removed the request for review from andrzejfudro August 25, 2026 10:57
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 9e74d8e to 5348b2b Compare August 25, 2026 11:23
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces platform-level integration rules (platformRequirements) to the linter, enabling validation of target Kubernetes versions and required CRDs for components. The changes include configuration updates, core validation logic in matrix.go, and comprehensive unit tests. A review comment suggests making the CRD name validation more robust by splitting the CRD string into segments and ensuring each segment conforms to Kubernetes DNS label rules.

Comment thread pkg/components/linter/matrix.go Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 5348b2b to 0bbf9a5 Compare August 25, 2026 15:01
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 0bbf9a5 to 6911a31 Compare August 25, 2026 15:17
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 6911a31 to b6b51e1 Compare August 25, 2026 15:42
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from b6b51e1 to d0a5fba Compare August 26, 2026 07:41
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from d0a5fba to 0381dd2 Compare August 26, 2026 07:51
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces platform-level integration rules and validation to the static linter engine, enabling verification of Kubernetes version constraints and required CRDs for components. The reviewer suggested enhancing the CRD validation logic to fully conform to RFC-1123 DNS subdomain and label constraints by enforcing length limits of 63 characters for individual segments and 253 characters for the total CRD name.

Comment thread pkg/components/linter/matrix.go Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from c2579e6 to 31396c0 Compare August 26, 2026 08:48
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 5738e8c to ccc7148 Compare August 26, 2026 14:36
@VLukiantsev
VLukiantsev marked this pull request as ready for review August 26, 2026 15:19
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from ccc7148 to 8ececbf Compare August 26, 2026 21:44
@VLukiantsev
VLukiantsev marked this pull request as draft August 26, 2026 21:45
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from 8ececbf to e8939b1 Compare August 27, 2026 15:50
@VLukiantsev
VLukiantsev force-pushed the feat/components-linter-pass3-platform-b548436540 branch from e8939b1 to b7659bc Compare August 28, 2026 09:13
@VLukiantsev
VLukiantsev requested a review from janzak-dev August 28, 2026 12:12
@VLukiantsev
VLukiantsev marked this pull request as ready for review August 28, 2026 12:12
…es validation

Introduce PlatformRequirementConfig and PlatformIntegrationRule to rules.yaml configuration, enabling validation of component Kubernetes version constraints (minK8sVersion, maxK8sVersion, kubernetesVersion) and requiredCRDs assertions.

Fixes bug #548436540

TAG=agy
CONV=75de09f1-5b4f-442c-991a-fcef20ac1c7d
… documentation

- Update validateRequiredCRDs to validate Kubernetes CRD naming convention (<plural>.<group> with lowercase alphanumeric, '-', and '.')
- Add unit tests in matrix_test.go covering requiredCRD format validation
- Update README.md platformRequirements documentation to match []PlatformIntegrationRule Go struct

TAG=agy
BUG=548436540
…atform rules

- Enforce max total length of 253 characters for requiredCRD DNS subdomains
- Enforce max segment length of 63 characters for requiredCRD DNS labels
- Add unit tests covering RFC-1123 length bounds

Comment link: #593 (comment)

TAG=agy
…lidation functions

- Document evaluatePlatformRequirements and validatePlatformRule
- Document validateK8sVersions, validateK8sConstraint, and validateSingleRequiredCRD

BUG=548436540
TAG=agy
CONV=75de09f1-5b4f-442c-991a-fcef20ac1c7d
- Update validateK8sVersions to parse versions with semver.NewVersion
- Align with Masterminds/semver/v3 adoption across linter package

BUG=548436540
TAG=agy
CONV=75de09f1-5b4f-442c-991a-fcef20ac1c7d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0