mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #18627 from caesarxuchao/oneline-fix
Auto commit by PR queue bot
This commit is contained in:
commit
649855128d
@ -175,16 +175,12 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
|||||||
return clients.ClientConfigForVersion(nil)
|
return clients.ClientConfigForVersion(nil)
|
||||||
},
|
},
|
||||||
RESTClient: func(mapping *meta.RESTMapping) (resource.RESTClient, error) {
|
RESTClient: func(mapping *meta.RESTMapping) (resource.RESTClient, error) {
|
||||||
gvk, err := api.RESTMapper.KindFor(mapping.Resource)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
mappingVersion := mapping.GroupVersionKind.GroupVersion()
|
mappingVersion := mapping.GroupVersionKind.GroupVersion()
|
||||||
client, err := clients.ClientForVersion(&mappingVersion)
|
client, err := clients.ClientForVersion(&mappingVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
switch gvk.Group {
|
switch mapping.GroupVersionKind.Group {
|
||||||
case api.GroupName:
|
case api.GroupName:
|
||||||
return client.RESTClient, nil
|
return client.RESTClient, nil
|
||||||
case extensions.GroupName:
|
case extensions.GroupName:
|
||||||
|
@ -538,7 +538,7 @@ func (b *Builder) visitorResult() *Result {
|
|||||||
}
|
}
|
||||||
clients := make(map[string]RESTClient)
|
clients := make(map[string]RESTClient)
|
||||||
for _, mapping := range mappings {
|
for _, mapping := range mappings {
|
||||||
s := fmt.Sprintf("%s/%s", mapping.APIVersion, mapping.Resource)
|
s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource)
|
||||||
if _, ok := clients[s]; ok {
|
if _, ok := clients[s]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ func (b *Builder) visitorResult() *Result {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return &Result{singular: isSingular, err: fmt.Errorf("resource %q is not recognized: %v", tuple.Resource, mappings)}
|
return &Result{singular: isSingular, err: fmt.Errorf("resource %q is not recognized: %v", tuple.Resource, mappings)}
|
||||||
}
|
}
|
||||||
s := fmt.Sprintf("%s/%s", mapping.APIVersion, mapping.Resource)
|
s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource)
|
||||||
client, ok := clients[s]
|
client, ok := clients[s]
|
||||||
if !ok {
|
if !ok {
|
||||||
return &Result{singular: isSingular, err: fmt.Errorf("could not find a client for resource %q", tuple.Resource)}
|
return &Result{singular: isSingular, err: fmt.Errorf("could not find a client for resource %q", tuple.Resource)}
|
||||||
|
Loading…
Reference in New Issue
Block a user