Skip to content

Commit

Permalink
Warn when connecting to an Enterprise traffic-manager from an OSS client
Browse files Browse the repository at this point in the history
The difference between the OSS and the Enterprise offering is not well
understood, and OSS users often install a traffic-manager using the Helm
chart published at getambassador.io. This Helm chart installs an
enterprise traffic-manager, which is probably not what the user would
expect. Telepresence will now warn when an OSS client connects to an
enterprise traffic-manager and suggest switching to an enterprise
client, or use `telepresence helm install` to install an OSS
traffic-manager.

Signed-off-by: Thomas Hallgren <thomas@datawire.io>
  • Loading branch information
thallgren committed Jun 10, 2024
1 parent a087041 commit c305689
Show file tree
Hide file tree
Showing 7 changed files with 552 additions and 512 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ items:
- version: 2.19.0
date: (TBD)
notes:
- type: feature
title: Warn when an Open Source Client connects to an Enterprise Traffic Manager.
body: >-
The difference between the OSS and the Enterprise offering is not well understood, and OSS users often install
a traffic-manager using the Helm chart published at getambassador.io. This Helm chart installs an enterprise
traffic-manager, which is probably not what the user would expect. Telepresence will now warn when an OSS client
connects to an enterprise traffic-manager and suggest switching to an enterprise client, or use
<code>telepresence helm install</code> to install an OSS traffic-manager.
- type: bugfix
title: Kubeconfig exec authentication failure when connecting with --docker from a WSL linux host
body: >-
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/cli/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ func getStatusInfo(ctx context.Context, di *daemon.Info) (*StatusInfo, error) {
}
}

if v, err := userD.TrafficManagerVersion(ctx, &empty.Empty{}); err == nil {
if mv := status.ManagerVersion; mv != nil {
tm := &wt.TrafficManager
tm.Name = v.Name
tm.Version = v.Version
tm.Name = mv.Name
tm.Version = mv.Version
if af, err := userD.AgentImageFQN(ctx, &empty.Empty{}); err == nil {
tm.TrafficAgent = af.FQN
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/client/cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ func daemonVersion(ctx context.Context) (*common.VersionInfo, error) {
}

func managerVersion(ctx context.Context) (*common.VersionInfo, error) {
if s := daemon.GetSession(ctx); s != nil {
mv := s.Info.ManagerVersion
return &common.VersionInfo{
Version: mv.Version,
Name: mv.Name,
}, nil
}
if userD := daemon.GetUserClient(ctx); userD != nil {
return userD.TrafficManagerVersion(ctx, &empty.Empty{})
}
Expand Down
24 changes: 15 additions & 9 deletions pkg/client/cli/connect/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,12 @@ func connectSession(ctx context.Context, useLine string, userD *daemon.UserClien
}
}

// warn if version diff between cli and manager is > 3
warnMngrVersion := func() error {
version, err := userD.TrafficManagerVersion(ctx, &emptypb.Empty{})
if err != nil {
return err
}
// warn if the version diff between cli and manager is > 3 or if there's an OSS/Enterprise mismatch.
warnMngrVersion := func(ci *connector.ConnectInfo) error {
mv := ci.ManagerVersion

// remove leading v from semver
mSemver, err := semver.Parse(strings.TrimPrefix(version.Version, "v"))
mSemver, err := semver.Parse(strings.TrimPrefix(mv.Version, "v"))
if err != nil {
return err
}
Expand All @@ -425,7 +422,16 @@ func connectSession(ctx context.Context, useLine string, userD *daemon.UserClien
if diff > maxDiff {
ioutil.Printf(output.Info(ctx),
"The Traffic Manager version (%s) is more than %v minor versions diff from client version (%s), please consider upgrading.\n",
version.Version, maxDiff, client.Version())
mv.Version, maxDiff, client.Version())
}

cv := ci.Version
if strings.HasPrefix(cv.Name, "OSS ") && !strings.HasPrefix(mv.Name, "OSS ") {
ioutil.Printf(output.Info(ctx),
"You are using the OSS client %s to connect to an enterprise traffic manager %s. Please consider installing an\n"+
"enterprise client from getambassador.io, or use \"telepresence helm install\" to install an OSS traffic-manager\n",
cv.Version,
mv.Version)
}
return nil
}
Expand All @@ -436,7 +442,7 @@ func connectSession(ctx context.Context, useLine string, userD *daemon.UserClien
switch ci.Error {
case connector.ConnectInfo_UNSPECIFIED:
ioutil.Printf(output.Info(ctx), "Connected to context %s, namespace %s (%s)\n", ci.ClusterContext, ci.Namespace, ci.ClusterServer)
err := warnMngrVersion()
err := warnMngrVersion(ci)
if err != nil {
dlog.Error(ctx, err)
}
Expand Down
22 changes: 13 additions & 9 deletions pkg/client/userd/trafficmgr/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,15 +875,19 @@ func (s *session) Status(c context.Context) *rpc.ConnectInfo {
func (s *session) status(c context.Context, initial bool) *rpc.ConnectInfo {
cfg := s.Kubeconfig
ret := &rpc.ConnectInfo{
ClusterContext: cfg.Context,
ClusterServer: cfg.Server,
ClusterId: s.GetClusterId(c),
ManagerInstallId: s.GetManagerInstallId(c),
SessionInfo: s.SessionInfo(),
ConnectionName: s.daemonID.Name,
KubeFlags: s.OriginalFlagMap,
Namespace: s.Namespace,
Intercepts: &manager.InterceptInfoSnapshot{Intercepts: s.getCurrentInterceptInfos()},
ClusterContext: cfg.Context,
ClusterServer: cfg.Server,
ClusterId: s.GetClusterId(c),
ManagerInstallId: s.GetManagerInstallId(c),
SessionInfo: s.SessionInfo(),
ConnectionName: s.daemonID.Name,
KubeFlags: s.OriginalFlagMap,
Namespace: s.Namespace,
Intercepts: &manager.InterceptInfoSnapshot{Intercepts: s.getCurrentInterceptInfos()},
ManagerVersion: &manager.VersionInfo2{
Name: s.managerName,
Version: "v" + s.managerVersion.String(),
},
ManagerNamespace: cfg.GetManagerNamespace(),
SubnetViaWorkloads: s.subnetViaWorkloads,
Version: &common.VersionInfo{
Expand Down
Loading

0 comments on commit c305689

Please sign in to comment.