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

Add back tracking of forwarded ports to avoid race condition #1780

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Mar 11, 2019

This code adds tracking of which ports we've forwarded in the port forwarder. The motivation for this is to avoid a race condition where skaffold searches for open ports for two services in a very short period of time: kubectl doesn't have enough time to forward either of the ports, so skaffold thinks the provided port is available for both services, and the first one wins while the second one is not forwarded correctly.

This also adds the pod name and the namespace to the key we're using the track forwardedPods, which fixes a potential latent issue with two containers that share the same name.

cc @briandealwis

@codecov-io
Copy link

codecov-io commented Mar 11, 2019

Codecov Report

Merging #1780 into master will decrease coverage by 0.94%.
The diff coverage is 34.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1780      +/-   ##
==========================================
- Coverage   47.06%   46.12%   -0.95%     
==========================================
  Files         130      133       +3     
  Lines        6261     6418     +157     
==========================================
+ Hits         2947     2960      +13     
- Misses       3012     3154     +142     
- Partials      302      304       +2
Impacted Files Coverage Δ
pkg/skaffold/util/port.go 0% <0%> (ø) ⬆️
pkg/skaffold/kubernetes/port_forward.go 41.9% <100%> (+0.55%) ⬆️
pkg/skaffold/plugin/builders/docker/docker.go 0% <0%> (ø)
pkg/skaffold/plugin/builders/docker/local.go 0% <0%> (ø)
pkg/skaffold/plugin/builders/docker/builder.go 14.58% <0%> (ø)
pkg/skaffold/build/local/docker.go 63.82% <0%> (+4.3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7c3f9d...90b6975. Read the comment docs.

Copy link
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

LGTM

@balopat balopat merged commit b26348d into GoogleContainerTools:master Mar 12, 2019
@nkubala nkubala deleted the port-fix branch June 12, 2019 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants