From dc4311c2e427f56d78962d1ab592d8b64e9967e0 Mon Sep 17 00:00:00 2001 From: Alex Creasy Date: Fri, 8 Nov 2024 12:57:23 +0000 Subject: [PATCH] Warn instead of fail when cannot resolve bearer token on cluster Signed-off-by: Alex Creasy --- clients/ui/bff/internal/api/middleware.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clients/ui/bff/internal/api/middleware.go b/clients/ui/bff/internal/api/middleware.go index 04cfc7806..ab3ad5bf6 100644 --- a/clients/ui/bff/internal/api/middleware.go +++ b/clients/ui/bff/internal/api/middleware.go @@ -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) @@ -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()