Skip to content

Fix hyp create ray-dashboard-connection command to load credentials through load_kubeconfig - #458

Open
jchatter321 wants to merge 1 commit into
aws:mainfrom
jchatter321:fix-create-ray-dashboard-connection-command
Open

Fix hyp create ray-dashboard-connection command to load credentials through load_kubeconfig#458
jchatter321 wants to merge 1 commit into
aws:mainfrom
jchatter321:fix-create-ray-dashboard-connection-command

Conversation

@jchatter321

@jchatter321 jchatter321 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Problem

hyp create ray-dashboard-connection sends the request unauthenticated on fresh install not using K8s version 36.0.0. The EKS API server sees system:anonymous and rejects it with 403 (or 401, depending on cluster auth config).

Root cause

_get_eks_api_client() reads the bearer token by name from a detached config copy, then clears api_key unconditionally:

configuration = client.Configuration.get_default_copy()
if configuration.api_key and "authorization" in configuration.api_key:
    ...
configuration.api_key = {}

load_kube_config() names that entry differently across kubernetes-client releases — authorization in 36.0.0, BearerToken in 36.0.3. On 36.0.3 the lookup misses, no Authorization header is attached, and the clear discards the token that was loaded. The client ends up with no credentials.

setup.py declares kubernetes>=33.1.0,!=36.0.0, excluding the only version the code works on, so every fresh resolve is broken.

kubernetes api_key key Auth header Result
36.0.0 authorization attached authenticates as caller's IAM identity
36.0.3 BearerToken not attached system:anonymous → 403

Fix

Delete _get_eks_api_client() and use the default client, as HPSpace already does for space_access:

config.load_kube_config()
...
api = client.CustomObjectsApi()      # was: CustomObjectsApi(api_client)

The default ApiClient reads the Configuration that load_kube_config() populated, so auth resolves via the library's own auth_settings() regardless of key name, and the exec-credential refresh hook is preserved.

Testing

Verified on 36.0.3 (the breaking version) and 36.0.0: the command authenticates as the caller's IAM role and returns a valid presigned URL whose JWT sub matches. Updated the 7 unit tests that patched the removed function; request-body assertions unchanged.

@jchatter321
jchatter321 requested a review from a team as a code owner September 1, 2026 23:26
@jchatter321
jchatter321 deployed to manual-approval September 1, 2026 23:32 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants