Skip to content

Commit 48d2a6d

Browse files
Merge pull request #18514 from juanvallejo/jvallejo/handle-watch-multiple-reqs
Automatic merge from submit-queue. UPSTREAM: 59506: fix watch on multiple reqs Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1537789 `oc get <resource> --watch` only supports watching a single resource kind at a time. This check fails if more than one resource `Info` is returned. When dealing with large quantities of a single resource kind, or an amount that exceeds the value of `--chunk-size`, more than one request is made to the server causing a resource `Info` to be created for each of the requests, ultimately causing the above check to fail even though we are dealing with the same type of resource. This patch modifies that check to take into account the GVKs of all infos returned, and only fail if at least one differs. cc @deads2k @jeremyeder
2 parents fd83080 + 170d39f commit 48d2a6d

File tree

2 files changed

+25
-3
lines changed
  • test/cmd
  • vendor/k8s.io/kubernetes/pkg/kubectl/cmd/resource

2 files changed

+25
-3
lines changed

test/cmd/get.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,11 @@ os::cmd::expect_success_and_not_text 'oc get users test-user-1' "customlabel=tru
3737
# test structured and unstructured resources print generically without panic
3838
os::cmd::expect_success_and_text 'oc get projectrequests -o yaml' 'status: Success'
3939
os::cmd::expect_success_and_text 'oc get projectrequests,svc,pod -o yaml' 'kind: List'
40+
# test --wacth does not result in an error when a resource list is served in multiple chunks
41+
os::cmd::expect_success 'oc create cm cmone'
42+
os::cmd::expect_success 'oc create cm cmtwo'
43+
os::cmd::expect_success 'oc create cm cmthree'
44+
os::cmd::expect_success_and_not_text 'oc get configmap --chunk-size=1 --watch --request-timeout=1s' 'watch is only supported on individual resources'
45+
os::cmd::expect_success_and_not_text 'oc get configmap --chunk-size=1 --watch-only --request-timeout=1s' 'watch is only supported on individual resources'
4046
echo "oc get: ok"
4147
os::test::junit::declare_suite_end

vendor/k8s.io/kubernetes/pkg/kubectl/cmd/resource/get.go

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)