Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exec.StreamWithContext to replace ExecInPodWithTTY and CtrlCReader #1276

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Dec 7, 2022

See commits for details

@tklauser tklauser added the dont-merge/preview-only Only for preview or testing, don't merge it. label Dec 7, 2022
@tklauser tklauser temporarily deployed to ci December 7, 2022 14:46 — with GitHub Actions Inactive
@tklauser tklauser force-pushed the pr/tklauser/cilium-k8s-bump branch from 7fe4a61 to ed2cbe2 Compare December 9, 2022 14:22
@tklauser tklauser temporarily deployed to ci December 9, 2022 14:22 — with GitHub Actions Inactive
@tklauser tklauser changed the title WIP: use exec.StreamWithContext to replace ExecInPodWithTTY and CtrlCReader Use exec.StreamWithContext to replace ExecInPodWithTTY and CtrlCReader Dec 9, 2022
@tklauser tklauser removed the dont-merge/preview-only Only for preview or testing, don't merge it. label Dec 9, 2022
@tklauser tklauser marked this pull request as ready for review December 9, 2022 15:55
@tklauser tklauser requested review from a team as code owners December 9, 2022 15:55
@tklauser tklauser requested review from rolinh and squeed December 9, 2022 15:55
@@ -7,7 +7,6 @@ replace (
github.com/miekg/dns => github.com/cilium/dns v1.1.4-0.20190417235132-8e25ec9a0ff3
github.com/optiopay/kafka => github.com/cilium/kafka v0.0.0-20180809090225-01ce283b732b
go.universe.tf/metallb => github.com/cilium/metallb v0.1.1-0.20220829170633-5d7dfb1129f7
k8s.io/client-go => github.com/cilium/client-go v0.0.0-20220819140146-d9df1ee1f047
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Please, keep removing these replace directives ❤️

Copy link
Contributor

@squeed squeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Dec 12, 2022
This allows to drop the replace directive as well, see
cilium/cilium#22547 for details.

Signed-off-by: Tobias Klauser <[email protected]>
exec.Stream is deprecated. Use exec.StreamWithContext to avoid possible
resource leaks.

Signed-off-by: Tobias Klauser <[email protected]>
Setting TTY/stdin in PodExecOptions seems to lead to all kinds issues,
which are hard to debug (see e.g. [1]). Also, stdout and stderr are
combined which might make it hard to parse command output.

[1] https://discuss.kubernetes.io/t/go-client-exec-ing-a-shel-command-in-pod/5354

The only reason the code was using TTY/stdin is to cancel commands by
sending Ctrl-C on context cancellation. Now that we're using
exec.StreamWithContext, there is no need for that anymore.

Signed-off-by: Tobias Klauser <[email protected]>
@tklauser tklauser force-pushed the pr/tklauser/cilium-k8s-bump branch from ed2cbe2 to 226fea2 Compare December 12, 2022 10:07
@tklauser tklauser temporarily deployed to ci December 12, 2022 10:07 — with GitHub Actions Inactive
@tklauser tklauser merged commit 30310b1 into master Dec 12, 2022
@tklauser tklauser deleted the pr/tklauser/cilium-k8s-bump branch December 12, 2022 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants