Skip to content

Commit

Permalink
Clean up some TODOs (#40001)
Browse files Browse the repository at this point in the history
There were some playback APIs that I was hoping could be deprecated
for v16, but it turns out they are still used by Teleport Assist.
  • Loading branch information
zmb3 authored Apr 7, 2024
1 parent ab69999 commit 63afd5f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/auth/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ func NewAPIServer(config *APIConfig) (http.Handler, error) {
srv.POST("/:version/tokens/register", srv.WithAuth(srv.registerUsingToken))

// Active sessions
srv.GET("/:version/namespaces/:namespace/sessions/:id/stream", srv.WithAuth(srv.getSessionChunk)) // DELETE IN 16(zmb3)
srv.GET("/:version/namespaces/:namespace/sessions/:id/events", srv.WithAuth(srv.getSessionEvents)) // DELETE IN 16(zmb3)
// TODO(zmb3): remove these endpoints when Assist no longer needs them
srv.GET("/:version/namespaces/:namespace/sessions/:id/stream", srv.WithAuth(srv.getSessionChunk))
srv.GET("/:version/namespaces/:namespace/sessions/:id/events", srv.WithAuth(srv.getSessionEvents))

// Namespaces
srv.POST("/:version/namespaces", srv.WithAuth(srv.upsertNamespace))
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ func checkGithubOrgSSOSupport(ctx context.Context, conn types.GithubConnector, u
}

// Check each organization only once
// DELETE IN 12 (zmb3)
// TODO: this can be removed as of Teleport 12, but we should create cluster
// alerts for anyone using the old teams_to_logins field to avoid breaking anyone
for _, mapping := range conn.GetTeamsToLogins() {
addOrg(mapping.Organization)
}
Expand Down
5 changes: 2 additions & 3 deletions lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ func (h *Handler) bindDefaultEndpoints() {
h.GET("/webapi/sites/:site/events/search/sessions", h.WithClusterAuth(h.clusterSearchSessionEvents)) // search site session events
h.GET("/webapi/sites/:site/ttyplayback/:sid", h.WithClusterAuth(h.ttyPlaybackHandle))

// DELETE in 16(zmb3): v15+ web UIs use new streaming 'ttyplayback' endpoint
// TODO(zmb3): remove these endpoints when Assist is no longer using them
// (assist calls the proxy's web API, and the proxy uses an HTTP client to call auth's API)
h.GET("/webapi/sites/:site/sessions/:sid/events", h.WithClusterAuth(h.siteSessionEventsGet)) // get recorded session's timing information (from events)
h.GET("/webapi/sites/:site/sessions/:sid/stream", h.siteSessionStreamGet) // get recorded session's bytes (from events)

Expand Down Expand Up @@ -3607,8 +3608,6 @@ func queryOrder(query url.Values, name string, def types.EventOrder) (types.Even
// It returns the binary stream unencoded, directly in the respose body,
// with Content-Type of application/octet-stream, gzipped with up to 95%
// compression ratio.
//
// DELETE IN 16(zmb3)
func (h *Handler) siteSessionStreamGet(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
httplib.SetNoCacheHeaders(w.Header())

Expand Down
2 changes: 0 additions & 2 deletions web/packages/teleport/src/Assist/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ export async function resolveServerMessage(
}
}

// TODO(zmb3): check with Ryan about replacing this with streaming

export async function getSessionEvents(sessionUrl: string): Promise<{
events: SessionEvent[] | null;
}> {
Expand Down
4 changes: 2 additions & 2 deletions web/packages/teleport/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const cfg = {
'wss://:fqdn/v1/webapi/sites/:clusterId/ttyplayback/:sid?access_token=:token', // TODO(zmb3): get token out of URL
activeAndPendingSessionsPath: '/v1/webapi/sites/:clusterId/sessions',

// TODO(zmb3): remove this for v15
// TODO(zmb3): remove this when Assist is no longer using it
sshPlaybackPrefix: '/v1/webapi/sites/:clusterId/sessions/:sid', // prefix because this is eventually concatenated with "/stream" or "/events"
kubernetesPath:
'/v1/webapi/sites/:clusterId/kubernetes?searchAsRoles=:searchAsRoles?&limit=:limit?&startKey=:startKey?&query=:query?&search=:search?&sort=:sort?',
Expand Down Expand Up @@ -638,7 +638,7 @@ const cfg = {
},

getSshPlaybackPrefixUrl({ clusterId, sid }: UrlParams) {
// TODO(zmb3): remove
// TODO(zmb3): remove this when Assist is no longer using it
return generatePath(cfg.api.sshPlaybackPrefix, { clusterId, sid });
},

Expand Down

0 comments on commit 63afd5f

Please sign in to comment.