Skip to content

Commit

Permalink
3906 implement port forward (#4082)
Browse files Browse the repository at this point in the history
* added port-forward

Signed-off-by: msivasubramaniaan <msivasub@redhat.com>

* added service and depolyment port forward

Signed-off-by: msivasubramaniaan <msivasub@redhat.com>

* fix-jsdoc issue

Signed-off-by: msivasubramaniaan <msivasub@redhat.com>

* fix-jsdoc issue

Signed-off-by: msivasubramaniaan <msivasub@redhat.com>

---------

Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
  • Loading branch information
msivasubramaniaan authored May 6, 2024
1 parent b43dab9 commit ed99af9
Show file tree
Hide file tree
Showing 4 changed files with 457 additions and 0 deletions.
85 changes: 85 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"mocha": "^10.4.0",
"mocha-jenkins-reporter": "^0.4.7",
"npm-run-all": "^4.1.5",
"portfinder": "^1.0.32",
"prettier": "^3.2.5",
"pretty-bytes": "^6.1.1",
"proxyquire": "^2.1.3",
Expand Down Expand Up @@ -853,6 +854,10 @@
"command": "openshift.resource.openInBrowser",
"title": "Open in Browser"
},
{
"command": "openshift.resource.portForward",
"title": "Port Forward"
},
{
"command": "openshift.openStatusBar",
"title": "OpenShift",
Expand Down Expand Up @@ -1344,6 +1349,10 @@
"command": "openshift.resource.watchLogs",
"when": "false"
},
{
"command": "openshift.resource.portForward",
"when": "false"
},
{
"command": "openshift.deployment.shell",
"when": "false"
Expand Down Expand Up @@ -1918,6 +1927,10 @@
"command": "openshift.resource.load",
"when": "view == openshiftProjectExplorer && viewItem =~ /^openshift\\.k8sObject\\.(?!helm)/"
},
{
"command": "openshift.resource.portForward",
"when": "view == openshiftProjectExplorer && viewItem =~ /^openshift\\.k8sObject\\.(?!helm)/"
},
{
"command": "openshift.resource.delete",
"when": "view == openshiftProjectExplorer && viewItem =~ /^openshift\\.k8sObject\\.(?!helm)/"
Expand Down
9 changes: 9 additions & 0 deletions src/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { vsCommand } from './vscommand';
import { CustomResourceDefinitionStub } from './webview/common/createServiceTypes';
import { OpenShiftTerminalManager } from './webview/openshift-terminal/openShiftTerminal';
import { LoginUtil } from './util/loginUtil';
import { PortForward } from './port-forward';

type ExplorerItem = KubernetesObject | Helm.HelmRelease | Context | TreeItem | OpenShiftObject | HelmRepo;

Expand Down Expand Up @@ -599,6 +600,14 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
OpenShiftExplorer.instance.refresh();
}

@vsCommand('openshift.resource.portForward')
public static async portForward(component: KubernetesObject) {
const kind = component.kind || 'pods';
const resourceName = component.metadata.name;
const namespace: string = await Oc.Instance.getActiveProject();
return await PortForward.getInstance().promptAndForwardPort(kind, resourceName, namespace);
}

@vsCommand('openshift.resource.watchLogs')
public static async watchLogs(component: KubernetesObject) {
// wait until logs are available before starting to stream them
Expand Down
Loading

0 comments on commit ed99af9

Please sign in to comment.