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 --port-forward to skaffold run #3263

Merged
merged 3 commits into from
Dec 20, 2019
Merged

Add --port-forward to skaffold run #3263

merged 3 commits into from
Dec 20, 2019

Conversation

oke-py
Copy link
Contributor

@oke-py oke-py commented Nov 17, 2019

Fixes #2949

Description

Add --port-forward to skaffold run. See more details in #2949

User facing changes

Before
No --port-forward to skaffold run

After
Add --port-forward to skaffold run

Next PRs.
n/a

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Mentions any output changes.
  • Adds documentation as needed: user docs, YAML reference, CLI reference.
  • Adds integration tests if needed.

Reviewer Notes

  • The code flow looks good.
  • Unit test added.
  • User facing changes look good.

Release Notes

Add --port-forward to skaffold run

@codecov
Copy link

codecov bot commented Nov 17, 2019

Codecov Report

Merging #3263 into master will increase coverage by 0.15%.
The diff coverage is 7.69%.

Impacted Files Coverage Δ
cmd/skaffold/app/cmd/flags.go 100% <ø> (ø) ⬆️
pkg/skaffold/runner/build_deploy.go 57.33% <7.69%> (-5.91%) ⬇️
pkg/skaffold/schema/latest/config.go 100% <0%> (ø) ⬆️
pkg/skaffold/build/buildpacks/init.go 90.9% <0%> (ø)
pkg/skaffold/build/cluster/sources/sources.go 91.89% <0%> (+0.3%) ⬆️
pkg/skaffold/initializer/init.go 60.73% <0%> (+0.99%) ⬆️
cmd/skaffold/app/cmd/init.go 57.69% <0%> (+1.17%) ⬆️
pkg/skaffold/debug/debug.go 46.66% <0%> (+3.33%) ⬆️
pkg/skaffold/deploy/status_check.go 67.69% <0%> (+11.55%) ⬆️

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

This looks good but we will need to add an integration test for this.
For example you could create a testcase based on TestPortForwardDeletePod with skaffold.Run instead skaffold.Dev on line 83 (maybe we don't need the whole deletion testing for Run).

@oke-py
Copy link
Contributor Author

oke-py commented Dec 18, 2019

I'll try it.

@balopat balopat added the kokoro:run runs the kokoro jobs on a PR label Dec 18, 2019
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Dec 18, 2019
@@ -55,10 +55,28 @@ func TestPortForward(t *testing.T) {
portforward.WhiteBoxPortForwardCycle(t, kubectlCLI, ns.Name)
}

// TestPortForwardDeletePod tests that port forwarding works
func TestRunPortForwardDeletePod(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is not deleting so we can remove the Delete from the name

ns, _, deleteNs := SetupNamespace(t)
defer deleteNs()

stop := skaffold.Run("--port-forward").InDir("examples/microservices").InNs(ns.Name).RunBackground(t)
Copy link
Contributor

@balopat balopat Dec 18, 2019

Choose a reason for hiding this comment

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

you'll need to add some more flags to enable the API server: e.g. --rpc-port 50051 --enable-rpc=true - but I'd rather you use a random port like in the other test. - this is why the integration test is failing!

@oke-py oke-py requested a review from balopat December 19, 2019 04:11
@oke-py
Copy link
Contributor Author

oke-py commented Dec 19, 2019

@balopat Tests passed. Thanks for your advice!

@balopat balopat added the kokoro:run runs the kokoro jobs on a PR label Dec 19, 2019
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Dec 19, 2019
@balopat balopat merged commit 85db2aa into GoogleContainerTools:master Dec 20, 2019
@oke-py oke-py deleted the run-port-forward branch December 20, 2019 11:16
dgageot added a commit to dgageot/skaffold that referenced this pull request Dec 20, 2019
It seems that GoogleContainerTools#3263 makes `skaffold run` freeze
when port forwarding in on.

This reverts commit 647b3c3.
This reverts commit 2fbed4e.
This reverts commit 0abb700.

Signed-off-by: David Gageot <david@gageot.net>
@tvvignesh
Copy link
Contributor

Hi. I noticed that this was released in v1.1.0 but tested it in Ubuntu 19.10 with latest binary but it does not seem to work. Screenshot below.

Screenshot from 2019-12-27 04-18-34

@nkubala
Copy link
Contributor

nkubala commented Jan 8, 2020

@tvvignesh we decided to revert this PR for now. the behavior was non-intuitive as the process would hang after completing the deployment and forwarding the port, making it feel like it was frozen. see #3415 for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add port forwarding to skaffold run
6 participants