mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-20 11:22:19 +08:00
Automatic merge from release/2.3.0 -> release/2.4.0
* commit 'ea8bf9db85aac920c310374f4ed0d394d0b9181d': climc: kube cluster restart agents
This commit is contained in:
@@ -203,4 +203,17 @@ func initCluster() {
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterRestartAgentsOptions{}, cmdN("restart-agent"), "Restart node agents in cluster", func(s *mcclient.ClientSession, args *o.ClusterRestartAgentsOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Clusters.PerformAction(s, args.ID, "restart-agent", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -194,3 +194,21 @@ func (o ClusterDeleteNodesOptions) Params() (*jsonutils.JSONDict, error) {
|
||||
params.Add(nodesArray, "nodes")
|
||||
return params, nil
|
||||
}
|
||||
|
||||
type ClusterRestartAgentsOptions struct {
|
||||
ClusterDeleteNodesOptions
|
||||
All bool `help:"Restart all nodes agent"`
|
||||
}
|
||||
|
||||
func (o ClusterRestartAgentsOptions) Params() (*jsonutils.JSONDict, error) {
|
||||
params, err := o.ClusterDeleteNodesOptions.Params()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
all := jsonutils.JSONFalse
|
||||
if o.All {
|
||||
all = jsonutils.JSONTrue
|
||||
}
|
||||
params.Add(all, "all")
|
||||
return params, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user