mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
6b5b69378f
This is replaces dqlite with etcd. The each same UX of dqlite is followed so there is no change to the CLI args for this.
84 lines
1.8 KiB
Go
84 lines
1.8 KiB
Go
// +build !no_embedded_executor
|
|
|
|
package executor
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"k8s.io/apiserver/pkg/authentication/authenticator"
|
|
|
|
proxy "k8s.io/kubernetes/cmd/kube-proxy/app"
|
|
kubelet "k8s.io/kubernetes/cmd/kubelet/app"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"k8s.io/kubernetes/cmd/kube-apiserver/app"
|
|
cmapp "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
|
sapp "k8s.io/kubernetes/cmd/kube-scheduler/app"
|
|
)
|
|
|
|
func init() {
|
|
executor = Embedded{}
|
|
}
|
|
|
|
type Embedded struct{}
|
|
|
|
func (Embedded) Kubelet(args []string) error {
|
|
command := kubelet.NewKubeletCommand(context.Background().Done())
|
|
command.SetArgs(args)
|
|
|
|
go func() {
|
|
logrus.Fatalf("kubelet exited: %v", command.Execute())
|
|
}()
|
|
|
|
return nil
|
|
}
|
|
|
|
func (Embedded) KubeProxy(args []string) error {
|
|
command := proxy.NewProxyCommand()
|
|
command.SetArgs(args)
|
|
|
|
go func() {
|
|
logrus.Fatalf("kube-proxy exited: %v", command.Execute())
|
|
}()
|
|
|
|
return nil
|
|
}
|
|
|
|
func (Embedded) APIServer(ctx context.Context, etcdReady <-chan struct{}, args []string) (authenticator.Request, http.Handler, error) {
|
|
<-etcdReady
|
|
command := app.NewAPIServerCommand(ctx.Done())
|
|
command.SetArgs(args)
|
|
|
|
go func() {
|
|
logrus.Fatalf("apiserver exited: %v", command.Execute())
|
|
}()
|
|
|
|
startupConfig := <-app.StartupConfig
|
|
return startupConfig.Authenticator, startupConfig.Handler, nil
|
|
}
|
|
|
|
func (Embedded) Scheduler(apiReady <-chan struct{}, args []string) error {
|
|
command := sapp.NewSchedulerCommand()
|
|
command.SetArgs(args)
|
|
|
|
go func() {
|
|
<-apiReady
|
|
logrus.Fatalf("scheduler exited: %v", command.Execute())
|
|
}()
|
|
|
|
return nil
|
|
}
|
|
|
|
func (Embedded) ControllerManager(apiReady <-chan struct{}, args []string) error {
|
|
command := cmapp.NewControllerManagerCommand()
|
|
command.SetArgs(args)
|
|
|
|
go func() {
|
|
<-apiReady
|
|
logrus.Fatalf("controller-manager exited: %v", command.Execute())
|
|
}()
|
|
|
|
return nil
|
|
}
|