mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
use containing API group when resolving shortname from discovery
This commit is contained in:
parent
2f4cca73af
commit
97ec47ba55
@ -115,6 +115,7 @@ func (e shortcutExpander) expandResourceShortcut(resource schema.GroupVersionRes
|
|||||||
}
|
}
|
||||||
if resource.Resource == item.ShortForm.Resource {
|
if resource.Resource == item.ShortForm.Resource {
|
||||||
resource.Resource = item.LongForm.Resource
|
resource.Resource = item.LongForm.Resource
|
||||||
|
resource.Group = item.LongForm.Group
|
||||||
return resource
|
return resource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ func TestReplaceAliases(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "hpa-priority",
|
name: "hpa-priority",
|
||||||
arg: "hpa",
|
arg: "hpa",
|
||||||
expected: schema.GroupVersionResource{Resource: "superhorizontalpodautoscalers"},
|
expected: schema.GroupVersionResource{Resource: "superhorizontalpodautoscalers", Group: "autoscaling"},
|
||||||
srvRes: []*metav1.APIResourceList{
|
srvRes: []*metav1.APIResourceList{
|
||||||
{
|
{
|
||||||
GroupVersion: "autoscaling/v1",
|
GroupVersion: "autoscaling/v1",
|
||||||
@ -68,6 +68,31 @@ func TestReplaceAliases(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "resource-override",
|
||||||
|
arg: "dpl",
|
||||||
|
expected: schema.GroupVersionResource{Resource: "deployments", Group: "foo"},
|
||||||
|
srvRes: []*metav1.APIResourceList{
|
||||||
|
{
|
||||||
|
GroupVersion: "foo/v1",
|
||||||
|
APIResources: []metav1.APIResource{
|
||||||
|
{
|
||||||
|
Name: "deployments",
|
||||||
|
ShortNames: []string{"dpl"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GroupVersion: "extension/v1beta1",
|
||||||
|
APIResources: []metav1.APIResource{
|
||||||
|
{
|
||||||
|
Name: "deployments",
|
||||||
|
ShortNames: []string{"deploy"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ds := &fakeDiscoveryClient{}
|
ds := &fakeDiscoveryClient{}
|
||||||
|
Loading…
Reference in New Issue
Block a user