mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Merge pull request #37636 from juanvallejo/jvallejo/bugfix/print-resource-kind-when-single-resource-type
Automatic merge from submit-queue add resource prefix to multiple items w/ same kind **Release note**: ```release-note release-note-none ``` This patch ensures that a resource prefix is added to multiple items of the same kind, when using `kubectl get all`. Before, a prefix was added only when a single item was returned on `kubectl get all`, but ignored if only a single resource kind existed but multiple items for that kind were returned. **Example** ``` $ kubectl get all No resources found. $ kubectl create service loadbalancer testsvc1 --tcp=8080 $ kubectl get all NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE svc/testsvc1 172.30.119.220 172.46.100.155,172.46.100.155 8080/TCP 1h $ kubectl create service loadbalancer testsvc2 --tcp=8081 $ kubectl get all NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE svc/testsvc1 172.30.119.220 172.46.100.155,172.46.100.155 8080/TCP 1h svc/testsvc2 172.30.241.197 172.46.164.158,172.46.164.158 8081/TCP 1h ``` @fabianofranz
This commit is contained in:
@@ -629,13 +629,9 @@ func MaybeConvertObject(obj runtime.Object, gv schema.GroupVersion, converter ru
|
||||
// with multiple resource kinds, in which case it will
|
||||
// return true, indicating resource kind will be
|
||||
// included as part of printer output
|
||||
func MustPrintWithKinds(objs []runtime.Object, infos []*resource.Info, sorter *kubectl.RuntimeSort, printAll bool) bool {
|
||||
func MustPrintWithKinds(objs []runtime.Object, infos []*resource.Info, sorter *kubectl.RuntimeSort) bool {
|
||||
var lastMap *meta.RESTMapping
|
||||
|
||||
if len(infos) == 1 && printAll {
|
||||
return true
|
||||
}
|
||||
|
||||
for ix := range objs {
|
||||
var mapping *meta.RESTMapping
|
||||
if sorter != nil {
|
||||
|
||||
Reference in New Issue
Block a user