mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #6450 from zexi/feature/k8s-helm-cli
climc: update k8s resource cmd
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
@@ -41,11 +39,11 @@ func initRelease() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resources, err := ret.GetString("info", "status", "resources")
|
||||
resources, err := ret.Get("resources")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(resources)
|
||||
printObject(resources)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ func (c Columns) Array() []string {
|
||||
}
|
||||
|
||||
func NewNameCols(col ...string) *Columns {
|
||||
return NewColumns("Name").Add(col...)
|
||||
return NewColumns("Name", "Id").Add(col...)
|
||||
}
|
||||
|
||||
func NewMetaCols(col ...string) *Columns {
|
||||
|
||||
@@ -24,7 +24,7 @@ var (
|
||||
|
||||
func init() {
|
||||
Repos = NewResourceManager("repo", "repos",
|
||||
NewResourceCols("url", "is_public", "source"),
|
||||
NewResourceCols("url", "is_public", "source", "type"),
|
||||
NewColumns(),
|
||||
)
|
||||
modules.Register(Repos)
|
||||
|
||||
@@ -49,7 +49,7 @@ func (m *ReleaseAppManager) Create(session *mcclient.ClientSession, params jsonu
|
||||
|
||||
func init() {
|
||||
Releases = &ReleaseManager{
|
||||
NewNamespaceResourceManager("release", "releases", NewColumns(), NewColumns())}
|
||||
NewNamespaceResourceManager("release", "releases", NewNamespaceCols("status", "type"), NewColumns())}
|
||||
dummyReleaseApps = NewReleaseAppManager("releaseapp", "releaseapps")
|
||||
MeterReleaseApps = NewReleaseAppManager("app_meter", "app_meters")
|
||||
ServicetreeReleaseApps = NewReleaseAppManager("app_servicetree", "app_servicetrees")
|
||||
|
||||
@@ -24,7 +24,9 @@ type ClusterBaseOptions struct {
|
||||
|
||||
func (o ClusterBaseOptions) Params() *jsonutils.JSONDict {
|
||||
ret := jsonutils.NewDict()
|
||||
ret.Add(jsonutils.NewString(o.Cluster), "cluster")
|
||||
if o.Cluster != "" {
|
||||
ret.Add(jsonutils.NewString(o.Cluster), "cluster")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -47,6 +49,7 @@ type BaseListOptions struct {
|
||||
Limit int `default:"20" help:"Page limit"`
|
||||
Offset int `default:"0" help:"Page offset"`
|
||||
Name string `help:"Search by name"`
|
||||
System *bool `help:"Show system resource"`
|
||||
}
|
||||
|
||||
func (o BaseListOptions) Params() *jsonutils.JSONDict {
|
||||
@@ -60,6 +63,9 @@ func (o BaseListOptions) Params() *jsonutils.JSONDict {
|
||||
if o.Name != "" {
|
||||
params.Add(jsonutils.NewString(o.Name), "name")
|
||||
}
|
||||
if o.System != nil {
|
||||
params.Add(jsonutils.NewBool(*o.System), "system")
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ type ChartListOptions struct {
|
||||
AllVersion bool `help:"Get Chart all history versions"`
|
||||
Keyword string `help:"Chart keyword"`
|
||||
Version string `help:"Chart semver version filter"`
|
||||
Type string `help:"Chart type" choices:"internal|external"`
|
||||
}
|
||||
|
||||
func (o ChartListOptions) Params() *jsonutils.JSONDict {
|
||||
@@ -47,6 +48,9 @@ func (o ChartListOptions) Params() *jsonutils.JSONDict {
|
||||
if len(o.Keyword) != 0 {
|
||||
params.Add(jsonutils.NewString(o.Keyword), "keyword")
|
||||
}
|
||||
if o.Type != "" {
|
||||
params.Add(jsonutils.NewString(o.Type), "type")
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ type KubeClusterCreateOptions struct {
|
||||
|
||||
type KubeClusterImportOptions struct {
|
||||
NAME string `help:"Name of cluster"`
|
||||
APISERVER string `help:"API server of this cluster"`
|
||||
KUBECONFIG string `help:"Cluster kubeconfig file path"`
|
||||
}
|
||||
|
||||
@@ -163,7 +162,6 @@ func (o KubeClusterImportOptions) Params() (*jsonutils.JSONDict, error) {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(o.NAME), "name")
|
||||
params.Add(jsonutils.NewString("import"), "mode")
|
||||
params.Add(jsonutils.NewString(o.APISERVER), "api_server")
|
||||
params.Add(jsonutils.NewString(string(kubeconfig)), "kubeconfig")
|
||||
params.Add(jsonutils.NewString("external"), "provider")
|
||||
params.Add(jsonutils.NewString("unknown"), "resource_type")
|
||||
|
||||
@@ -30,6 +30,7 @@ type ReleaseListOptions struct {
|
||||
Failed bool `help:"Show failed status releases"`
|
||||
Superseded bool `help:"Show superseded status releases"`
|
||||
Pending bool `help:"Show pending status releases"`
|
||||
Type string `help:"Release type" choices:"internal|external"`
|
||||
}
|
||||
|
||||
func (o ReleaseListOptions) Params() *jsonutils.JSONDict {
|
||||
@@ -43,6 +44,9 @@ func (o ReleaseListOptions) Params() *jsonutils.JSONDict {
|
||||
if o.Name != "" {
|
||||
params.Add(jsonutils.NewString(o.Name), "name")
|
||||
}
|
||||
if o.Type != "" {
|
||||
params.Add(jsonutils.NewString(o.Type), "type")
|
||||
}
|
||||
params.Add(jsonutils.JSONTrue, "all")
|
||||
if o.Admin {
|
||||
params.Add(jsonutils.JSONTrue, "admin")
|
||||
|
||||
@@ -30,6 +30,7 @@ type RepoGetOptions struct {
|
||||
|
||||
type RepoCreateOptions struct {
|
||||
RepoGetOptions
|
||||
Type string `help:"Repository type" choices:"internal|external"`
|
||||
URL string `help:"Repository url"`
|
||||
Public bool `help:"Make repostitory public"`
|
||||
}
|
||||
@@ -38,6 +39,9 @@ func (o RepoCreateOptions) Params() *jsonutils.JSONDict {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(o.NAME), "name")
|
||||
params.Add(jsonutils.NewString(o.URL), "url")
|
||||
if o.Type != "" {
|
||||
params.Add(jsonutils.NewString(o.Type), "type")
|
||||
}
|
||||
if o.Public {
|
||||
params.Add(jsonutils.JSONTrue, "is_public")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user