Simplify worker auth rotation timing logic (#3237)

* Simplify worker auth rotation timing logic

* Add some jitter
This commit is contained in:
Jeff Mitchell committed 2023-05-20 21:05:19 -04:00
1 parent 6f4f51cc9f
commit e0787f4de0
4 files changed
+66 -36

No files matched your search

+2 -1
View File
@@ -144,6 +144,7 @@ type Controller struct {
}
func New(ctx context.Context, conf *Config) (*Controller, error) {
const op = "controller.New"
metric.InitializeApiCollectors(conf.PrometheusRegisterer)
c := &Controller{
conf: conf,
@@ -395,7 +396,7 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
}
_, err = server.RotateRoots(ctx, serversRepo, nodeenrollment.WithCertificateLifetime(conf.TestOverrideWorkerAuthCaCertificateLifetime))
if err != nil {
return nil, fmt.Errorf("unable to ensure worker auth roots exist: %w", err)
event.WriteSysEvent(ctx, op, "unable to ensure worker auth roots exist, may be due to multiple controllers starting at once, continuing")
}
if downstreamersFactory != nil {