-
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
[design] revise port-forwarding behaviour #4832
[design] revise port-forwarding behaviour #4832
Conversation
- `--port-forwarding` -> `--port-forward-modes` - created a table summarizing mode changes from v1.15.0 - clarified that `debug` was `skaffold debug`-related ports - added config settings to `skaffold.yaml` and global config
Codecov Report
@@ Coverage Diff @@
## master #4832 +/- ##
==========================================
+ Coverage 71.72% 71.75% +0.03%
==========================================
Files 353 355 +2
Lines 12099 12116 +17
==========================================
+ Hits 8678 8694 +16
- Misses 2775 2776 +1
Partials 646 646
Continue to review full report at Codecov.
|
> a backward-compatible manner (still under investigation). This document assumes it is | ||
> not possible. | ||
|
||
~Skaffold's `--port-forward` argument should be changed from a binary true/false option to~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove since you have a similar note above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove once I've confirmed that this can't be done.
|
||
#### skaffold.yaml | ||
|
||
We will define a new configuration block `defaults` with a single array field `portForwardModes`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this meant to be extended in the future? seems strange to add a top-level defaults
field if there's only port-related config in it. maybe we can add this in the portForward
stanza instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had been thinking that we could put other defaults in here, like default-repo
(#2317), but most of our other settings are found under the appropriate area.
The portForward
block is an array of definitions, and I didn't think of an obvious field name to tuck them under. definitions
? resources
?
portForward:
defaultModes: ["..."]
resources:
- resourceType: service
resourceName: example
Co-authored-by: Nick Kubala <nkubala@users.noreply.github.com>
|
||
#### Global config ($HOME/.skaffold/config) | ||
|
||
The global config will support a `portForwardModes` with a single array field. This can be set as a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does persisting this in the global config mean that dev
and debug
will default to it in the absence of an explicit flag for every project? I'm not sure if that's a good thing. Doesn't seem like portForwardModes
is a global (shared across projects sort of) variable like kubecontext or default repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd probably look better as a per-project default but I don't think we have that granularity yet in the global config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also be set on a per-context basis within the ~/.skaffold/config
. The global default is good for people who are adamant that they never ever want port-forwarding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it's better to preserve the defaults for every new project. There's already a way to set it globally via the generated env variable SKAFFOLD_PORT_FORWARD_MODES
. And all the other properties stored in global config inherently make sense persisted across projects. Is there any issue created by the adamant user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1564 has a few comments. At that time we forwarded all containers across all pods, so it could be confusing. With saner defaults, this shouldn't be an issue, but it is worth implementing here.
@briandealwis do you have any updates on the status of this? You mentioned here that you'll include the implementation in this PR, do you still want to keep with that idea? Or do you think we should get this proposal merged and follow up with the implementation |
I removed the section on the configuration in |
just leaving thoughts about this here (they should probably go in a separate issue):
the global config was meant to address two issues:
this is one potential set of grounding principles for whether or not we support a particular field in the global config alongside the skaffold.yaml, but we don't really have anything documented around this. I think port forwarding is a good candidate as per the first issue here, but I'm fine leaving it out of this design until we have a more robust strategy. |
I started to wonder how it would/should interact with different contexts and profiles (especially command-activated profiles) and decided it seemed too involved for now. |
Fixes: #4163
Related: #969 #1245 #1564 #2115
Description
This PR proposes to change the behaviour of Skaffold's
--port-foward
. In a nutshell:skaffold dev
defaults to enable the user-defined forwards in theskaffold.yaml
skaffold dev --port-forward
enables user-define forwards and forwards services (similar to today)skaffold dev --port-forwarding=xxx
allows selecting specific combinations of forwardsskaffold debug
defaults to enable the user-defined forwards in theskaffold.yaml
and debugging ports enabled on containersskaffold debug --port-forward
enables user-define forwards and forwards debug ports and services but does not forward container portsskaffold debug --port-forwarding=xxx
allows selecting specific combinations of forwardswhere
xxx
is one of:user
: user-defined port-forwards as defined in theskaffold.yaml
services
: service ports are forwardedpods
:containerPort
s defined on Pods and Kubernetes workload objects that have pod-specsare forwarded (Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob)
debug
: an internal strategy to forward debugging-related ports on Pods as set upfrom
skaffold debug
off
: no ports are ever forwardedUser facing changes (remove if N/A)
This change aims to be backwards compatible, particularly for the Cloud Code IDEs which use
skaffold dev --port-foward
and
skaffold debug --port-foward
.(I'll include the implementation as part of this PR.)