1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-05-17 20:30:21 +03:00
parent 9306693570
commit dd4fac5aa8

View File

@ -81,11 +81,10 @@ export class ResourceApplier {
return this.kubectlCmdAll("delete", resources, extraArgs);
}
protected async kubectlCmdAll(subCmd: string, resources: string[], args?: string[]): Promise<string> {
protected async kubectlCmdAll(subCmd: string, resources: string[], args: string[] = []): Promise<string> {
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) => {