mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-30 22:35:10 +00:00
use specified discovery information if possible
Kubernetes-commit: 1c8a9e406054e4163b8c81176f14478272ebf767
This commit is contained in:
parent
06d5d62599
commit
cecfce38a7
@ -96,8 +96,19 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||||||
if !resource.Namespaced {
|
if !resource.Namespaced {
|
||||||
scope = meta.RESTScopeRoot
|
scope = meta.RESTScopeRoot
|
||||||
}
|
}
|
||||||
versionMapper.Add(gv.WithKind(resource.Kind), scope)
|
|
||||||
// TODO only do this if it supports listing
|
// this is for legacy resources and servers which don't list singular forms. For those we must still guess.
|
||||||
|
if len(resource.SingularName) == 0 {
|
||||||
|
versionMapper.Add(gv.WithKind(resource.Kind), scope)
|
||||||
|
// TODO this is producing unsafe guesses that don't actually work, but it matches previous behavior
|
||||||
|
versionMapper.Add(gv.WithKind(resource.Kind+"List"), scope)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
plural := gv.WithResource(resource.Name)
|
||||||
|
singular := gv.WithResource(resource.SingularName)
|
||||||
|
versionMapper.AddSpecific(gv.WithKind(resource.Kind), plural, singular, scope)
|
||||||
|
// TODO this is producing unsafe guesses that don't actually work, but it matches previous behavior
|
||||||
versionMapper.Add(gv.WithKind(resource.Kind+"List"), scope)
|
versionMapper.Add(gv.WithKind(resource.Kind+"List"), scope)
|
||||||
}
|
}
|
||||||
// TODO why is this type not in discovery (at least for "v1")
|
// TODO why is this type not in discovery (at least for "v1")
|
||||||
|
Loading…
Reference in New Issue
Block a user