From cf8aed98ebfd6c4d0b83bcdc839e0834d39d2e12 Mon Sep 17 00:00:00 2001 From: Ondra Kupka Date: Mon, 4 Aug 2025 22:48:57 +0200 Subject: [PATCH] cli-runtime: Return defined error from Builder There is a custom error message returned from resource.Builder when SingleResourceType is set and multiple resources types are specified, which makes it impossible to check for the condition in code easily. This patch adds resource.ErrMultipleResourceTypes that is returned precisely in this case so that it can be checked. This patch also removes an extra custom error message in kubectl get, which is actually never reached, because the builder fails before. Kubernetes-commit: 82896feebbdf1c0809c0fec29988eff15cb02837 --- pkg/cmd/get/get.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/cmd/get/get.go b/pkg/cmd/get/get.go index 5509158a7..00b991e6e 100644 --- a/pkg/cmd/get/get.go +++ b/pkg/cmd/get/get.go @@ -629,9 +629,6 @@ func (o *GetOptions) watch(f cmdutil.Factory, args []string) error { } return err } - if multipleGVKsRequested(infos) { - return i18n.Errorf("watch is only supported on individual resources and resource collections - more than 1 resource was found") - } info := infos[0] mapping := info.ResourceMapping()