-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Only print port forward success message on actual success #4968
Only print port forward success message on actual success #4968
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4968 +/- ##
==========================================
- Coverage 72.34% 72.23% -0.12%
==========================================
Files 360 361 +1
Lines 12564 12657 +93
==========================================
+ Hits 9090 9143 +53
- Misses 2808 2835 +27
- Partials 666 679 +13
Continue to review full report at Codecov.
|
Looks Great! in the PR description, please add section on what was the behavior before (on master) and the new behavior for the bug you are solving.
On master, this should print On your branch, this should not happen. Use the before and after section |
@tejal29 Thanks i've updated the PR description accordingly. |
Note: |
Good point, I have just added that as well to the description. |
Fixes: #4897
Description
Added error return value for EntryForwarder, use this value to determine when to print the appropriate logs to the user on whether a port has been forwarded.
KubectlForwarder returns its error by watching the logs for
kubectl port-forward
and looking for an indication of success to a errChan that is being watched.User facing changes
If
kubectl port-forward
fails, due to a reason other than conflicting ports, on the first run this is now presented to the user. The port forwarding confirmation message now happens after container logs appear in most cases, which could result in the message being lost if the terminal is flooded with logs.Example Difference
Running
skaffold dev --port-forward
in skaffold/examples/buildpacks with the following yaml which has invalid resource "wb"Before:
Prints that the resource was successfully port forward despite not actually being valid or port forwarded
After:
Correctly prints and displays that there is an error with the name of the resource and port forwarding failed, allowing the user to correct the issue that arised and trigger another dev loop to attempt again.
Caveats
In the event that a port becomes unavailable in between the time that the port is checked and
kubectl port-forward
is run, the target behavior is as follows.The only difference here vs. before is that
Port forwarding deployment/web in namespace default, remote port 8080 -> address 127.0.0.1 port 8080
is only printed after the ports have been resolved. The case where kubectl discovers that a port is taken already seems rare though since there are two checks prior if a port is taken or not. I will be sure that the kubectl error does not surface as well but only our own message.