Fix CRD processing to use served version instead of first version#508
Merged
Fix CRD processing to use served version instead of first version#508
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #508 +/- ##
==========================================
+ Coverage 44.02% 44.55% +0.52%
==========================================
Files 67 67
Lines 4502 4514 +12
==========================================
+ Hits 1982 2011 +29
+ Misses 2248 2222 -26
- Partials 272 281 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: yonahd <47282577+yonahd@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failure to process CRDs in kor
Fix CRD processing to use served version instead of first version
Oct 13, 2025
…and check for instances.
yonahd
approved these changes
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
kor crdcommand was failing with the error "the server could not find the requested resource" on systems with certain CRD configurations, particularly when CRDs have multiple versions where the first version is not served.Root Cause
The code in
processCrds()was incorrectly usingcrd.Spec.Versions[0].Nameto determine which API version to query for CRD instances. This caused two issues:Served: false, meaning it's not available via the API serverFor example, a CRD might be defined as:
Solution
This PR fixes the issue by:
crd.Spec.Versionsto find a version whereServed: trueChanges
processCrds()inpkg/kor/crds.goto properly select served versionsTestProcessCrds()inpkg/kor/crds_test.goto verify the fix with multiple test scenariosTesting
The new test validates:
All existing tests continue to pass.
Fixes #[issue_number]
Original prompt
Fixes #503
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.