Add test ability to reinitialize worker auth roots on startup (#4895)
This commit is contained in:
1 parent
b54608b9f2
commit
d547e0d459
3 files changed
+10
-1
No files matched your search
@@ -21,6 +21,8 @@ type Config struct {
|
||||
DisableAuthorizationFailures bool
|
||||
// Override worker auth CA certificate lifetime for testing
|
||||
TestOverrideWorkerAuthCaCertificateLifetime time.Duration
|
||||
// Reinitialize the roots at startup
|
||||
TestWorkerAuthCaReinitialize bool
|
||||
|
||||
// This is derived from the config.Config. It tracks the state of the
|
||||
// rate limiter's configuration, and is updated if the config changes via a
|
||||
|
||||
@@ -475,7 +475,7 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to instantiate worker auth repository: %w", err)
|
||||
}
|
||||
_, err = server.RotateRoots(ctx, serversRepo, nodeenrollment.WithCertificateLifetime(conf.TestOverrideWorkerAuthCaCertificateLifetime))
|
||||
_, err = server.RotateRoots(ctx, serversRepo, nodeenrollment.WithCertificateLifetime(conf.TestOverrideWorkerAuthCaCertificateLifetime), nodeenrollment.WithReinitializeRoots(conf.TestWorkerAuthCaReinitialize))
|
||||
if err != nil {
|
||||
event.WriteSysEvent(ctx, op, "unable to ensure worker auth roots exist, may be due to multiple controllers starting at once, continuing")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user