From 10d4f6127b6f347bc357ee4b1e37b4518f93a092 Mon Sep 17 00:00:00 2001 From: Javier Viola <363911+pepoviola@users.noreply.github.com> Date: Wed, 10 Jan 2024 15:19:28 -0300 Subject: [PATCH 01/11] wip, init infra to access logs through the pod --- .../providers/k8s/dynResourceDefinition.ts | 3 +- .../src/providers/k8s/kubeClient.ts | 43 +++++++++++-------- .../providers/k8s/resources/nodeResource.ts | 25 +++++++---- .../src/providers/k8s/resources/types.ts | 1 + .../packages/orchestrator/src/spawner.ts | 2 +- 5 files changed, 46 insertions(+), 28 deletions(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/dynResourceDefinition.ts b/javascript/packages/orchestrator/src/providers/k8s/dynResourceDefinition.ts index 2b1380e94..04f4ab19b 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/dynResourceDefinition.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/dynResourceDefinition.ts @@ -22,9 +22,10 @@ export async function genBootnodeDef( export async function genNodeDef( namespace: string, nodeSetup: Node, + inCI: boolean = false, ): Promise { const nodeResource = new NodeResource(namespace, nodeSetup); - return nodeResource.generateSpec(); + return nodeResource.generateSpec(inCI); } export function genChaosDef( diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 62f967a4d..99d7ad8de 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -61,6 +61,7 @@ export class KubeClient extends Client { localMagicFilepath: string; remoteDir: string; dataDir: string; + inCI: boolean; constructor(configPath: string, namespace: string, tmpDir: string) { super(configPath, namespace, tmpDir, "kubectl", "kubernetes"); @@ -72,6 +73,9 @@ export class KubeClient extends Client { this.localMagicFilepath = `${tmpDir}/finished.txt`; this.remoteDir = DEFAULT_REMOTE_DIR; this.dataDir = DEFAULT_DATA_DIR; + // Use the same env vars from spawn/run + this.inCI = process.env.RUN_IN_CONTAINER === "1" || process.env.ZOMBIENET_IMAGE !== undefined; + } async validateAccess(): Promise { @@ -728,24 +732,28 @@ export class KubeClient extends Client { since: number | undefined = undefined, withTimestamp = false, ): Promise { - const args = ["logs"]; - if (since && since > 0) args.push(`--since=${since}s`); - if (withTimestamp) args.push("--timestamps=true"); - args.push(...[podName, "-c", podName, "--namespace", this.namespace]); - - const result = await this.runCommand(args, { - scoped: false, - allowFail: true, - }); - if (result.exitCode == 0) { - return result.stdout; + if( this.inCI ) { + return "" } else { - const warnMsg = `[WARN] error getting log for pod: ${podName}`; - debug(warnMsg); - new CreateLogTable({ colWidths: [120], doubleBorder: true }).pushToPrint([ - [decorators.yellow(warnMsg)], - ]); - return result.stderr || ""; + const args = ["logs"]; + if (since && since > 0) args.push(`--since=${since}s`); + if (withTimestamp) args.push("--timestamps=true"); + args.push(...[podName, "-c", podName, "--namespace", this.namespace]); + + const result = await this.runCommand(args, { + scoped: false, + allowFail: true, + }); + if (result.exitCode == 0) { + return result.stdout; + } else { + const warnMsg = `[WARN] error getting log for pod: ${podName}`; + debug(warnMsg); + new CreateLogTable({ colWidths: [120], doubleBorder: true }).pushToPrint([ + [decorators.yellow(warnMsg)], + ]); + return result.stderr || ""; + } } } @@ -903,6 +911,7 @@ export class KubeClient extends Client { debug(result); fileUploadCache[fileHash] = fileName; } + getLogsCommand(name: string): string { return `kubectl logs -f ${name} -c ${name} -n ${this.namespace}`; } diff --git a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts index ea62ca1c0..740971cb9 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts @@ -23,9 +23,9 @@ export class NodeResource { protected readonly nodeSetupConfig: Node, ) {} - public async generateSpec() { - const volumes = await this.generateVolumes(); - const volumeMounts = this.generateVolumesMounts(); + public async generateSpec(inCI: boolean = false) { + const volumes = await this.generateVolumes(inCI); + const volumeMounts = this.generateVolumesMounts(inCI); const containersPorts = await this.generateContainersPorts(); const initContainers = this.generateInitContainers(); const containers = await this.generateContainers( @@ -33,23 +33,29 @@ export class NodeResource { containersPorts, ); - return this.generatePodSpec(initContainers, containers, volumes); + return this.generatePodSpec(initContainers, containers, volumes, inCI); } - private async generateVolumes(): Promise { - return [ + private async generateVolumes(inCI: boolean): Promise { + let volumes: Volume[] = [ { name: "tmp-cfg" }, { name: "tmp-data" }, { name: "tmp-relay-data" }, ]; + + if( inCI ) volumes.push( { name: "pods", hostPath: { path: "/var/log/pods", type: "" } } ); + + return volumes; } - private generateVolumesMounts() { - return [ + private generateVolumesMounts(inCI: boolean) { + let volMount = [ { name: "tmp-cfg", mountPath: "/cfg", readOnly: false }, { name: "tmp-data", mountPath: "/data", readOnly: false }, { name: "tmp-relay-data", mountPath: "/relay-data", readOnly: false }, ]; + if( inCI ) volMount.push( { name: "pods", mountPath: "/var/log/pods", readOnly: true } ); + return volMount; } private async generateContainersPorts(): Promise { @@ -174,6 +180,7 @@ export class NodeResource { initContainers: Container[], containers: Container[], volumes: Volume[], + inCI: boolean = false, ): PodSpec { const { name, zombieRole } = this.nodeSetupConfig; const zombieRoleLabel = this.computeZombieRoleLabel(); @@ -203,7 +210,7 @@ export class NodeResource { restartPolicy, volumes, securityContext: { - fsGroup: 1000, + fsGroup: inCI ? 0 : 1000, runAsUser: 1000, runAsGroup: 1000, }, diff --git a/javascript/packages/orchestrator/src/providers/k8s/resources/types.ts b/javascript/packages/orchestrator/src/providers/k8s/resources/types.ts index 61d190705..327750872 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/resources/types.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/resources/types.ts @@ -15,6 +15,7 @@ export interface VolumeMount { export interface Volume { name: string; + hostPath?: any; } export interface ContainerPort { diff --git a/javascript/packages/orchestrator/src/spawner.ts b/javascript/packages/orchestrator/src/spawner.ts index a6b77c103..f86a5b478 100644 --- a/javascript/packages/orchestrator/src/spawner.ts +++ b/javascript/packages/orchestrator/src/spawner.ts @@ -55,7 +55,7 @@ export const spawnNode = async ( debug(`creating node: ${node.name}`); const podDef = await (node.name === "bootnode" ? genBootnodeDef(namespace, node) - : genNodeDef(namespace, node)); + : genNodeDef(namespace, node, opts.inCI)); const finalFilesToCopyToNode = [...filesToCopy]; From d215b245de7432b936ae060b988aa19c26c2b931 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Fri, 22 Mar 2024 08:28:48 +0100 Subject: [PATCH 02/11] impl reading logs from disk --- .../src/providers/k8s/kubeClient.ts | 122 ++++++++++++++---- .../providers/k8s/resources/nodeResource.ts | 20 ++- 2 files changed, 116 insertions(+), 26 deletions(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 99d7ad8de..8c2a80abe 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -74,8 +74,9 @@ export class KubeClient extends Client { this.remoteDir = DEFAULT_REMOTE_DIR; this.dataDir = DEFAULT_DATA_DIR; // Use the same env vars from spawn/run - this.inCI = process.env.RUN_IN_CONTAINER === "1" || process.env.ZOMBIENET_IMAGE !== undefined; - + this.inCI = + process.env.RUN_IN_CONTAINER === "1" || + process.env.ZOMBIENET_IMAGE !== undefined; } async validateAccess(): Promise { @@ -732,29 +733,106 @@ export class KubeClient extends Client { since: number | undefined = undefined, withTimestamp = false, ): Promise { - if( this.inCI ) { - return "" - } else { - const args = ["logs"]; - if (since && since > 0) args.push(`--since=${since}s`); - if (withTimestamp) args.push("--timestamps=true"); - args.push(...[podName, "-c", podName, "--namespace", this.namespace]); + if (!this.inCI) { + // we can just return the logs from kube + const logs = await this.getNodeLogsFromKube( + podName, + since, + withTimestamp, + ); + return logs; + } - const result = await this.runCommand(args, { - scoped: false, - allowFail: true, - }); - if (result.exitCode == 0) { - return result.stdout; - } else { - const warnMsg = `[WARN] error getting log for pod: ${podName}`; - debug(warnMsg); - new CreateLogTable({ colWidths: [120], doubleBorder: true }).pushToPrint([ - [decorators.yellow(warnMsg)], - ]); - return result.stderr || ""; + // if we are running in CI, could be the case that k8s had rotate the logs, + // so the simple `kubectl logs` will retrive only a part of them. + // We should read it from host filesystem to ensure we are reading all the logs. + + // First get the logs files to check if we need to read from disk or not + const logFiles = await this.gzipedLogFiles(podName); + debug("logFiles", logFiles); + let logs = ""; + if (logFiles.length === 0) { + logs = await this.getNodeLogsFromKube(podName, since, withTimestamp); + } else { + // need to read the files in order and accumulate in logs + const promises = logFiles.map((file) => + this.readGzipedLogFile(podName, file), + ); + const results = await Promise.all(promises); + for (const r of results) { + logs += r; } + + // now read the actual log from kube + logs += await this.getNodeLogsFromKube(podName); } + + return logs; + } + + async gzipedLogFiles(podName: string): Promise { + const podId = await this.getPodId(podName); + debug("podId", podId); + // log dir in ci /var/log/pods/__/ + const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; + // ls dir sorting asc one file per line (only compressed files) + const args = ["exec", podName, "--", "ls", "-1", logsDir]; + const result = await this.runCommand(args, { + scoped: true, + allowFail: false, + }); + + return result.stdout + .split("\n") + .filter((f) => f !== "0.log") + .map((fileName) => `${logsDir}/${fileName}`); + } + + async getNodeLogsFromKube( + podName: string, + since: number | undefined = undefined, + withTimestamp = false, + ) { + const args = ["logs"]; + if (since && since > 0) args.push(`--since=${since}s`); + if (withTimestamp) args.push("--timestamps=true"); + args.push(...[podName, "-c", podName, "--namespace", this.namespace]); + + const result = await this.runCommand(args, { + scoped: false, + allowFail: true, + }); + if (result.exitCode == 0) { + return result.stdout; + } else { + const warnMsg = `[WARN] error getting log for pod: ${podName}`; + debug(warnMsg); + new CreateLogTable({ colWidths: [120], doubleBorder: true }).pushToPrint([ + [decorators.yellow(warnMsg)], + ]); + return result.stderr || ""; + } + } + + async readGzipedLogFile(podName: string, file: string): Promise { + const args = ["exec", podName, "--", "zcat", file]; + const result = await this.runCommand(args, { + scoped: true, + allowFail: false, + }); + + return result.stdout; + } + + async getPodId(podName: string): Promise { + // kubectl get pod -n -o jsonpath='{.metadata.uid}' + const args = ["get", "pod", podName, "-o", "jsonpath={.metadata.uid}"]; + const result = await this.runCommand(args, { + scoped: true, + allowFail: false, + }); + + return result.stdout; } async dumpLogs(path: string, podName: string) { diff --git a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts index 740971cb9..b0b98403e 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts @@ -24,6 +24,8 @@ export class NodeResource { ) {} public async generateSpec(inCI: boolean = false) { + // DEBUG LOCAL + inCI = true; const volumes = await this.generateVolumes(inCI); const volumeMounts = this.generateVolumesMounts(inCI); const containersPorts = await this.generateContainersPorts(); @@ -37,24 +39,34 @@ export class NodeResource { } private async generateVolumes(inCI: boolean): Promise { - let volumes: Volume[] = [ + const volumes: Volume[] = [ { name: "tmp-cfg" }, { name: "tmp-data" }, { name: "tmp-relay-data" }, ]; - if( inCI ) volumes.push( { name: "pods", hostPath: { path: "/var/log/pods", type: "" } } ); + if (inCI) + volumes.push({ + name: "pods", + hostPath: { path: "/var/log/pods", type: "" }, + }); return volumes; } private generateVolumesMounts(inCI: boolean) { - let volMount = [ + const volMount = [ { name: "tmp-cfg", mountPath: "/cfg", readOnly: false }, { name: "tmp-data", mountPath: "/data", readOnly: false }, { name: "tmp-relay-data", mountPath: "/relay-data", readOnly: false }, ]; - if( inCI ) volMount.push( { name: "pods", mountPath: "/var/log/pods", readOnly: true } ); + + if (inCI) + volMount.push({ + name: "pods", + mountPath: "/var/log/pods", + readOnly: false /* should be true */, + }); return volMount; } From 11d36ca96a120f0f8e9ad3bacab4aba7d726ec6a Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:04:00 +0100 Subject: [PATCH 03/11] pods vols readonly --- .../orchestrator/src/providers/k8s/resources/nodeResource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts index b0b98403e..837775388 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/resources/nodeResource.ts @@ -65,7 +65,7 @@ export class NodeResource { volMount.push({ name: "pods", mountPath: "/var/log/pods", - readOnly: false /* should be true */, + readOnly: true /* set to false for debugging */, }); return volMount; } From c20ae9c0812671ebc13442cff2b53488ec8039b0 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:21:22 +0100 Subject: [PATCH 04/11] typo --- .../packages/orchestrator/src/providers/k8s/kubeClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 8c2a80abe..4c5463ac3 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -744,7 +744,7 @@ export class KubeClient extends Client { } // if we are running in CI, could be the case that k8s had rotate the logs, - // so the simple `kubectl logs` will retrive only a part of them. + // so the simple `kubectl logs` will retrieve only a part of them. // We should read it from host filesystem to ensure we are reading all the logs. // First get the logs files to check if we need to read from disk or not From 590b9cb6c92be286d710119ff32f9ab4dfec5c6a Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:23:23 +0100 Subject: [PATCH 05/11] typo --- .../packages/orchestrator/src/providers/k8s/kubeClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 4c5463ac3..dd974aeea 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -748,7 +748,7 @@ export class KubeClient extends Client { // We should read it from host filesystem to ensure we are reading all the logs. // First get the logs files to check if we need to read from disk or not - const logFiles = await this.gzipedLogFiles(podName); + const logFiles = await this.gzippedLogFiles(podName); debug("logFiles", logFiles); let logs = ""; if (logFiles.length === 0) { @@ -756,7 +756,7 @@ export class KubeClient extends Client { } else { // need to read the files in order and accumulate in logs const promises = logFiles.map((file) => - this.readGzipedLogFile(podName, file), + this.readgzippedLogFile(podName, file), ); const results = await Promise.all(promises); for (const r of results) { @@ -770,7 +770,7 @@ export class KubeClient extends Client { return logs; } - async gzipedLogFiles(podName: string): Promise { + async gzippedLogFiles(podName: string): Promise { const podId = await this.getPodId(podName); debug("podId", podId); // log dir in ci /var/log/pods/__/ @@ -814,7 +814,7 @@ export class KubeClient extends Client { } } - async readGzipedLogFile(podName: string, file: string): Promise { + async readgzippedLogFile(podName: string, file: string): Promise { const args = ["exec", podName, "--", "zcat", file]; const result = await this.runCommand(args, { scoped: true, From 9096ae996650dc2213fd7bcdff8d0c4d38a91053 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:24:15 +0100 Subject: [PATCH 06/11] add words --- javascript/words.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/javascript/words.txt b/javascript/words.txt index 754a1cc05..d61909b27 100644 --- a/javascript/words.txt +++ b/javascript/words.txt @@ -58,6 +58,8 @@ framesystem fullpaths genshiro gurke +gzipped +Gzipped hasher hashers hostpath @@ -177,6 +179,7 @@ willbe xcmp xinfra xzvf +zcat zipkin zndsl zombienet From 8bfd78e1a3c20e75b29aece003fa1eae78575dfa Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:26:40 +0100 Subject: [PATCH 07/11] add words --- javascript/words.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/javascript/words.txt b/javascript/words.txt index d61909b27..ec91f5714 100644 --- a/javascript/words.txt +++ b/javascript/words.txt @@ -140,6 +140,7 @@ propery protobuf rawdata rawmetric +readgzipped relaychain resourse runtimes From 9af22936cdf8e9d6189aec6f1d9f9bd2872713a4 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:48:08 +0100 Subject: [PATCH 08/11] only read fs for Running pods --- .../orchestrator/src/providers/k8s/kubeClient.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index dd974aeea..34e9d44eb 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -771,8 +771,12 @@ export class KubeClient extends Client { } async gzippedLogFiles(podName: string): Promise { - const podId = await this.getPodId(podName); + const [podId, podStatus] = await this.getPodIdAndStatus(podName); debug("podId", podId); + debug("podStatus", podStatus); + // we can only get compressed files from `Running` pods + if(podStatus !== "Running") return []; + // log dir in ci /var/log/pods/__/ const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; // ls dir sorting asc one file per line (only compressed files) @@ -824,15 +828,15 @@ export class KubeClient extends Client { return result.stdout; } - async getPodId(podName: string): Promise { + async getPodIdAndStatus(podName: string): Promise { // kubectl get pod -n -o jsonpath='{.metadata.uid}' - const args = ["get", "pod", podName, "-o", "jsonpath={.metadata.uid}"]; + const args = ["get", "pod", podName, "-o", "jsonpath={.metadata.uid}{\",\"}{.status.phase}"]; const result = await this.runCommand(args, { scoped: true, allowFail: false, }); - return result.stdout; + return result.stdout.split(","); } async dumpLogs(path: string, podName: string) { From 7abda4470af473c50c7d24d67e716e795c764637 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 09:50:59 +0100 Subject: [PATCH 09/11] lint --- .../orchestrator/src/providers/k8s/kubeClient.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 34e9d44eb..6ba188667 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -775,7 +775,7 @@ export class KubeClient extends Client { debug("podId", podId); debug("podStatus", podStatus); // we can only get compressed files from `Running` pods - if(podStatus !== "Running") return []; + if (podStatus !== "Running") return []; // log dir in ci /var/log/pods/__/ const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; @@ -830,7 +830,13 @@ export class KubeClient extends Client { async getPodIdAndStatus(podName: string): Promise { // kubectl get pod -n -o jsonpath='{.metadata.uid}' - const args = ["get", "pod", podName, "-o", "jsonpath={.metadata.uid}{\",\"}{.status.phase}"]; + const args = [ + "get", + "pod", + podName, + "-o", + 'jsonpath={.metadata.uid}{","}{.status.phase}', + ]; const result = await this.runCommand(args, { scoped: true, allowFail: false, From 23560de4a0dde154e7d372fac6fc33dffb349778 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 10:38:39 +0100 Subject: [PATCH 10/11] use coreutils --- .../packages/orchestrator/src/providers/k8s/kubeClient.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 6ba188667..9739de0b1 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -780,7 +780,8 @@ export class KubeClient extends Client { // log dir in ci /var/log/pods/__/ const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; // ls dir sorting asc one file per line (only compressed files) - const args = ["exec", podName, "--", "ls", "-1", logsDir]; + // note: use coreutils here since some images (paras) doesn't have `ls` + const args = ["exec", podName, "--", "/cfg/coreutils ls", "-1", logsDir]; const result = await this.runCommand(args, { scoped: true, allowFail: false, From 69b5a42438c3ab2e9d2dbf43eb2b87667e96e665 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 23 Mar 2024 11:22:20 +0100 Subject: [PATCH 11/11] coreutils typo --- .../packages/orchestrator/src/providers/k8s/kubeClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 9739de0b1..dd9b134c7 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -781,7 +781,7 @@ export class KubeClient extends Client { const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; // ls dir sorting asc one file per line (only compressed files) // note: use coreutils here since some images (paras) doesn't have `ls` - const args = ["exec", podName, "--", "/cfg/coreutils ls", "-1", logsDir]; + const args = ["exec", podName, "--", "/cfg/coreutils", "ls", "-1", logsDir]; const result = await this.runCommand(args, { scoped: true, allowFail: false,