mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
9306693570
commit
dd4fac5aa8
@ -81,11 +81,10 @@ export class ResourceApplier {
|
|||||||
return this.kubectlCmdAll("delete", resources, extraArgs);
|
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 { kubeCtl } = this.cluster;
|
||||||
const kubectlPath = await kubeCtl.getPath();
|
const kubectlPath = await kubeCtl.getPath();
|
||||||
const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();
|
const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();
|
||||||
let kubectlArgs = args || [];
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const tmpDir = tempy.directory();
|
const tmpDir = tempy.directory();
|
||||||
@ -94,8 +93,8 @@ export class ResourceApplier {
|
|||||||
resources.forEach((resource, index) => {
|
resources.forEach((resource, index) => {
|
||||||
fs.writeFileSync(path.join(tmpDir, `${index}.yaml`), resource);
|
fs.writeFileSync(path.join(tmpDir, `${index}.yaml`), resource);
|
||||||
});
|
});
|
||||||
kubectlArgs = kubectlArgs.concat(["-f", `"${tmpDir}"`]);
|
args.push("-f", `"${tmpDir}"`);
|
||||||
const cmd = `"${kubectlPath}" ${subCmd} --kubeconfig "${proxyKubeconfigPath}" ${kubectlArgs.join(" ")}`;
|
const cmd = `"${kubectlPath}" ${subCmd} --kubeconfig "${proxyKubeconfigPath}" ${args.join(" ")}`;
|
||||||
|
|
||||||
logger.info(`[RESOURCE-APPLIER] running cmd ${cmd}`);
|
logger.info(`[RESOURCE-APPLIER] running cmd ${cmd}`);
|
||||||
exec(cmd, (error, stdout) => {
|
exec(cmd, (error, stdout) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user