-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose client tools auto update for find endpoint #46785
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1516,7 +1516,7 @@ func (h *Handler) find(w http.ResponseWriter, r *http.Request, p httprouter.Para | |
if err != nil { | ||
return nil, trace.Wrap(err) | ||
} | ||
return webclient.PingResponse{ | ||
response := webclient.PingResponse{ | ||
Auth: webclient.AuthenticationSettings{ | ||
// Nodes need the signature algorithm suite when joining to generate | ||
// keys with the correct algorithm. | ||
|
@@ -1526,7 +1526,23 @@ func (h *Handler) find(w http.ResponseWriter, r *http.Request, p httprouter.Para | |
ServerVersion: teleport.Version, | ||
MinClientVersion: teleport.MinClientVersion, | ||
ClusterName: h.auth.clusterName, | ||
}, nil | ||
} | ||
|
||
autoUpdateConfig, err := h.GetAccessPoint().GetAutoUpdateConfig(r.Context()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the auth preference above is retrieved using |
||
if err != nil && !trace.IsNotFound(err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it may also be possible to get a NotImplemented error back if the Proxy is newer than Auth. Even though this should be reading from the cache most of the time, a cluster admin can disable the cache, in which case this would make an RPC request to the old auth instance that doesn't implement the autoupdate service. |
||
return nil, trace.Wrap(err) | ||
} else if err == nil { | ||
response.ToolsAutoupdate = autoUpdateConfig.GetSpec().GetToolsAutoupdate() | ||
} | ||
|
||
autoUpdateVersion, err := h.GetAccessPoint().GetAutoUpdateVersion(r.Context()) | ||
if err != nil && !trace.IsNotFound(err) { | ||
return nil, trace.Wrap(err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should failing to retrieve auto update information prevent the response entirely? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added logging instead, but we might generate a lot of log messages with this error message in frequent requests to this endpoint |
||
} else if err == nil { | ||
response.ToolsVersion = autoUpdateVersion.GetSpec().GetToolsVersion() | ||
} | ||
|
||
return response, nil | ||
} | ||
|
||
func (h *Handler) pingWithConnector(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the auto update information all be contained within another struct instead of adding each individual field to the response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grouping fields to another struct would be better, will change this one