@@ -183,7 +183,7 @@ export async function provisionEVault(w3id: string, eVaultId: string) {
183
183
kind : "Service" ,
184
184
metadata : { name : "evault-service" } ,
185
185
spec : {
186
- type : "NodePort " ,
186
+ type : "LoadBalancer " ,
187
187
selector : { app : "evault" } ,
188
188
ports : [
189
189
{
@@ -195,24 +195,20 @@ export async function provisionEVault(w3id: string, eVaultId: string) {
195
195
} ,
196
196
} ) ;
197
197
198
- // Get the service to retrieve the assigned NodePort
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
- // Try getting minikube IP first
207
- try {
208
- const minikubeIP = execSync ( "minikube ip" ) . toString ( ) . trim ( ) ;
209
- return `http://${ minikubeIP } :${ nodePort } ` ;
210
- } catch ( e ) {
211
- // Fallback to node IP
212
- const nodes = await coreApi . listNode ( ) ;
213
- const nodeIP = nodes ?. items ?. [ 0 ] ?. status ?. addresses ?. find (
214
- ( a ) => a . type === "ExternalIP" || a . type === "InternalIP"
215
- ) ?. address || "127.0.0.1" ;
216
- return `http://${ nodeIP } :${ nodePort } ` ;
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 ) ) ;
217
212
}
213
+ throw new Error ( "Failed to get LoadBalancer IP after 60 seconds" ) ;
218
214
}
0 commit comments