mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
climc: k8s release rollback
This commit is contained in:
@@ -66,4 +66,22 @@ func initRelease() {
|
||||
_, err := k8s.Releases.Delete(s, args.NAME, args.Params())
|
||||
return err
|
||||
})
|
||||
|
||||
R(&o.ReleaseHistoryOptions{}, cmdN("history"), "Get release history", func(s *mcclient.ClientSession, args *o.ReleaseHistoryOptions) error {
|
||||
ret, err := k8s.Releases.GetSpecific(s, args.NAME, "history", args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObjectYAML(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ReleaseRollbackOptions{}, cmdN("rollback"), "Rollback release by history revision number", func(s *mcclient.ClientSession, args *o.ReleaseRollbackOptions) error {
|
||||
ret, err := k8s.Releases.PerformAction(s, args.NAME, "rollback", args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObjectYAML(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -128,3 +128,33 @@ type ReleaseDeleteOptions struct {
|
||||
ClusterBaseOptions
|
||||
NAME string `help:"Release instance name"`
|
||||
}
|
||||
|
||||
type ReleaseHistoryOptions struct {
|
||||
ClusterBaseOptions
|
||||
NAME string `help:"Release instance name"`
|
||||
Max int64 `help:"History limit size"`
|
||||
}
|
||||
|
||||
func (o ReleaseHistoryOptions) Params() *jsonutils.JSONDict {
|
||||
params := o.ClusterBaseOptions.Params()
|
||||
if o.Max >= 1 {
|
||||
params.Add(jsonutils.NewInt(o.Max), "max")
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
type ReleaseRollbackOptions struct {
|
||||
ClusterBaseOptions
|
||||
NAME string `help:"Release instance name"`
|
||||
REVISION int64 `help:"Release history revision number"`
|
||||
Description string `help:"Release rollback description string"`
|
||||
}
|
||||
|
||||
func (o ReleaseRollbackOptions) Params() *jsonutils.JSONDict {
|
||||
params := o.ClusterBaseOptions.Params()
|
||||
params.Add(jsonutils.NewInt(o.REVISION), "revision")
|
||||
if o.Description != "" {
|
||||
params.Add(jsonutils.NewString(o.Description), "description")
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user