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.
34 lines
579 B
Go
34 lines
579 B
Go
// +build !no_embedded_executor
|
|
|
|
package executor
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"go.etcd.io/etcd/embed"
|
|
)
|
|
|
|
func (e Embedded) CurrentETCDOptions() (InitialOptions, error) {
|
|
return InitialOptions{}, nil
|
|
}
|
|
|
|
func (e Embedded) ETCD(args ETCDConfig) error {
|
|
configFile, err := args.ToConfigFile()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
cfg, err := embed.ConfigFromFile(configFile)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
etcd, err := embed.StartEtcd(cfg)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
go func() {
|
|
err := <-etcd.Err()
|
|
logrus.Fatalf("etcd exited: %v", err)
|
|
}()
|
|
return nil
|
|
}
|