Skip to content

Commit

Permalink
get files from fileserver by ip (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoviola authored Oct 4, 2024
1 parent 781ace2 commit e9f4377
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class KubeClient extends Client {
remoteDir: string;
dataDir: string;
inCI: boolean;
fileServerIP?: string;

constructor(configPath: string, namespace: string, tmpDir: string) {
super(configPath, namespace, tmpDir, "kubectl", "kubernetes");
Expand Down Expand Up @@ -449,13 +450,11 @@ export class KubeClient extends Client {
// download the file in the container
const args = ["exec", identifier];
if (container) args.push("-c", container);
let extraArgs = [
"--",
"/usr/bin/wget",
"-O",
podFilePath,
`http://fileserver/${fileHash}`,
];
const url = this.fileServerIP
? `http://${this.fileServerIP}/${fileHash}`
: `http://fileserver/${fileHash}`;

let extraArgs = ["--", "/usr/bin/wget", "-O", podFilePath, url];
debug("copyFileToPodFromFileServer", [...args, ...extraArgs]);
let result = await this.runCommand([...args, ...extraArgs]);
debug(result);
Expand Down Expand Up @@ -581,6 +580,9 @@ export class KubeClient extends Client {
`Can't connect to fileServer, after ${attempts} attempts`,
);

// store the fileserver ip
this.fileServerIP = await this.getNodeIP("fileserver");

// ensure baseline resources if we are running in CI
if (process.env.RUN_IN_CONTAINER === "1")
await this.createStaticResource(
Expand Down

0 comments on commit e9f4377

Please sign in to comment.