Skip to content

Commit

Permalink
Warn instead of fail when cannot resolve bearer token on cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Creasy <[email protected]>
  • Loading branch information
alexcreasy committed Nov 8, 2024
1 parent 962d135 commit dc4311c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions clients/ui/bff/internal/api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func (app *App) AttachRESTClient(handler func(http.ResponseWriter, *http.Request
var bearerToken string
bearerToken, err = resolveBearerToken(app.kubernetesClient)
if err != nil {
app.serverErrorResponse(w, r, fmt.Errorf("failed to resolve BearerToken): %v", err))
return
app.logger.Warn("failed to resolve bearer token", "error", err)
}

client, err := integrations.NewHTTPClient(modelRegistryBaseURL, bearerToken)
Expand All @@ -69,7 +68,7 @@ func resolveBearerToken(k8s integrations.KubernetesClientInterface) (string, err
if err == nil {
//in cluster
//TODO (eder) load bearerToken probably from x-forwarded-access-bearerToken
return "", fmt.Errorf("failed to create Rest client (not implemented yet - inside cluster): %v", err)
return "", fmt.Errorf("failed to fetch bearer token: %v", err)
} else {
//off cluster (development)
bearerToken, err = k8s.BearerToken()
Expand Down

0 comments on commit dc4311c

Please sign in to comment.