From 6cf7e0db0ed53b416ee9a5147be5d8b019eedd6b Mon Sep 17 00:00:00 2001 From: Laura Abro Date: Mon, 28 Apr 2025 11:26:31 -0300 Subject: [PATCH] detect host ip --- worker/src/orcaSettings.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/worker/src/orcaSettings.ts b/worker/src/orcaSettings.ts index 2bc8f99..ca05629 100644 --- a/worker/src/orcaSettings.ts +++ b/worker/src/orcaSettings.ts @@ -1,7 +1,21 @@ import { TASK_ID, namespaceWrapper } from "@_koii/namespace-wrapper"; import "dotenv/config"; +import os from "os"; -const imageUrl = "docker.io/hermanyiqunliang/summarizer-agent:0.2"; +const imageUrl = "docker.io/labrocadabro/prometheus-summarizer:0.2"; + +function getHostIP() { + const interfaces = os.networkInterfaces(); + for (const name of Object.keys(interfaces)) { + for (const iface of interfaces[name] || []) { + // Skip over internal (i.e., 127.0.0.1) and non-IPv4 addresses + if (iface.family === "IPv4" && !iface.internal) { + return iface.address; + } + } + } + throw new Error("Unable to determine host IP address"); +} async function createPodSpec(): Promise { const basePath = await namespaceWrapper.getBasePath(); @@ -29,6 +43,10 @@ spec: hostPath: path: ${basePath}/orca/data type: DirectoryOrCreate + hostAliases: + - ip: "${getHostIP()}" + hostnames: + - "host.docker.internal" `; return podSpec; } @@ -37,10 +55,12 @@ export async function getConfig(): Promise<{ imageURL: string; customPodSpec: string; rootCA: string | null; + timeout: number; }> { return { imageURL: imageUrl, customPodSpec: await createPodSpec(), rootCA: null, + timeout: 900000, }; }