-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat: automatic port forwarding for deployed services #1052
Conversation
@@ -241,11 +241,11 @@ export async function syncToService( | |||
targetName: string, | |||
log: LogEntry, | |||
) { | |||
const targetDeployment = `${targetKind.toLowerCase()}/${targetName}` | |||
const targetResource = `${targetKind.toLowerCase()}/${targetName}` |
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 the block comment above this function (since we're now relying on a general port-forward cache that's used for more than just hot reloading).
import { isBuiltIn } from "./util" | ||
import { LogEntry } from "../../logger/log-entry" | ||
|
||
// TODO: implement stopPortForward handler |
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.
Should we add a brief high-level comment here? Maybe something like:
Maintains a simple in-process cache of randomly allocated local ports that have been port-forwarded to a given port on a given Kubernetes resource. This removes the need for the user to manually establish port-forwards for e.g. services defined in Garden config files.
garden-service/src/types/service.ts
Outdated
.required() | ||
.description("The target port on the service."), | ||
urlProtocol: joi.string() | ||
.description("The protocol to use for URLs pointing at the port. This can be valid URI protocol."), |
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.
"This can be" -> "This can be any"
2641015
to
7fc64ec
Compare
This adds a built-in TCP proxy for long-running Garden processes, that immediately opens a port for each forwardable service port (as specified by providers) and creates a tunnel on-demand when the port is accessed. This should work for any TCP port, and is implemented here for the kubernetes provider, but the proxy itself could be implemented for other providers through the fairly simple `getPortForward` handler interface. Unlike kubefwd, for example, this implementation avoids any need to mess with domain names or host files (and by extension running as root) since a random free port is assigned directly on localhost. The tunnels are only created when a connection is first made, and are then kept alive while the Garden agent is running. Closes #967
7fc64ec
to
43b414f
Compare
This adds a built-in TCP proxy for long-running Garden processes,
that immediately opens a port for each forwardable service port (as
specified by providers) and creates a tunnel on-demand when the port is
accessed.
This should work for any TCP port, and is implemented here for the
kubernetes provider, but the proxy itself could be implemented for other
providers through the fairly simple
getPortForward
handler interface.Unlike kubefwd, for example, this implementation avoids any
need to mess with domain names or host files (and by extension running
as root) since a random free port is assigned directly on localhost.
The tunnels are only created when a connection is first made, and are
then kept alive while the Garden agent is running.
Closes #967