Files
k3s/tests/mock/executor.go
Brad Davidson d45006be66 Move etcd ready channel into executor
This eliminates the final channel that was being passed around in an internal struct. The ETCD management code passes in a func that can be polled until etcd is ready; the executor is responsible for polling this after etcd is started and closing the etcd ready channel at the correct time.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-24 12:42:29 -07:00

87 lines
2.3 KiB
Go

package mock
import (
"context"
"errors"
"net/http"
"github.com/k3s-io/k3s/pkg/cli/cmds"
"github.com/k3s-io/k3s/pkg/daemons/config"
"github.com/k3s-io/k3s/pkg/daemons/executor"
"k8s.io/apiserver/pkg/authentication/authenticator"
)
// mock executor that does not actually start anything
type Executor struct{}
func (e *Executor) Bootstrap(ctx context.Context, nodeConfig *config.Node, cfg cmds.Agent) error {
return errors.New("not implemented")
}
func (e *Executor) Kubelet(ctx context.Context, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) KubeProxy(ctx context.Context, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) APIServerHandlers(ctx context.Context) (authenticator.Request, http.Handler, error) {
return nil, nil, errors.New("not implemented")
}
func (e *Executor) APIServer(ctx context.Context, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) Scheduler(ctx context.Context, nodeReady <-chan struct{}, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) ControllerManager(ctx context.Context, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) CurrentETCDOptions() (executor.InitialOptions, error) {
return executor.InitialOptions{}, nil
}
func (e *Executor) ETCD(ctx context.Context, args *executor.ETCDConfig, extraArgs []string, test executor.TestFunc) error {
embed := &executor.Embedded{}
return embed.ETCD(ctx, args, extraArgs, test)
}
func (e *Executor) CloudControllerManager(ctx context.Context, ccmRBACReady <-chan struct{}, args []string) error {
return errors.New("not implemented")
}
func (e *Executor) Containerd(ctx context.Context, node *config.Node) error {
return errors.New("not implemented")
}
func (e *Executor) Docker(ctx context.Context, node *config.Node) error {
return errors.New("not implemented")
}
func (e *Executor) CRI(ctx context.Context, node *config.Node) error {
return errors.New("not implemented")
}
func (e *Executor) APIServerReadyChan() <-chan struct{} {
c := make(chan struct{})
close(c)
return c
}
func (e *Executor) ETCDReadyChan() <-chan struct{} {
c := make(chan struct{})
close(c)
return c
}
func (e *Executor) CRIReadyChan() <-chan struct{} {
c := make(chan struct{})
close(c)
return c
}