Skip to content

Commit

Permalink
[v16] Fix getting initial version for installation kube agent for EKS…
Browse files Browse the repository at this point in the history
… Discover enrollment in the Teleport cloud. (#43563)

* Fix getting initial version for installation kube agent for EKS Discover enrollment in the Teleport cloud.

* Use default channel instead of cloud default channel.
  • Loading branch information
AntonAM authored Jun 26, 2024
1 parent 26b067c commit d5b32eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/srv/discovery/kube_integration_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package discovery
import (
"context"
"errors"
"fmt"
"slices"
"strings"
"sync"
Expand Down Expand Up @@ -50,7 +51,14 @@ func (s *Server) startKubeIntegrationWatchers() error {

clt := s.AccessPoint

releaseChannels := automaticupgrades.Channels{}
pingResponse, err := s.AccessPoint.Ping(s.ctx)
if err != nil {
return trace.Wrap(err)
}
proxyPublicAddr := pingResponse.GetProxyPublicAddr()

releaseChannels := automaticupgrades.Channels{automaticupgrades.DefaultChannelName: &automaticupgrades.Channel{
ForwardURL: fmt.Sprintf("https://%s/webapi/automaticupgrades/channel/%s", proxyPublicAddr, automaticupgrades.DefaultChannelName)}}
if err := releaseChannels.CheckAndSetDefaults(); err != nil {
return trace.Wrap(err)
}
Expand Down Expand Up @@ -214,7 +222,7 @@ func (s *Server) getKubeAgentVersion(releaseChannels automaticupgrades.Channels)
agentVersion := pingResponse.ServerVersion

clusterFeatures := s.ClusterFeatures()
if clusterFeatures.GetAutomaticUpgrades() {
if clusterFeatures.GetAutomaticUpgrades() && clusterFeatures.GetCloud() {
defaultVersion, err := releaseChannels.DefaultVersion(s.ctx)
if err == nil {
agentVersion = defaultVersion
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/discovery/kube_integration_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestGetAgentVersion(t *testing.T) {
ping: func(ctx context.Context) (proto.PingResponse, error) {
return proto.PingResponse{ServerVersion: "10"}, nil
},
clusterFeatures: proto.Features{AutomaticUpgrades: true},
clusterFeatures: proto.Features{AutomaticUpgrades: true, Cloud: true},
channelVersion: "v1.2.3",
expectedVersion: "1.2.3",
errorAssert: require.NoError,
Expand Down

0 comments on commit d5b32eb

Please sign in to comment.