Skip to content

Commit 30e6856

Browse files
committed
Fix root daemon access when running with embedded root daemon
When the user daemon runs with an embedded root daemon (e.g., in Docker mode), calls to RootDaemonVersion and withRootDaemon failed because they didn't account for the in-process root session. RootDaemonVersion now returns the local version directly, and withRootDaemon delegates to the session's WithRootClient when a session is available. Signed-off-by: Thomas Hallgren <thomas@tada.se>
1 parent 21e6a33 commit 30e6856

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version: "2.27.0"
2-
dlVersion: "v2.27.0"
2+
dlVersion: "v2.27.0"

pkg/client/userd/daemon/grpc.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ func (s *service) TrafficManagerVersion(ctx context.Context, _ *empty.Empty) (vi
448448
}
449449

450450
func (s *service) RootDaemonVersion(ctx context.Context, empty *empty.Empty) (vi *common.VersionInfo, err error) {
451+
if s.rootSessionInProc {
452+
return client.VersionInfo(ctx), nil
453+
}
451454
err = s.withRootDaemon(ctx, func(ctx context.Context, rd daemon.DaemonClient) error {
452455
vi, err = rd.Version(s, empty)
453456
return err
@@ -631,6 +634,12 @@ func (s *service) RerouteRemotePort(ctx context.Context, request *daemon.Reroute
631634
}
632635

633636
func (s *service) withRootDaemon(ctx context.Context, f func(ctx context.Context, daemonClient daemon.DaemonClient) error) error {
637+
s.sessionLock.RLock()
638+
defer s.sessionLock.RUnlock()
639+
if s.session != nil {
640+
return s.session.WithRootClient(ctx, f)
641+
}
642+
634643
if s.rootSessionInProc {
635644
return status.Error(codes.Unavailable, "root daemon is embedded")
636645
}

0 commit comments

Comments
 (0)