Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions service/microceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions service/microcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions service/microovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions service/service_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"time"

"github.com/canonical/lxd/shared/api"

Expand All @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, why we are extending the lifetime to an hour specifically (for example are 30 mins insufficient)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max session timeout for joining/discovering MicroCloud members is also capped at one hour.
So I didn't want to go beyond what we already defined to be a max limit for joining a MicroCloud.
Now equally it should be safe to say that join tokens are also permitted to last for one hour.

With one hour I suspect we can accommodate all of the scenarios in which MicroCloud gets deployed with many resources or on slower environments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :D


// Handler holds a set of stateful services.
type Handler struct {
Services map[types.ServiceType]Service
Expand Down
Loading