-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43bc1a5
commit 8d0654a
Showing
1 changed file
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
const utils = require("../utils"); | ||
const { exec } = require('node:child_process'); | ||
const { spawnSync } = require("node:child_process"); | ||
|
||
const config = utils.readConfig(); | ||
const cmdline = `kubectl -n ${config.Namespace} get svc lb -o json`; | ||
exec(cmdline, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`exec error: ${error}`); | ||
return; | ||
} | ||
const output = JSON.parse(stdout); | ||
console.log("load balancer external IP address:", output.status.loadBalancer.ingress[0].ip); | ||
}); | ||
const { stdout } = spawnSync( | ||
"kubectl", | ||
["-n", config.Namespace, "get", "svc", "lb", "-o", "json"], | ||
{ stdio: ["pipe", "pipe", "inherit"] } | ||
); | ||
const output = JSON.parse(stdout); | ||
console.log( | ||
"load balancer external IP address:", | ||
output.status.loadBalancer.ingress[0].ip | ||
); |