diff --git a/service/microceph.go b/service/microceph.go index 4ff839be1..901cd4526 100644 --- a/service/microceph.go +++ b/service/microceph.go @@ -103,9 +103,10 @@ func (s CephService) Bootstrap(ctx context.Context) error { } } -// IssueToken issues a token for the given peer. Each token will last 5 minutes in case the system joins the cluster very slowly. +// IssueToken issues a token for the given peer. +// Each token will last 1 hour in case the system joins the cluster very slowly or there are other services which take longer to join (e.g. MicroCeph OSD setup). func (s CephService) IssueToken(ctx context.Context, peer string) (string, error) { - return s.m.NewJoinToken(ctx, peer, 5*time.Minute) + return s.m.NewJoinToken(ctx, peer, ServiceJoinTokenLifetime) } // DeleteToken deletes a token by its name. diff --git a/service/microcloud.go b/service/microcloud.go index 29680229e..af9874b5e 100644 --- a/service/microcloud.go +++ b/service/microcloud.go @@ -99,9 +99,10 @@ func (s CloudService) Bootstrap(ctx context.Context) error { } } -// IssueToken issues a token for the given peer. Each token will last 5 minutes in case the system joins the cluster very slowly. +// IssueToken issues a token for the given peer. +// Each token will last 1 hour in case the system joins the cluster very slowly or there are other services which take longer to join (e.g. MicroCeph OSD setup). func (s CloudService) IssueToken(ctx context.Context, peer string) (string, error) { - return s.client.NewJoinToken(ctx, peer, 5*time.Minute) + return s.client.NewJoinToken(ctx, peer, ServiceJoinTokenLifetime) } // DeleteToken deletes a token by its name. diff --git a/service/microovn.go b/service/microovn.go index 477e34ad8..bd43b0d39 100644 --- a/service/microovn.go +++ b/service/microovn.go @@ -89,9 +89,10 @@ func (s OVNService) Bootstrap(ctx context.Context) error { } } -// IssueToken issues a token for the given peer. Each token will last 5 minutes in case the system joins the cluster very slowly. +// IssueToken issues a token for the given peer. +// Each token will last 1 hour in case the system joins the cluster very slowly or there are other services which take longer to join (e.g. MicroCeph OSD setup). func (s OVNService) IssueToken(ctx context.Context, peer string) (string, error) { - return s.m.NewJoinToken(ctx, peer, 5*time.Minute) + return s.m.NewJoinToken(ctx, peer, ServiceJoinTokenLifetime) } // DeleteToken deletes a token by its name. diff --git a/service/service_handler.go b/service/service_handler.go index 82d83aef9..12e4ab99e 100644 --- a/service/service_handler.go +++ b/service/service_handler.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "sync" + "time" "github.com/canonical/lxd/shared/api" @@ -31,6 +32,9 @@ const ( CloudMulticastPort int64 = 9444 ) +// ServiceJoinTokenLifetime is the duration for which a join token issued by a service will be valid. +const ServiceJoinTokenLifetime = time.Hour + // Handler holds a set of stateful services. type Handler struct { Services map[types.ServiceType]Service