Skip to content

Commit 320c572

Browse files
authored
admin: Make sure that any admin routers are provisioned when local/re… (#6997)
* admin: Make sure that any admin routers are provisioned when local/remote admin servers are replaced at runtime. * admin: check for provisioning errors during admin server replacements
1 parent aa3d20b commit 320c572

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

admin.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,13 @@ func replaceLocalAdminServer(cfg *Config, ctx Context) error {
424424

425425
handler := cfg.Admin.newAdminHandler(addr, false, ctx)
426426

427+
// run the provisioners for loaded modules to make sure local
428+
// state is properly re-initialized in the new admin server
429+
err = cfg.Admin.provisionAdminRouters(ctx)
430+
if err != nil {
431+
return err
432+
}
433+
427434
ln, err := addr.Listen(context.TODO(), 0, net.ListenConfig{})
428435
if err != nil {
429436
return err
@@ -545,6 +552,13 @@ func replaceRemoteAdminServer(ctx Context, cfg *Config) error {
545552
// because we are using TLS authentication instead
546553
handler := cfg.Admin.newAdminHandler(addr, true, ctx)
547554

555+
// run the provisioners for loaded modules to make sure local
556+
// state is properly re-initialized in the new admin server
557+
err = cfg.Admin.provisionAdminRouters(ctx)
558+
if err != nil {
559+
return err
560+
}
561+
548562
// create client certificate pool for TLS mutual auth, and extract public keys
549563
// so that we can enforce access controls at the application layer
550564
clientCertPool := x509.NewCertPool()

0 commit comments

Comments
 (0)