This is a huge commit, it does following things:

1. refactor kubesphere dependency service client creation, we can
disable dependency by config
2. dependencies can be configured by configuration file
3. refactor cmd package using cobra.Command, so we can use hypersphere
to invoke command sepearately. Later we only need to build one image to
contains all kubesphere core components. One command to rule them all!
4. live reloading configuration currently not implemented
This commit is contained in:
Jeff
2019-09-03 15:20:22 +08:00
parent 52a1c2e619
commit 96d2ac4112
233 changed files with 26414 additions and 1927 deletions

View File

@@ -29,7 +29,7 @@ import (
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/remotecommand"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client"
)
// PtyHandler is what remotecommand expects from a pty
@@ -179,11 +179,9 @@ func HandleTerminalSession(session sockjs.Session) {
// Executed cmd in the container specified in request and connects it up with the ptyHandler (a session)
func startProcess(namespace, podName, containerName string, cmd []string, ptyHandler PtyHandler) error {
k8sClient := k8s.Client()
cfg, err := k8s.Config()
if err != nil {
return err
}
k8sClient := client.ClientSets().K8s().Kubernetes()
cfg := client.ClientSets().K8s().Config()
req := k8sClient.CoreV1().RESTClient().Post().
Resource("pods").
@@ -290,10 +288,6 @@ func NewSession(shell, namespace, podName, containerName string) (string, error)
sizeChan: make(chan remotecommand.TerminalSize),
}
if err != nil {
return "", err
}
go WaitingForConnection(shell, namespace, podName, containerName, sessionId)
return sessionId, nil