Skip to content

Commit 914e62a

Browse files
committed
feat: provision
1 parent 0d794d7 commit 914e62a

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

infrastructure/evault-provisioner/src/templates/evault.nomad.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export async function provisionEVault(w3id: string, eVaultId: string) {
183183
kind: "Service",
184184
metadata: { name: "evault-service" },
185185
spec: {
186-
type: "LoadBalancer",
186+
type: "NodePort",
187187
selector: { app: "evault" },
188188
ports: [
189189
{
@@ -195,20 +195,23 @@ export async function provisionEVault(w3id: string, eVaultId: string) {
195195
},
196196
});
197197

198-
// Wait for LoadBalancer IP
199-
let externalIP = null;
200-
for (let i = 0; i < 30; i++) {
201-
const svc = await coreApi.readNamespacedService({
202-
name: "evault-service",
203-
namespace: namespaceName,
204-
});
205-
const ingress = svc.status?.loadBalancer?.ingress?.[0];
206-
if (ingress?.ip || ingress?.hostname) {
207-
externalIP = ingress.ip || ingress.hostname;
208-
const port = svc.spec?.ports?.[0]?.port;
209-
return `http://${externalIP}:${port}`;
210-
}
211-
await new Promise((r) => setTimeout(r, 2000));
212-
}
213-
throw new Error("Failed to get LoadBalancer IP after 60 seconds");
198+
// Get the service and node info
199+
const svc = await coreApi.readNamespacedService({
200+
name: "evault-service",
201+
namespace: namespaceName,
202+
});
203+
const nodePort = svc.spec?.ports?.[0]?.nodePort;
204+
if (!nodePort) throw new Error("No NodePort assigned");
205+
206+
// Get the node's external IP
207+
const nodes = await coreApi.listNode();
208+
const node = nodes.items[0];
209+
if (!node) throw new Error("No nodes found in cluster");
210+
211+
const externalIP = node.status?.addresses?.find(
212+
addr => addr.type === "ExternalIP"
213+
)?.address;
214+
215+
if (!externalIP) throw new Error("No external IP found on node");
216+
return `http://${externalIP}:${nodePort}`;
214217
}

0 commit comments

Comments
 (0)