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) => {