提交 f3881e80 编写于 作者: B bryk

Change healthz ping URL to make it work with proxy

With this I can work with `kubectl proxy` clusters. Everything else
stays the same.
上级 eccb746a
......@@ -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);
});
......
......@@ -49,7 +49,7 @@ export default {
/**
* Address for the Kubernetes API server.
*/
apiServerHost: 'http://localhost:8080',
apiServerHost: 'localhost:8080',
},
/**
......
......@@ -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() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册