From dd4fac5aa886d6f8219ef7cab91653775c5fdba4 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Mon, 17 May 2021 20:30:21 +0300 Subject: [PATCH] cleanup Signed-off-by: Jari Kolehmainen --- src/main/resource-applier.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/resource-applier.ts b/src/main/resource-applier.ts index 08018ade21..f1c64f388c 100644 --- a/src/main/resource-applier.ts +++ b/src/main/resource-applier.ts @@ -81,11 +81,10 @@ export class ResourceApplier { return this.kubectlCmdAll("delete", resources, extraArgs); } - protected async kubectlCmdAll(subCmd: string, resources: string[], args?: string[]): Promise { + protected async kubectlCmdAll(subCmd: string, resources: string[], args: string[] = []): Promise { const { kubeCtl } = this.cluster; const kubectlPath = await kubeCtl.getPath(); const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath(); - let kubectlArgs = args || []; return new Promise((resolve, reject) => { const tmpDir = tempy.directory(); @@ -94,8 +93,8 @@ export class ResourceApplier { resources.forEach((resource, index) => { fs.writeFileSync(path.join(tmpDir, `${index}.yaml`), resource); }); - kubectlArgs = kubectlArgs.concat(["-f", `"${tmpDir}"`]); - const cmd = `"${kubectlPath}" ${subCmd} --kubeconfig "${proxyKubeconfigPath}" ${kubectlArgs.join(" ")}`; + args.push("-f", `"${tmpDir}"`); + const cmd = `"${kubectlPath}" ${subCmd} --kubeconfig "${proxyKubeconfigPath}" ${args.join(" ")}`; logger.info(`[RESOURCE-APPLIER] running cmd ${cmd}`); exec(cmd, (error, stdout) => {