Skip to content
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

Open
mrueg opened this issue May 10, 2023 · 9 comments · May be fixed by #3433
Open

Kubernetes and Kubebuilder use different mechanisms to generate plurals #3402

mrueg opened this issue May 10, 2023 · 9 comments · May be fixed by #3433
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@mrueg
Copy link
Member

mrueg commented May 10, 2023

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.

return flect.Pluralize(strings.ToLower(singular))

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

@camilamacedo86
Copy link
Member

camilamacedo86 commented May 23, 2023

It has a proposed solution in : #3408
It seems very reasonable ask.

So, I am adding triage accepted.

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels May 23, 2023
@lauchokyip
Copy link
Contributor

There are still some discussions happening on this thread kubernetes/kube-state-metrics#2065, should we wait until the consensus is made ?

@rexagod
Copy link
Member

rexagod commented May 27, 2023

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.

@lauchokyip
Copy link
Contributor

/assign

@Kavinjsir
Copy link
Contributor

Hey @mrueg @rexagod , would you provide some cases/code snippets that come with such an attempt to make the plural consistent? I'm trying to understand how the consistent plural system can help kubernetes clients to resolve a resourceplural from a GroupVersionKind mapping.

@rexagod
Copy link
Member

rexagod commented May 31, 2023

We've had to extract and match plurals to avoid instances where there may be discrepancies between the expected and actual plurals.

@rexagod
Copy link
Member

rexagod commented May 31, 2023

Enforcing a common "de-facto" standard through kubebuilder will solve such cases to a great extent.

@ashutosh887
Copy link
Contributor

Should I take this up? @Kavinjsir @varshaprasad96 @camilamacedo86

@Sajiyah-Salat
Copy link
Contributor

Hello @camilamacedo86 It looks like code issue. Should I work on this?
I have gone through the pr. understood somewhat maybe. I would give it a try if possibe.
If there is anything else I should know or refer to let me know.

@camilamacedo86 camilamacedo86 removed the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Nov 14, 2023
@camilamacedo86 camilamacedo86 added this to the priority milestone Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
7 participants