diff --git a/build/cluster.js b/build/cluster.js index b2907b64d9de49de5409ebf792ddb5b55cabd635..5f57c11b139420a18259564eacd96c6597c7ee1f 100644 --- a/build/cluster.js +++ b/build/cluster.js @@ -36,6 +36,11 @@ const stableVersion = 'v1.1.1'; const tarballUrl = 'https://storage.googleapis.com/kubernetes-release/release'; const upScript = `${conf.paths.kubernetes}/hack/local-up-cluster.sh`; +/** + * The healthz URL of the cluster to check that it is running. + */ +const clusterHealthzUrl = `http://${conf.backend.apiServerHost}/healthz`; + /** * Currently running cluster process object. Null if the cluster is not running. * @@ -75,7 +80,7 @@ function checkForClusterFailure(doneFn) { * @param {function(?Error=)} doneFn */ function clusterHealthCheck(doneFn) { - childProcess.exec(`curl http://127.0.0.1:8080/healthz/ping`, function(err, stdout) { + childProcess.exec(`curl ${clusterHealthzUrl}`, function(err, stdout) { if (err) { return doneFn(new Error(err)); } @@ -210,7 +215,9 @@ gulp.task('wait-for-cluster', function(doneFn) { function isRunning() { if (counter % 10 === 0) { - gulpUtil.log(gulpUtil.colors.magenta(`Waiting for a kubernetes cluster on port 8080...`)); + gulpUtil.log( + gulpUtil.colors.magenta( + `Waiting for a Kubernetes cluster on ${conf.backend.apiServerHost}...`)); } counter += 1; @@ -219,7 +226,7 @@ gulp.task('wait-for-cluster', function(doneFn) { // constantly query the cluster until it is properly running clusterHealthCheck(function(result) { if (result === 'ok') { - gulpUtil.log(gulpUtil.colors.magenta("Kubernetes cluster is up and running.")); + gulpUtil.log(gulpUtil.colors.magenta('Kubernetes cluster is up and running.')); clearTimeout(isRunningSetIntervalHandler); isRunningSetIntervalHandler = null; doneFn(); @@ -236,8 +243,8 @@ gulp.task( 'kubeconfig-set-cluster-local', ['download-kubectl', 'checkout-kubernetes-version'], function(doneFn) { executeKubectlCommand( - 'config set-cluster local --server=http://127.0.0.1:8080 ' + - '--insecure-skip-tls-verify=true', + `config set-cluster local --server=http://${conf.backend.apiServerHost}` + + `--insecure-skip-tls-verify=true`, doneFn); }); diff --git a/build/conf.js b/build/conf.js index 55edd7cbc710371b2f9ad1cafe4eb8d47e9f9cc4..e93324ee9d30296c74982d5e5f1cc1db6e5bc80e 100644 --- a/build/conf.js +++ b/build/conf.js @@ -49,7 +49,7 @@ export default { /** * Address for the Kubernetes API server. */ - apiServerHost: 'http://localhost:8080', + apiServerHost: 'localhost:8080', }, /** diff --git a/build/serve.js b/build/serve.js index 797d1582bbad3714151a371368353eb700571c75..268fd741f890c562769b97fcc585bc3631d06478 100644 --- a/build/serve.js +++ b/build/serve.js @@ -113,7 +113,10 @@ gulp.task('serve:prod', ['spawn-backend:prod']); gulp.task('spawn-backend', ['backend', 'kill-backend'], function() { runningBackendProcess = child.spawn( path.join(conf.paths.serve, conf.backend.binaryName), - [`--apiserver-host=${conf.backend.apiServerHost}`, `--port=${conf.backend.devServerPort}`], + [ + `--apiserver-host=http://${conf.backend.apiServerHost}`, + `--port=${conf.backend.devServerPort}`, + ], {stdio: 'inherit'}); runningBackendProcess.on('exit', function() { @@ -130,7 +133,10 @@ gulp.task('spawn-backend', ['backend', 'kill-backend'], function() { gulp.task('spawn-backend:prod', ['build-frontend', 'backend:prod', 'kill-backend'], function() { runningBackendProcess = child.spawn( path.join(conf.paths.dist, conf.backend.binaryName), - [`--apiserver-host=${conf.backend.apiServerHost}`, `--port=${conf.frontend.serverPort}`], + [ + `--apiserver-host=http://${conf.backend.apiServerHost}`, + `--port=${conf.frontend.serverPort}`, + ], {stdio: 'inherit', cwd: conf.paths.dist}); runningBackendProcess.on('exit', function() {