Skip to content

Commit

Permalink
dont resurrect deactivated kubectl proxy (#491)
Browse files Browse the repository at this point in the history
Signed-off-by: Juozas Gaigalas <juozasgaigalas@gmail.com>
  • Loading branch information
juozasg authored Sep 28, 2023
1 parent 6cb380e commit da125ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli/kubernetes/kubectlProxy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KubeConfig } from '@kubernetes/client-node';
import { ChildProcess } from 'child_process';
import * as shell from 'cli/shell/exec';
import { isActive } from 'extension';
import { createK8sClients, destroyK8sClients } from 'k8s/client';
import { createProxyConfig } from 'k8s/createKubeProxyConfig';

Expand All @@ -14,7 +15,7 @@ export let kubeProxyConfig: KubeConfig | undefined;
export function kubeProxyKeepAlive() {
// keep alive
setInterval(async () => {
if(!proxyProc) {
if(!proxyProc && isActive) {
destroyK8sClients();
await startKubeProxy();
}
Expand Down
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export let extensionContext: ExtensionContext;
export let globalState: GlobalState;
/** Methods to report telemetry over Application Insights (Exceptions or Custom Events). */
export let telemetry: Telemetry | any;
export let isActive = true;

/**
* Called when GitOps extension is activated.
Expand Down Expand Up @@ -128,6 +129,7 @@ export function suppressDebugMessages(): boolean {
* Called when extension is deactivated.
*/
export function deactivate() {
isActive = false;
telemetry?.dispose();
statusBar?.dispose();
stopKubeProxy();
Expand Down

0 comments on commit da125ec

Please sign in to comment.