-
Notifications
You must be signed in to change notification settings - Fork 242
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
Improving port forwarding error handling #1839
Improving port forwarding error handling #1839
Conversation
…bols. removing unnecessary build constraints
} | ||
|
||
// KeepAlive can be used to restart the port forwarding session in the background. | ||
func (p *PortForwarder) KeepAlive(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconsidering if we even need to export this method? Seems like callers would just want to forward and stop, not have to also enable keep alive explicitly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
What is the problem that motivated these changes? They're good, but I just don't understand the wider context. |
@timraymond We leverage port forwarding in integration tests that deploy goldpinger to a kubernetes cluster, since the tests need to make assertions against responses from the API that goldpinger pods expose, and these endpoints are private to the cluster (tests are executed on a VM on a different network from the k8s cluster). Currently, if the port forwarding session dies, that error is not communicated to the ongoing test suite, and tests will eventually fail due to timeouts, leading to PR checks needing to be retried, possibly multiple times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is worth taking as-is to immediately improve the CI reliability. Tweaks like maybe removing KeepAlive
can come later 🙂
* adding error handling hook to portforwarder. documenting exported symbols. removing unnecessary build constraints * improving the port forward wrapper api
* adding error handling hook to portforwarder. documenting exported symbols. removing unnecessary build constraints * improving the port forward wrapper api
Reason for Change:
Port forwarding to a Kubernetes pod can be brittle but can be restarted if the appropriate signals are handled. This PR improves the API of the internal port forwarding wrapper
PortForwarder
to allow clients to maintain port forwarding sessions alive.Example usage:
Notes: