diff --git a/container/server/go.mod b/container/server/go.mod index ca185e8a0d4068dc5e771e8c96bf18d681b67ab7..37df3860ee7cb812cb0334f6dd020392a898c975 100644 --- a/container/server/go.mod +++ b/container/server/go.mod @@ -17,7 +17,8 @@ require ( github.com/bytedance/sonic v1.8.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/containerd/containerd v1.6.18 // indirect - github.com/docker/docker v23.0.2+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/docker/docker v24.0.2+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect diff --git a/container/server/go.sum b/container/server/go.sum index 76c4b8442f750404792d6163a37b6d7b0f05c9ea..e5273332246ae6fea7c324a862cc0a8ea4703c4f 100644 --- a/container/server/go.sum +++ b/container/server/go.sum @@ -26,8 +26,12 @@ github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v23.0.2+incompatible h1:q81C2qQ/EhPm8COZMUGOQYh4qLv4Xu6CXELJ3WK/mlU= github.com/docker/docker v23.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= +github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= diff --git a/container/server/httphandler/container.go b/container/server/httphandler/container.go index c0ffafcd1669f6fda5ad452b0c2df82b85a9e4fc..bcffe60e8b28615f12c0703a9dbbb9438463a727 100644 --- a/container/server/httphandler/container.go +++ b/container/server/httphandler/container.go @@ -3,11 +3,12 @@ package httphandler import ( "log" + "github.com/docker/docker/client" docker "github.com/fsouza/go-dockerclient" "github.com/gin-gonic/gin" ) -func GetContainerList(ctx *gin.Context) { +func ContainerList(ctx *gin.Context) { client, err := docker.NewClient("tcp://127.0.0.1:2375") if err != nil { log.Fatal(err) @@ -24,6 +25,11 @@ func GetContainerList(ctx *gin.Context) { } func RunContainer(ctx *gin.Context) { + cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + panic(err) + } + defer cli.Close() } diff --git a/container/server/httphandler/daemon.go b/container/server/httphandler/daemon.go new file mode 100644 index 0000000000000000000000000000000000000000..6f872a77ed6bee58eb2cfaf56dce68dbae19f47a --- /dev/null +++ b/container/server/httphandler/daemon.go @@ -0,0 +1 @@ +package httphandler diff --git a/container/server/httphandler/event.go b/container/server/httphandler/event.go new file mode 100644 index 0000000000000000000000000000000000000000..cf19bb9b5fa0e956b7cb42a1495f473cea2bd69d --- /dev/null +++ b/container/server/httphandler/event.go @@ -0,0 +1 @@ +package httphandler \ No newline at end of file diff --git a/container/server/httphandler/monitor.go b/container/server/httphandler/monitor.go new file mode 100644 index 0000000000000000000000000000000000000000..61935fe0f27f43520d738459ce0e39945ba1dbe9 --- /dev/null +++ b/container/server/httphandler/monitor.go @@ -0,0 +1,5 @@ +package httphandler + +func DeployCadvisor() { + +} diff --git a/container/server/httphandler/plugin.go b/container/server/httphandler/plugin.go new file mode 100644 index 0000000000000000000000000000000000000000..cf19bb9b5fa0e956b7cb42a1495f473cea2bd69d --- /dev/null +++ b/container/server/httphandler/plugin.go @@ -0,0 +1 @@ +package httphandler \ No newline at end of file diff --git a/gala-ops/server/client/client.go b/gala-ops/server/client/client.go index 58ce2c602dddfa96d58668a34ff933c6e8cd23e0..beb14fe2a34b89ebbcaf392aaa1a573f2c7ad92b 100644 --- a/gala-ops/server/client/client.go +++ b/gala-ops/server/client/client.go @@ -1,16 +1,16 @@ package client import ( + splugin "gitee.com/openeuler/PilotGo-plugins/sdk/plugin" "openeuler.org/PilotGo/gala-ops-plugin/config" - "openeuler.org/PilotGo/plugin-sdk/plugin" ) const Version = "0.0.1" -var globalClient *plugin.Client +var globalClient *splugin.Client func init() { - globalClient = plugin.DefaultClient(&plugin.PluginInfo{ + globalClient = splugin.DefaultClient(&splugin.PluginInfo{ Name: "gala-ops", Version: Version, Description: "gala-ops智能运维工具", @@ -21,7 +21,7 @@ func init() { }) } -func Client() *plugin.Client { +func Client() *splugin.Client { return globalClient } diff --git a/gala-ops/server/main.go b/gala-ops/server/main.go index 8e27f588a97339c016385a9cf23907b25682139d..e7159ac91530e6b5c10792d63a899dddebf863e4 100644 --- a/gala-ops/server/main.go +++ b/gala-ops/server/main.go @@ -31,7 +31,7 @@ func registerHandlers(engine *gin.Engine) { api := engine.Group("/plugin/gala-ops/api") { // 脚本执行结果接口 - api.PUT("/run_script_result", httphandler.RunScriptResult) + // api.PUT("/run_script_result", httphandler.RunScriptResult) // 安装/升级/卸载gala-gopher监控终端 api.PUT("/install_gopher", httphandler.InstallGopher)