MCPcopy Create free account
hub / github.com/PostHog/duckgres / startPortForward

Function startPortForward

controlplane/admin/devserver/main.go:161–169  ·  view source on GitHub ↗

startPortForward launches `kubectl port-forward deploy/ local:remote` for the given context and returns the running command.

(kubeContext, ns, deploy string, localPort, remotePort int)

Source from the content-addressed store, hash-verified

159 if err != nil {
160 return "", fmt.Errorf("decode secret %s/%s: %w", name, key, err)
161 }
162 return string(dec), nil
163}
164
165// startPortForward launches `kubectl port-forward deploy/<deploy> local:remote`
166// for the given context and returns the running command.
167func startPortForward(kubeContext, ns, deploy string, localPort, remotePort int) *exec.Cmd {
168 cmd := exec.Command("kubectl", "--context", kubeContext, "-n", ns, "port-forward",
169 "deploy/"+deploy, fmt.Sprintf("%d:%d", localPort, remotePort))
170 cmd.Stdout, cmd.Stderr = os.Stderr, os.Stderr
171 if err := cmd.Start(); err != nil {
172 log.Fatalf("start port-forward: %v", err)

Callers 1

mainFunction · 0.85

Calls 1

StartMethod · 0.45

Tested by

no test coverage detected