mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Add executor.Bootstrap hook for pre-execution setup
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
bcd8b67db4
commit
e10524a6b1
@ -26,6 +26,7 @@ import (
|
||||
cp "github.com/rancher/k3s/pkg/cloudprovider"
|
||||
"github.com/rancher/k3s/pkg/daemons/agent"
|
||||
daemonconfig "github.com/rancher/k3s/pkg/daemons/config"
|
||||
"github.com/rancher/k3s/pkg/daemons/executor"
|
||||
"github.com/rancher/k3s/pkg/nodeconfig"
|
||||
"github.com/rancher/k3s/pkg/rootless"
|
||||
"github.com/rancher/k3s/pkg/util"
|
||||
@ -91,6 +92,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := executor.Bootstrap(ctx, nodeConfig, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !nodeConfig.NoFlannel {
|
||||
if err := flannel.Prepare(ctx, nodeConfig); err != nil {
|
||||
return err
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
proxy "k8s.io/kubernetes/cmd/kube-proxy/app"
|
||||
kubelet "k8s.io/kubernetes/cmd/kubelet/app"
|
||||
|
||||
"github.com/rancher/k3s/pkg/cli/cmds"
|
||||
daemonconfig "github.com/rancher/k3s/pkg/daemons/config"
|
||||
"github.com/sirupsen/logrus"
|
||||
"k8s.io/kubernetes/cmd/kube-apiserver/app"
|
||||
cmapp "k8s.io/kubernetes/cmd/kube-controller-manager/app"
|
||||
@ -23,6 +25,10 @@ func init() {
|
||||
|
||||
type Embedded struct{}
|
||||
|
||||
func (Embedded) Bootstrap(ctx context.Context, nodeConfig *daemonconfig.Node, cfg cmds.Agent) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (Embedded) Kubelet(args []string) error {
|
||||
command := kubelet.NewKubeletCommand(context.Background())
|
||||
command.SetArgs(args)
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/rancher/k3s/pkg/cli/cmds"
|
||||
daemonconfig "github.com/rancher/k3s/pkg/daemons/config"
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
)
|
||||
|
||||
@ -17,6 +19,7 @@ var (
|
||||
)
|
||||
|
||||
type Executor interface {
|
||||
Bootstrap(ctx context.Context, nodeConfig *daemonconfig.Node, cfg cmds.Agent) error
|
||||
Kubelet(args []string) error
|
||||
KubeProxy(args []string) error
|
||||
APIServer(ctx context.Context, etcdReady <-chan struct{}, args []string) (authenticator.Request, http.Handler, error)
|
||||
@ -81,6 +84,10 @@ func Set(driver Executor) {
|
||||
executor = driver
|
||||
}
|
||||
|
||||
func Bootstrap(ctx context.Context, nodeConfig *daemonconfig.Node, cfg cmds.Agent) error {
|
||||
return executor.Bootstrap(ctx, nodeConfig, cfg)
|
||||
}
|
||||
|
||||
func Kubelet(args []string) error {
|
||||
return executor.Kubelet(args)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user