Skip to content

validate: Recognize Kubernetes built-in resources#197

Open
ihopenre-eng wants to merge 1 commit into
crossplane:mainfrom
ihopenre-eng:fix/validate-kubernetes-builtins
Open

validate: Recognize Kubernetes built-in resources#197
ihopenre-eng wants to merge 1 commit into
crossplane:mainfrom
ihopenre-eng:fix/validate-kubernetes-builtins

Conversation

@ihopenre-eng

@ihopenre-eng ihopenre-eng commented Jul 16, 2026

Copy link
Copy Markdown

Description of your changes

crossplane resource validate currently reports built-in Kubernetes resources as missing schemas because it only looks for matching CRD/XRD schemas.

This change falls back to the canonical client-go Kubernetes scheme when custom schema lookup misses. Recognized built-in GVKs are treated as valid, while unknown custom GVKs continue to report missingSchema. Regression coverage includes both a core v1/Secret and an apps/v1/Deployment.

Fixes #195

Validation

  • go test ./pkg/validate -count=1
  • All cmd/crossplane/validate tests except the upstream Windows-only TestLocalCacheExists/DoesNotExist fixture
  • go vet ./pkg/validate
  • golangci-lint run --no-config ./pkg/validate/... (0 issues)
  • git diff --check

TestLocalCacheExists/DoesNotExist fails on Windows because its expected path uses /; the same failure reproduces at clean upstream commit 5342ad7. Nix is unavailable locally, and the repository's pinned golangci-lint 2.11.4 rejects the current .golangci.yml because goconst.ignore-tests is no longer supported.

I have:

Summary by CodeRabbit

  • Bug Fixes
    • Built-in Kubernetes resources are now recognized as valid even when no custom schema is available.
    • Resources without schemas continue to be reported as missing schemas when they are not recognized by Kubernetes.

Signed-off-by: ihopenre-eng <247072151+ihopenre-eng@users.noreply.github.com>
@ihopenre-eng
ihopenre-eng requested review from a team, jcogilvie and tampakrap as code owners July 16, 2026 10:05
@ihopenre-eng
ihopenre-eng requested review from negz and removed request for a team July 16, 2026 10:05
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f87fceb-4ce0-4927-9aab-abc3d377c761

📥 Commits

Reviewing files that changed from the base of the PR and between 5342ad7 and b1a3de7.

📒 Files selected for processing (2)
  • pkg/validate/validate.go
  • pkg/validate/validate_test.go

📝 Walkthrough

Walkthrough

Built-in Kubernetes resources recognized by the client scheme now validate as valid without CRD schemas. Tests cover core Secret and apps/v1 Deployment resources.

Changes

Built-in resource validation

Layer / File(s) Summary
Recognize built-in resource kinds
pkg/validate/validate.go
Validation uses the Kubernetes client scheme to mark recognized GVKs as valid and retains missing-schema handling for unrecognized kinds.
Validate built-in resource fixtures
pkg/validate/validate_test.go
Adds Secret and Deployment fixtures and verifies valid aggregate and per-resource results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jcogilvie

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: recognizing Kubernetes built-in resources during validation.
Linked Issues check ✅ Passed The change addresses #195 by treating recognized built-in resources like Secret and Deployment as valid instead of missing schema.
Out of Scope Changes check ✅ Passed The diff is tightly scoped to built-in resource recognition and regression tests, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

crossplane resource validate: could not find CRD/XRD for: v1

1 participant