-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubernetes and Kubebuilder use different mechanisms to generate plurals #3402
Comments
It has a proposed solution in : #3408 So, I am adding triage accepted. |
There are still some discussions happening on this thread kubernetes/kube-state-metrics#2065, should we wait until the consensus is made ? |
Boiling down that thread, the overall ask is to have a de-facto way of pluralizing that helps keep the resource names consistent throughout the ecosystem. I believe using the same logic as apimachinery should allow us to achieve that. |
/assign |
We've had to extract and match plurals to avoid instances where there may be discrepancies between the expected and actual plurals. |
Enforcing a common "de-facto" standard through |
Should I take this up? @Kavinjsir @varshaprasad96 @camilamacedo86 |
Hello @camilamacedo86 It looks like code issue. Should I work on this? |
I'm -1 on this change. From an objective grammatical perspective, Kubebuilder's implementation is clearly better than apimachinery's based on the test case changes in the PR. If I'm a kubebuilder user and I see Kubebuilder generate an incorrect plural, I would expect to either notice and fix it myself OR have a reviewer notice it and ask me to fix it, thus adding friction that just gets us back to where things are now. The GoDoc for the apimachinery function says:
So "Unsafe" is in the name of the function, and "Broken" is in the GoDoc. It also admits that the function only sort of works when used outside that package. Kubebuilder is outside that package. Why would we want to use it?
But that function is unsafe and broken. Kubebuilder has been in the wild for years generating different plurals. IMO no client should ever expect to correctly resolve a resourceplural from a GVK unless they are using a REST mapper. |
+1000 for @joelanford comments On top of that as I raised concerns before it will be a significant breaking change for the users. |
What broke? What's expected?
Kubernetes uses a custom mechanism to guess and generate plurals for CRDs in https://github.com/kubernetes/apimachinery/blob/master/pkg/api/meta/restmapper.go#L126
Kubebuilder uses https://github.com/gobuffalo/flect which has its own custom set of rules.
kubebuilder/pkg/model/resource/utils.go
Line 72 in 6c11f05
Although one could argue that the method kubernetes uses is broken and not ideal, it would be great if kubebuilder could apply the same default mechanism to generate plurals so it is easier for kubernetes clients to resolve a resourceplural from a GroupVersionKind mapping.
Reproducing this issue
No response
KubeBuilder (CLI) Version
3.10.0
PROJECT version
No response
Plugin versions
No response
Other versions
No response
Extra Labels
No response
The text was updated successfully, but these errors were encountered: