sysdump: don't rely on timeout command to collect hubble flows #38999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, hubble flows collection in sysdumps relies on the timeout command to set an upper bound on the maximum retrieval time. This is mostly due to historical reasons, as hubble flows used to be collected using the --follow flag. Yet, that is no longer the case since [1], even though the timeout was kept as a safety measure.
Let's slightly rework this logic to specify the timeout via the context, rather than relying on the timeout command, to avoid requiring it to be present in the target Cilium agent image. We don't use the so-called kill context here, because that would set tty, which in turn coalescences the stdout and stderr streams together [2], which is undesired.
While being there, let's also drop the bash indirection, and directly invoke the hubble binary.
[1]: cfc594f ("sysdump: don't specify --follow while collecting hubble flows")
[2]:
cilium/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go
Lines 44 to 49 in 21a15af