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

fix(ko): Debug port forwarding for ko:// images #7009

Merged

Conversation

halvards
Copy link
Contributor

This change ensures that images with the ko:// prefix have the dlv debug port, and other default ports, forwarded by default when running skaffold debug.

The image build process sanitizes the image name by removing the ko:// prefix and lowercasing the Go import path. This means that the built image name doesn't match the placeholder values in the Kubernetes manifest files.

This change sanitizes the image placeholder values from the Kubernetes resource files when matching with the built image names, which in turn means that Skaffold sets up port forwarding.

Fixes: #6995
Tracking: #6041

This change ensures that images with the `ko://` prefix have the `dlv`
debug port forwarded by default when running `skaffold debug`.

The image build process sanitizes the image name by removing the `ko://`
prefix and lowercasing the Go import path. This means that the built
image name doesn't match the placeholder values in the Kubernetes
manifest files.

This change sanitizes the image placeholder values from the Kubernetes
resource files when matching with the built image names, which in turn
means that Skaffold sets up port forwarding.

Fixes: GoogleContainerTools#6995
@halvards halvards requested a review from a team as a code owner January 12, 2022 08:27
@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #7009 (a0beb04) into main (290280e) will decrease coverage by 1.71%.
The diff coverage is 56.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7009      +/-   ##
==========================================
- Coverage   70.48%   68.76%   -1.72%     
==========================================
  Files         515      554      +39     
  Lines       23150    25694    +2544     
==========================================
+ Hits        16317    17669    +1352     
- Misses       5776     6824    +1048     
- Partials     1057     1201     +144     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/deploy.go 52.00% <ø> (-1.85%) ⬇️
cmd/skaffold/app/cmd/dev.go 84.61% <0.00%> (ø)
cmd/skaffold/app/cmd/render.go 36.66% <0.00%> (-4.72%) ⬇️
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/fix.go 68.85% <40.00%> (-7.62%) ⬇️
cmd/skaffold/app/cmd/lint.go 42.85% <42.85%> (ø)
cmd/skaffold/app/cmd/find_configs.go 48.88% <50.00%> (+0.24%) ⬆️
cmd/skaffold/app/skaffold.go 76.19% <70.00%> (-8.43%) ⬇️
... and 182 more

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 8cd8b69...a0beb04. Read the comment docs.

@halvards halvards added kokoro:run runs the kokoro jobs on a PR kokoro:force-run forces a kokoro re-run on a PR and removed kokoro:run runs the kokoro jobs on a PR kokoro:force-run forces a kokoro re-run on a PR labels Jan 12, 2022
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Jan 13, 2022
Copy link
Contributor

@gsquared94 gsquared94 left a comment

Choose a reason for hiding this comment

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

lgtm

@gsquared94 gsquared94 merged commit 566e9d6 into GoogleContainerTools:main Jan 14, 2022
@halvards halvards deleted the ko-prefix-debug-issue-6995 branch January 17, 2022 02:54
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.

Port forwarding does not work with ko builder
3 participants