Automatic merge from release/2.1.0 -> release/2.2.0

* commit '3485184266e553d278c9c68ddaae3850dbc4cc8a':
  webconsole: use external frontend
  - remove unused code - add rpm build files
  vendor added
  webterm init
This commit is contained in:
李泽玺
2018-09-05 16:10:36 +08:00
129 changed files with 11874 additions and 1 deletions
+19
View File
@@ -3,6 +3,8 @@ package k8s
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
)
@@ -28,6 +30,23 @@ func initPod() {
return nil
})
type getOpt struct {
resourceGetOptions
}
R(&getOpt{}, cmdN("show"), "Get pod details", func(s *mcclient.ClientSession, args *getOpt) error {
id := args.NAME
params := args.ClusterParams()
if args.Namespace != "" {
params.Add(jsonutils.NewString(args.Namespace), "namespace")
}
ret, err := k8s.Pods.Get(s, id, params)
if err != nil {
return err
}
printObjectYAML(ret)
return nil
})
type deleteOpt struct {
resourceGetOptions
}
+59
View File
@@ -0,0 +1,59 @@
package shell
import (
"fmt"
"net/url"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
o "yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
handleResult := func(opt o.WebConsoleFrontendOptions, obj jsonutils.JSONObject) error {
if opt.WebUrl == "" {
printObject(obj)
return nil
}
u, err := url.Parse(opt.WebUrl)
if err != nil {
return err
}
connParams, err := obj.GetString("connect_params")
if err != nil {
return err
}
u.Path = "index.html"
u.RawQuery = connParams
fmt.Println(u.String())
return nil
}
R(&o.PodShellOptions{}, "webconsole-k8s-pod", "Show TTY console of given pod", func(s *mcclient.ClientSession, args *o.PodShellOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := modules.WebConsole.DoK8sShellConnect(s, args.NAME, params)
if err != nil {
return err
}
handleResult(args.WebConsoleFrontendOptions, ret)
return nil
})
R(&o.PodLogOptoins{}, "webconsole-k8s-pod-log", "Get logs of given pod", func(s *mcclient.ClientSession, args *o.PodLogOptoins) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := modules.WebConsole.DoK8sLogConnect(s, args.NAME, params)
if err != nil {
return err
}
handleResult(args.WebConsoleFrontendOptions, ret)
return nil
})
}
+9
View File
@@ -0,0 +1,9 @@
package main
import (
"yunion.io/x/onecloud/pkg/webconsole/service"
)
func main() {
service.StartService()
}