GoogleContainerTools / GoogleContainerTools/skaffold
`debug` should use existing containerPort definitions in selecting debug port
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
`debug` currently selects a port that is as close to the default used by each language runtime's debugger. We should examine the container's `containerPort`s for an existing definition and use that port if found.
. The Kubernetes API defines the [`containerPort.name`](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerport-v1-core) as being `IANA_SVC_NAME`, and must be unique within the pod. A service name is defined in [RFC 6335](https://tools.ietf.org/html/rfc6335#section-5.1) as:
> Valid service names are hereby normatively defined as follows:
> - MUST be at least 1 character and no more than 15 characters long
> - MUST contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and 'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45)
> - MUST contain at least one letter ('A' - 'Z' or 'a' - 'z')
> - MUST NOT begin or end with a hyphen
> - hyphens MUST NOT be adjacent to other hyphens
As containers within a pod must have unique port names, we should use the debug protocol as a prefix (e.g., look for something matching `jdwp(-.+)?`).
Motivated by discsussion in #4419.
Contributor guide
Assessment
This issue has not been assessed yet.