Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
a51872d6
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,发现更多精彩内容 >>
未验证
提交
a51872d6
编写于
1月 10, 2019
作者:
M
Marcin Maciaszczyk
提交者:
GitHub
1月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable job scaling as it is not supported by scale client (#3505)
上级
a28f1f0d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
48 deletion
+5
-48
src/app/backend/handler/apihandler.go
src/app/backend/handler/apihandler.go
+1
-7
src/app/backend/scaling/scale.go
src/app/backend/scaling/scale.go
+2
-39
src/app/frontend/resource/workloads/job/detail/state.ts
src/app/frontend/resource/workloads/job/detail/state.ts
+2
-2
未找到文件。
src/app/backend/handler/apihandler.go
浏览文件 @
a51872d6
...
...
@@ -902,12 +902,6 @@ func (apiHandler *APIHandler) handleDeploy(request *restful.Request, response *r
}
func
(
apiHandler
*
APIHandler
)
handleScaleResource
(
request
*
restful
.
Request
,
response
*
restful
.
Response
)
{
k8sClient
,
err
:=
apiHandler
.
cManager
.
Client
(
request
)
if
err
!=
nil
{
kdErrors
.
HandleInternalError
(
response
,
err
)
return
}
cfg
,
err
:=
apiHandler
.
cManager
.
Config
(
request
)
if
err
!=
nil
{
kdErrors
.
HandleInternalError
(
response
,
err
)
...
...
@@ -918,7 +912,7 @@ func (apiHandler *APIHandler) handleScaleResource(request *restful.Request, resp
kind
:=
request
.
PathParameter
(
"kind"
)
name
:=
request
.
PathParameter
(
"name"
)
count
:=
request
.
QueryParameter
(
"scaleBy"
)
replicaCountSpec
,
err
:=
scaling
.
ScaleResource
(
k8sClient
,
cfg
,
kind
,
namespace
,
name
,
count
)
replicaCountSpec
,
err
:=
scaling
.
ScaleResource
(
cfg
,
kind
,
namespace
,
name
,
count
)
if
err
!=
nil
{
kdErrors
.
HandleInternalError
(
response
,
err
)
return
...
...
src/app/backend/scaling/scale.go
浏览文件 @
a51872d6
...
...
@@ -15,19 +15,15 @@
package
scaling
import
(
"strconv"
"strings"
metaV1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/scale"
"k8s.io/client-go/scale/scheme/appsv1beta2"
"strconv"
)
// ReplicaCounts provide the desired and actual number of replicas.
...
...
@@ -57,40 +53,7 @@ func GetScaleSpec(cfg *rest.Config, kind, namespace, name string) (*ReplicaCount
// ScaleResource scales the provided resource using the client scale method in the case of Deployment,
// ReplicaSet, Replication Controller. In the case of a job we are using the jobs resource update
// method since the client scale method does not provide one for the job.
func
ScaleResource
(
client
kubernetes
.
Interface
,
cfg
*
rest
.
Config
,
kind
,
namespace
,
name
,
count
string
)
(
*
ReplicaCounts
,
error
)
{
if
strings
.
ToLower
(
kind
)
==
"job"
{
return
scaleJobResource
(
client
,
namespace
,
name
,
count
)
}
else
{
return
scaleGenericResource
(
cfg
,
kind
,
namespace
,
name
,
count
)
}
}
// scaleJobResource is exclusively used for jobs as it does not increase/decrease pods but jobs parallelism attribute.
func
scaleJobResource
(
client
kubernetes
.
Interface
,
namespace
,
name
,
count
string
)
(
*
ReplicaCounts
,
error
)
{
j
,
err
:=
client
.
BatchV1
()
.
Jobs
(
namespace
)
.
Get
(
name
,
metaV1
.
GetOptions
{})
if
err
!=
nil
{
return
nil
,
err
}
c
,
err
:=
strconv
.
Atoi
(
count
)
if
err
!=
nil
{
return
nil
,
err
}
*
j
.
Spec
.
Parallelism
=
int32
(
c
)
j
,
err
=
client
.
BatchV1
()
.
Jobs
(
namespace
)
.
Update
(
j
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
ReplicaCounts
{
ActualReplicas
:
*
j
.
Spec
.
Parallelism
,
DesiredReplicas
:
*
j
.
Spec
.
Parallelism
,
},
nil
}
func
scaleGenericResource
(
cfg
*
rest
.
Config
,
kind
,
namespace
,
name
,
count
string
)
(
*
ReplicaCounts
,
error
)
{
func
ScaleResource
(
cfg
*
rest
.
Config
,
kind
,
namespace
,
name
,
count
string
)
(
*
ReplicaCounts
,
error
)
{
sc
,
err
:=
getScaleGetter
(
cfg
)
if
err
!=
nil
{
return
nil
,
err
...
...
src/app/frontend/resource/workloads/job/detail/state.ts
浏览文件 @
a51872d6
...
...
@@ -14,7 +14,7 @@
import
{
Ng2StateDeclaration
}
from
'
@uirouter/angular
'
;
import
{
Logs
ScaleDefaultActionbar
}
from
'
../../../../common/components/actionbars/logsscale
default/component
'
;
import
{
Logs
DefaultActionbar
}
from
'
../../../../common/components/actionbars/logs
default/component
'
;
import
{
addNamespacedResourceStateParamsToUrl
}
from
'
../../../../common/params/params
'
;
import
{
stateName
,
stateUrl
}
from
'
../state
'
;
...
...
@@ -34,7 +34,7 @@ export const jobDetailState: Ng2StateDeclaration = {
component
:
JobDetailComponent
,
},
'
actionbar@chrome
'
:
{
component
:
Logs
Scale
DefaultActionbar
,
component
:
LogsDefaultActionbar
,
}
},
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录