Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
a7eec01e
D
dashboard
项目概览
凌波微步_大先生
/
dashboard
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dashboard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a7eec01e
编写于
1月 08, 2016
作者:
L
Lukasz Zajaczkowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Introduce Heapster to local Kubernetes cluster
上级
d1ac65e2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
1 deletion
+67
-1
build/cluster.js
build/cluster.js
+57
-1
build/conf.js
build/conf.js
+4
-0
build/hyperkube.sh
build/hyperkube.sh
+6
-0
未找到文件。
build/cluster.js
浏览文件 @
a7eec01e
...
...
@@ -26,6 +26,11 @@ import conf from './conf';
*/
const
clusterHealthzUrl
=
`http://
${
conf
.
backend
.
apiServerHost
}
/healthz`
;
/**
* The validate URL of the heapster to check that it is running.
*/
const
heapsterValidateUrl
=
`http://
${
conf
.
backend
.
heapsterServerHost
}
/validate`
;
/**
* A Number, representing the ID value of the timer that is set for function which periodically
* checks if cluster is running. The null means that no timer is running.
...
...
@@ -34,6 +39,14 @@ const clusterHealthzUrl = `http://${conf.backend.apiServerHost}/healthz`;
*/
let
isRunningSetIntervalHandler
=
null
;
/**
* A Number, representing the ID value of the timer that is set for function which periodically
* checks if Heapster is running. The null means that no timer is running.
*
* @type {?number}
*/
let
isHeapsterRunningSetIntervalHandler
=
null
;
/**
* Checks if cluster health check return correct status.
* When custer is up and running then return 'ok'.
...
...
@@ -48,6 +61,20 @@ function clusterHealthCheck(doneFn) {
});
}
/**
* Checks if Heapster return debug messages.
* When Heapster is running then return some debug text otherwise server return error.
* @param {function(?Error=)} doneFn
*/
function
heapsterHealthCheck
(
doneFn
)
{
childProcess
.
exec
(
`curl
${
heapsterValidateUrl
}
`
,
function
(
err
,
stdout
)
{
if
(
err
)
{
return
doneFn
(
new
Error
(
err
));
}
return
doneFn
(
stdout
.
trim
());
});
}
/**
* Creates cluster from scratch.
* Downloads latest version of kubernetes from git repository.
...
...
@@ -59,7 +86,7 @@ function clusterHealthCheck(doneFn) {
* * Install golang
* * Install etcd
*/
gulp
.
task
(
'
local-up-cluster
'
,
[
'
spawn-cluster
'
,
'
wait-for-cluster
'
]);
gulp
.
task
(
'
local-up-cluster
'
,
[
'
spawn-cluster
'
,
'
wait-for-cluster
'
,
'
wait-for-heapster
'
]);
/**
* Spawns a local Kubernetes cluster running inside a Docker container.:
...
...
@@ -75,6 +102,35 @@ gulp.task('spawn-cluster', function(doneFn) {
});
});
/**
* Checks periodically if heapster is up and running.
*/
gulp
.
task
(
'
wait-for-heapster
'
,
function
(
doneFn
)
{
let
counter
=
0
;
if
(
!
isHeapsterRunningSetIntervalHandler
)
{
isHeapsterRunningSetIntervalHandler
=
setInterval
(
isRunning
,
1000
);
}
function
isRunning
()
{
if
(
counter
%
10
===
0
)
{
gulpUtil
.
log
(
gulpUtil
.
colors
.
magenta
(
`Waiting for a Heapster on
${
conf
.
backend
.
heapsterServerHost
}
...`
));
}
counter
+=
1
;
// constantly query the heapster until it is properly running
heapsterHealthCheck
(
function
(
result
)
{
if
(
result
.
length
>
0
)
{
gulpUtil
.
log
(
gulpUtil
.
colors
.
magenta
(
'
Heapster is up and running.
'
));
clearTimeout
(
isHeapsterRunningSetIntervalHandler
);
isHeapsterRunningSetIntervalHandler
=
null
;
doneFn
();
}
});
}
});
/**
* Checks periodically if cluster is up and running.
*/
...
...
build/conf.js
浏览文件 @
a7eec01e
...
...
@@ -46,6 +46,10 @@ export default {
* Address for the Kubernetes API server.
*/
apiServerHost
:
'
localhost:8080
'
,
/**
* Address for the Heapster API server.
*/
heapsterServerHost
:
'
localhost:8082
'
,
},
/**
...
...
build/hyperkube.sh
浏览文件 @
a7eec01e
...
...
@@ -20,6 +20,8 @@
K8S_VERSION
=
"1.1.2"
# Port of the apiserver to serve on.
PORT
=
8080
# Port of the heapster to serve on.
HEAPSTER_PORT
=
8082
docker run
--net
=
host
-d
gcr.io/google_containers/etcd:2.0.12
\
/usr/local/bin/etcd
--addr
=
127.0.0.1:4001
--bind-addr
=
0.0.0.0:4001
--data-dir
=
/var/etcd/data
...
...
@@ -43,3 +45,7 @@ docker run \
docker run
-d
--net
=
host
--privileged
gcr.io/google_containers/hyperkube:v
${
K8S_VERSION
}
\
/hyperkube proxy
--master
=
http://127.0.0.1:
${
PORT
}
--v
=
2
# Runs Heapster in standalone mode
docker run
--net
=
host
-d
kubernetes/heapster
-port
${
HEAPSTER_PORT
}
\
--source
=
kubernetes:http://127.0.0.1:
${
PORT
}
?inClusterConfig
=
false
&auth
=
""
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录