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

fix: CRD loading: trim group suffix from CRD name #3045

Merged
merged 3 commits into from
Feb 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/dao/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ func loadCRDs(f Factory, m ResourceMetas) {
var meta metav1.APIResource
meta.Kind = crd.Spec.Names.Kind
meta.Group = crd.Spec.Group
// Since CRD names are cluster scoped they need to be unique, however, it is allowed
// to have the CRDs with the same names in different groups. Because of that, the
// returned `crd.Name` values have the group as a suffix, for example
// "ciliumnetworkpolicies.cilium.io".
//
// `Name` field of `meta/v1/APIResource` is supposed to be the plural name of the
// resource, without the group. Because of that we need to trim the group suffix.
meta.Name = strings.TrimSuffix(crd.Name, "."+meta.Group)

meta.SingularName = crd.Spec.Names.Singular
Expand Down
Loading