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

Handle port forwarding rules in sequence #4053

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/skaffold/kubernetes/portforward/resource_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ func (p *ResourceForwarder) Start(ctx context.Context) error {

// Port forward each resource individually in a goroutine
func (p *ResourceForwarder) portForwardResources(ctx context.Context, resources []*latest.PortForwardResource) {
for _, r := range resources {
r := r
go func() {
go func() {
Copy link
Contributor

@tejal29 tejal29 Apr 29, 2020

Choose a reason for hiding this comment

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

Not sure, if we are slowing down skaffold portforward phase due to sequentially forwarding resources.

Other alternative would be at L63, we first port forward uderDefinedResources in parallel. Wait for it to complete and then portforward serviceResources.

I don't mind this approach either "Correctness Vs Performance"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the idea @tejal29. You know what, let's go with correctness and if we have an issue, we'll improve the perf.

for _, r := range resources {
p.portForwardResource(ctx, *r)
}()
}
}
}()
}

func (p *ResourceForwarder) portForwardResource(ctx context.Context, resource latest.PortForwardResource) {
Expand Down