fix(fn): use correct English plural for CRD name in schema fallback - #117
Merged
jbw976 merged 1 commit intoAug 18, 2026
Merged
Conversation
requireSchemas() guessed the CRD's Kubernetes object name by naively appending "s" to the Kind (e.g. AccessEntry -> accessentrys) when falling back to required_resources on Crossplane/UXP versions that predate the required_schemas capability (< v2.2). Kinds with an irregular English plural (AccessEntry -> AccessEntries, Policy -> Policies, ...) never matched any real CRD, so the resource silently looked "unavailable" and schema resolution for it fell through to the built-in-types-only resolver, producing a misleading "schema not found" error even though the CRD existed and worked fine. Use flect.Pluralize (already an indirect dependency, the same library Kubernetes codegen tooling uses) to compute the plural instead. Fixes crossplane-contrib#116 Signed-off-by: Jonasz Łasut-Balcerzak <jonasz@upbound.io>
jonasz-lasut
force-pushed
the
fix/crd-fallback-plural-name
branch
from
August 17, 2026 10:01
331068f to
5620980
Compare
jbw976
approved these changes
Aug 18, 2026
jbw976
left a comment
Member
There was a problem hiding this comment.
nice, this looks to be a simple and straightforward way to fix the issue! I had looked into using https://pkg.go.dev/k8s.io/apimachinery/pkg/api/meta#UnsafeGuessKindToResource, but that looks to have some not very robust logic for handling words ending in y, which flect seems to handle more intelligently.
I've tested with /test-examples on a v2.1 control plane and everything is passing, so this doesn't seem to introduce obvious regressions either.
Thank you @jonasz-lasut!! 🙇♂️
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.
Description of your changes
requireSchemas() guessed the CRD's Kubernetes object name by naively appending "s" to the Kind (e.g. AccessEntry -> accessentrys) when falling back to required_resources on Crossplane/UXP versions that predate the required_schemas capability (< v2.2). Kinds with an irregular English plural (AccessEntry -> AccessEntries, Policy -> Policies, ...) never matched any real CRD, so the resource silently looked "unavailable" and schema resolution for it fell through to the built-in-types-only resolver, producing a misleading "schema not found" error even though the CRD existed and worked fine.
Use flect.Pluralize (already an indirect dependency, the same library Kubernetes codegen tooling uses) to compute the plural instead.
Fixes #116
I have: