Skip to content

Commit

Permalink
CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vapopov committed Sep 17, 2024
1 parent e6d56fc commit eead83c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 0 additions & 4 deletions api/client/webclient/webclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,6 @@ type PingResponse struct {
ServerVersion string `json:"server_version"`
// MinClientVersion is the minimum client version required by the server.
MinClientVersion string `json:"min_client_version"`
// ToolsVersion defines the version of {tsh, tctl} for client auto-upgrade.
ToolsVersion string `json:"tools_version"`
// ToolsAutoupdate enables client autoupdate feature.
ToolsAutoupdate bool `json:"tools_autoupdate"`
// ClusterName contains the name of the Teleport cluster.
ClusterName string `json:"cluster_name"`

Expand Down
7 changes: 5 additions & 2 deletions lib/auth/authclient/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,11 @@ type Cache interface {
// DatabaseObjectsGetter defines methods for fetching database objects.
services.DatabaseObjectsGetter

// AutoUpdateServiceGetter defines method for fetching the auto update config and version resources.
services.AutoUpdateServiceGetter
// GetAutoUpdateConfig gets the autoupdate config from the backend.
GetAutoUpdateConfig(ctx context.Context) (*autoupdate.AutoUpdateConfig, error)

// GetAutoUpdateVersion gets the autoupdate version from the backend.
GetAutoUpdateVersion(ctx context.Context) (*autoupdate.AutoUpdateVersion, error)

// GetAccessGraphSettings returns the access graph settings.
GetAccessGraphSettings(context.Context) (*clusterconfigpb.AccessGraphSettings, error)
Expand Down
10 changes: 8 additions & 2 deletions lib/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,12 @@ func (c *Cache) GetClusterName(opts ...services.MarshalOption) (types.ClusterNam
return rg.reader.GetClusterName(opts...)
}

type autoUpdateCacheKey struct {
kind string
}

var _ map[autoUpdateCacheKey]struct{} // compile-time hashability check

// GetAutoUpdateConfig gets the autoupdate config from the backend.
func (c *Cache) GetAutoUpdateConfig(ctx context.Context) (*autoupdate.AutoUpdateConfig, error) {
ctx, span := c.Tracer.Start(ctx, "cache/GetAutoUpdateConfig")
Expand All @@ -1907,7 +1913,7 @@ func (c *Cache) GetAutoUpdateConfig(ctx context.Context) (*autoupdate.AutoUpdate
}
defer rg.Release()
if !rg.IsCacheRead() {
cachedConfig, err := utils.FnCacheGet(ctx, c.fnCache, clusterConfigCacheKey{"name"}, func(ctx context.Context) (*autoupdate.AutoUpdateConfig, error) {
cachedConfig, err := utils.FnCacheGet(ctx, c.fnCache, autoUpdateCacheKey{"config"}, func(ctx context.Context) (*autoupdate.AutoUpdateConfig, error) {
cfg, err := rg.reader.GetAutoUpdateConfig(ctx)
return cfg, err
})
Expand All @@ -1930,7 +1936,7 @@ func (c *Cache) GetAutoUpdateVersion(ctx context.Context) (*autoupdate.AutoUpdat
}
defer rg.Release()
if !rg.IsCacheRead() {
cachedVersion, err := utils.FnCacheGet(ctx, c.fnCache, clusterConfigCacheKey{"name"}, func(ctx context.Context) (*autoupdate.AutoUpdateVersion, error) {
cachedVersion, err := utils.FnCacheGet(ctx, c.fnCache, autoUpdateCacheKey{"version"}, func(ctx context.Context) (*autoupdate.AutoUpdateVersion, error) {
version, err := rg.reader.GetAutoUpdateVersion(ctx)
return version, err
})
Expand Down

0 comments on commit eead83c

Please sign in to comment.