Skip to content

Commit

Permalink
fix(k8s): regression in port-forward handler
Browse files Browse the repository at this point in the history
We were missing the `--kubeconfig` flag to start the port-forward
command. My bad.
  • Loading branch information
edvald authored and thsig committed Jan 20, 2021
1 parent 824466c commit 723b1ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/kubernetes/kubectl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Kubectl extends PluginTool {
return JSON.parse(result)
}

private prepareArgs(params: KubectlParams) {
prepareArgs(params: KubectlParams) {
const { namespace, configPath, args } = params

const opts: string[] = []
Expand Down
12 changes: 4 additions & 8 deletions core/src/plugins/kubernetes/port-forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,11 @@ export async function getPortForward({
log.debug(`Forwarding local port ${localPort} to ${targetResource} port ${port}`)

// TODO: use the API directly instead of kubectl (need to reverse-engineer kubectl quite a bit for that)
const portForwardArgs = [
"--context",
k8sCtx.provider.config.context,
"--namespace",
const { args: portForwardArgs } = kubectl(k8sCtx, k8sCtx.provider).prepareArgs({
namespace,
"port-forward",
targetResource,
portMapping,
]
args: ["port-forward", targetResource, portMapping],
log,
})

log.silly(`Running 'kubectl ${portForwardArgs.join(" ")}'`)

Expand Down

0 comments on commit 723b1ae

Please sign in to comment.