Skip to content

Allow prefixes in dask dashboard links#7408

Open
katrogan wants to merge 4 commits into
mainfrom
katrina/eng26-581-route-auxiliary-uis-directly-through-dataplane
Open

Allow prefixes in dask dashboard links#7408
katrogan wants to merge 4 commits into
mainfrom
katrina/eng26-581-route-auxiliary-uis-directly-through-dataplane

Conversation

@katrogan
Copy link
Copy Markdown
Contributor

Why are the changes needed?

Customize dash daskboard links with a custom cluster name field to conditionally prepend a dashboard prefix to dask dashboard links, like we do for spark

What changes were proposed in this pull request?

How was this patch tested?

Tested on a local cluster deployment.

Labels

Please add one or more of the following labels to categorize your PR:

  • added: For new features.
  • changed: For changes in existing functionality.
  • deprecated: For soon-to-be-removed features.
  • removed: For features being removed.
  • fixed: For any bug fixed.
  • security: In case of vulnerabilities

This is important to improve the readability of release notes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Stack

If you do use git town to manage PR Stacks, the stack relevant to this PR
will show below. Otherwise, you can ignore this section.

Docs link

Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
Copilot AI review requested due to automatic review settings May 21, 2026 19:05
@katrogan katrogan changed the title Changes to dask dashboard links Allow prefixes in dask dashboard links May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds optional support for running the Dask scheduler with a --dashboard-prefix so Bokeh dashboard tab/WebSocket links can route correctly through the dataproxy when a per-cluster identity is configured (similar in spirit to existing Spark behavior).

Changes:

  • Added Config.ClusterName to gate whether a dashboard prefix is injected for the Dask scheduler.
  • Implemented buildDashboardURLPrefix(...) and wired it into scheduler container args/env (POD_NAMESPACE via downward API) to enable correct URL generation.
  • Exposed the new config via pflags and updated the generated config flags test.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
flyteplugins/go/tasks/plugins/k8s/dask/dask.go Builds a long-form dataproxy dashboard prefix and conditionally injects it into the scheduler container args/env.
flyteplugins/go/tasks/plugins/k8s/dask/config.go Adds ClusterName configuration field controlling whether the dashboard prefix is enabled.
flyteplugins/go/tasks/plugins/k8s/dask/config_flags.go Adds a generated pflag for clusterName.
flyteplugins/go/tasks/plugins/k8s/dask/config_flags_test.go Updates generated flag tests to cover clusterName flag decoding.
Files not reviewed (2)
  • flyteplugins/go/tasks/plugins/k8s/dask/config_flags.go: Language not supported
  • flyteplugins/go/tasks/plugins/k8s/dask/config_flags_test.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 254 to +263
primaryContainer.Args = []string{"dask-scheduler"}
if prefix := buildDashboardURLPrefix(clusterName, teMetadata); prefix != "" {
primaryContainer.Env = append(primaryContainer.Env, v1.EnvVar{
Name: "POD_NAMESPACE",
ValueFrom: &v1.EnvVarSource{
FieldRef: &v1.ObjectFieldSelector{FieldPath: "metadata.namespace"},
},
})
primaryContainer.Args = append(primaryContainer.Args, "--dashboard-prefix", prefix)
}
Comment on lines +247 to +255
// Override args. When a cluster name is configured, point the scheduler's
// Bokeh dashboard at the LONG-form union dataproxy URL prefix so its internal
// tab/WebSocket links resolve through the proxy chain. The LONG form works
// regardless of whether the cluster is on the legacy CP-routed path or the
// zero-trust DP-direct path (the dataproxy on both sides parses it
// identically). Without this, Bokeh emits root-relative links like
// "/individual-task-stream" that 404 outside the dashboard mount point.
primaryContainer.Args = []string{"dask-scheduler"}
if prefix := buildDashboardURLPrefix(clusterName, teMetadata); prefix != "" {
Comment on lines +23 to +26
// that the leaseworker is running in. When set, the dask plugin starts the
// scheduler with `--dashboard-prefix`, baked from this name + the task's
// execution identity, so the Bokeh dashboard's internal links resolve through
// the union dataproxy reverse-proxy chain. Without it, dashboard tabs render
katrogan added 2 commits May 21, 2026 21:12
Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
Copilot AI review requested due to automatic review settings May 22, 2026 08:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +71 to +76
func dashboardPrefixFromLogConfig(taskTemplate *core.TaskTemplate, teMetadata pluginsCore.TaskExecutionMetadata) string {
logPlugin, err := logs.InitializeLogPlugins(&GetConfig().Logs, taskTemplate)
if err != nil || logPlugin == nil {
return ""
}
out, err := logPlugin.GetTaskLogs(tasklog.Input{
Comment on lines +67 to +70
// Returns "" when no dashboard template is configured, in which case the
// scheduler runs without `--dashboard-prefix` and Bokeh falls back to emitting
// root-relative URLs (the historical pre-fix behavior — page loads but tab
// navigation 404s outside the proxy mount point).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants