mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Don't run leader elections on controllers when no leader election
This commit is contained in:
parent
f0382329a5
commit
8f597ba168
@ -110,14 +110,24 @@ func startWrangler(ctx context.Context, config *Config) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
go leader.RunOrDie(ctx, "", "k3s", sc.K8s, func(ctx context.Context) {
|
start := func(ctx context.Context) {
|
||||||
if err := masterControllers(ctx, sc, config); err != nil {
|
if err := masterControllers(ctx, sc, config); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err := sc.Start(ctx); err != nil {
|
if err := sc.Start(ctx); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if controlConfig.NoLeaderElect {
|
||||||
|
go func() {
|
||||||
|
start(ctx)
|
||||||
|
<-ctx.Done()
|
||||||
|
logrus.Fatal("controllers exited")
|
||||||
|
}()
|
||||||
|
} else {
|
||||||
|
go leader.RunOrDie(ctx, "", "k3s", sc.K8s, start)
|
||||||
|
}
|
||||||
|
|
||||||
return certs, nil
|
return certs, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user