Skip to content

Conversation

owenowenisme
Copy link
Collaborator

@owenowenisme owenowenisme commented Aug 26, 2025

Why are these changes needed?

Remove the controller-runtime from dashboard-httpclient and remove the redundant InitClient function.

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Signed-off-by: You-Cheng Lin (Owen) <[email protected]>
Signed-off-by: You-Cheng Lin (Owen) <[email protected]>
Signed-off-by: You-Cheng Lin (Owen) <[email protected]>
@owenowenisme owenowenisme changed the title [refactor][2/N] Refactor dashbpard httpclient [refactor][3/N] Refactor dashbpard httpclient Aug 26, 2025
@owenowenisme owenowenisme marked this pull request as ready for review August 26, 2025 09:18
return runtimeEnv, nil
}

func GetRayDashboardClientFunc(mgr manager.Manager, useKubernetesProxy bool) func(rayCluster *rayv1.RayCluster, url string) RayDashboardClientInterface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is AI-generated. Please check whether this is correct or not. For example, the logic to get head service name is different from the old one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really sorry about this, I'll make sure it won't happen again in the following PRs.

}

func GetRayDashboardClientFunc(mgr manager.Manager, useKubernetesProxy bool) func(rayCluster *rayv1.RayCluster, url string) RayDashboardClientInterface {
return func(rayCluster *rayv1.RayCluster, url string) RayDashboardClientInterface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface could be improved, but since it’s the same as InitClient, it doesn’t add new tech debt.

return func(rayCluster *rayv1.RayCluster, url string) RayDashboardClientInterface {
if useKubernetesProxy {
return &RayDashboardClient{
client: mgr.GetHTTPClient(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between mgr.GetHTTPClient and http.Client{ ... }?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using Kubernetes proxy, we should use mgr.GetHTTPClient which provides client with proper auth to make request to Kubernetes api server.
Or we will get error like this:

{"level":"error","ts":"2025-08-28T03:13:20.716Z","logger":"controllers.RayJob",
"msg":"Failed to get job info",
"RayJob":{"name":"rayjob-sample","namespace":"default"},"reconcileID":"6b31ed8f-4d3c-4d39-93b2-3e8a2741ce43","JobId":"rayjob-sample-zhmhv",
"error":"Get \"https://127.0.0.1:38963/api/v1/namespaces/default/services/rayjob-sample-dksrt-head-svc:dashboard/proxy/api/jobs/rayjob-sample-zhmhv\": tls: failed to verify certificate: x509: certificate signed by unknown authority"}

return headServiceURL, nil
}

func UnmarshalRuntimeEnvYAML(runtimeEnvYAML string) (RuntimeEnvType, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid mixing too many different topics in the same PR. This makes reviewers more difficult to review. Please remove the change.

return r.SubmitJobReq(ctx, request)
}

func (r *RayDashboardClient) SubmitJobReq(ctx context.Context, request *RayJobRequest, name *string) (jobId string, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open another PR to remove the logs instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do when this is merged.

Signed-off-by: You-Cheng Lin (Owen) <[email protected]>
@owenowenisme owenowenisme force-pushed the refactor-dashbpard-httpclient branch from e80d6a5 to 558dc64 Compare August 28, 2025 03:35
Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I will open a follow up PR to address some nits

@kevin85421 kevin85421 merged commit e69bdb9 into ray-project:master Aug 28, 2025
26 checks passed
win5923 pushed a commit to win5923/kuberay that referenced this pull request Sep 4, 2025
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.

2 participants