Skip to content

fix(fn): use correct English plural for CRD name in schema fallback - #117

Merged
jbw976 merged 1 commit into
crossplane-contrib:mainfrom
jonasz-lasut:fix/crd-fallback-plural-name
Aug 18, 2026
Merged

fix(fn): use correct English plural for CRD name in schema fallback#117
jbw976 merged 1 commit into
crossplane-contrib:mainfrom
jonasz-lasut:fix/crd-fallback-plural-name

Conversation

@jonasz-lasut

Copy link
Copy Markdown
Contributor

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:

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
jonasz-lasut force-pushed the fix/crd-fallback-plural-name branch from 331068f to 5620980 Compare August 17, 2026 10:01

@jbw976 jbw976 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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!! 🙇‍♂️

@jbw976
jbw976 merged commit 0aa1678 into crossplane-contrib:main Aug 18, 2026
7 checks passed
@jonasz-lasut
jonasz-lasut deleted the fix/crd-fallback-plural-name branch August 18, 2026 04:09
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.

Schema not found for some CRDs

2 participants