mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
9306693570
commit
dd4fac5aa8
1 file changed
+3
-4
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user