Skip to content

Add scheduler config management UI - #303

Merged
volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
shiverse94:feature/scheduler-config-management-ui
Oct 25, 2026
Merged

volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
shiverse94:feature/scheduler-config-management-ui

Conversation

@shiverse94

Copy link
Copy Markdown
Contributor

Summary

  • Add a new /scheduler dashboard page for editing volcano-scheduler-configmap as structured scheduler policy.
  • Add tRPC scheduler config APIs for reading, validating, serializing, diffing, and updating the ConfigMap with optimistic concurrency.
  • Add RBAC, tests, and operator documentation for Scheduler Config Management.

What changed

  • Action pipeline editor with drag-and-drop ordering.
  • Plugin tier editor with collapsible plugin rows, enable flags, typed arguments, and custom plugin warnings.
  • Live YAML diff preview with save confirmation and unsaved-change guards.
  • ConfigMap namespace/name/key environment overrides.
  • Dashboard navigation entry and scheduler icon.
  • RBAC permission for dashboard ConfigMap access.

Test plan

  • npm run test --workspace packages/trpc
  • npx tsc --noEmit -p apps/web/tsconfig.json
  • npm run build --workspace apps/web
image

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Scheduler configuration page to the Volcano dashboard, allowing users to view, edit, and save scheduler policies directly from the UI. It includes drag-and-drop action pipeline reordering, plugin tier management, and a YAML diff preview, supported by new tRPC endpoints and updated RBAC permissions. The review feedback highlights several key areas for improvement: resolving focus loss and reordering issues in the action configuration editor by using array indices as React keys; ensuring plugin enable flags can be explicitly set to true rather than deleted; improving browser compatibility for the unsaved changes warning by setting event.returnValue; and switching to index-based sortable IDs in the action pipeline editor to prevent glitches when duplicate actions are present.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +110 to +141
{Object.entries(config.arguments).map(([key, value]) => (
<div key={key} className="flex gap-2">
<Input
className="flex-1"
value={key}
onChange={(e) => {
const nextArgs = { ...config.arguments };
delete nextArgs[key];
nextArgs[e.target.value] = value;
updateConfiguration(index, {
...config,
arguments: nextArgs,
});
}}
placeholder="key"
/>
<Input
className="flex-1"
value={String(value)}
onChange={(e) =>
updateConfiguration(index, {
...config,
arguments: {
...config.arguments,
[key]: e.target.value,
},
})
}
placeholder="value"
/>
</div>
))}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using the argument key as the React key prop causes the input to lose focus on every keystroke when editing the key itself. Additionally, deleting and re-adding the key in onChange changes the insertion order, causing the edited row to jump to the bottom of the list.

To fix both issues and provide a better user experience, use the array index as the React key prop, preserve the key order when updating, and add a delete button so users can remove individual arguments.

                        {Object.entries(config.arguments).map(([key, value], argIndex) => (
                            <div key={argIndex} className="flex items-center gap-2">
                                <Input
                                    className="flex-1"
                                    value={key}
                                    onChange={(e) => {
                                        const nextArgs: Record<string, typeof value> = {};
                                        for (const [k, v] of Object.entries(config.arguments)) {
                                            if (k === key) {
                                                nextArgs[e.target.value] = value;
                                            } else {
                                                nextArgs[k] = v;
                                            }
                                        }
                                        updateConfiguration(index, {
                                            ...config,
                                            arguments: nextArgs,
                                        });
                                    }}
                                    placeholder="key"
                                />
                                <Input
                                    className="flex-1"
                                    value={String(value)}
                                    onChange={(e) =>
                                        updateConfiguration(index, {
                                            ...config,
                                            arguments: {
                                                ...config.arguments,
                                                [key]: e.target.value,
                                            },
                                        })
                                    }
                                    placeholder="value"
                                />
                                <Button
                                    type="button"
                                    variant="ghost"
                                    size="icon"
                                    className="text-muted-foreground hover:text-destructive shrink-0"
                                    onClick={() => {
                                        const nextArgs = { ...config.arguments };
                                        delete nextArgs[key];
                                        updateConfiguration(index, {
                                            ...config,
                                            arguments: nextArgs,
                                        });
                                    }}
                                    title="Delete argument"
                                >
                                    <Trash2 className="h-4 w-4" />
                                </Button>
                            </div>
                        ))}

Comment on lines +193 to +202
onCheckedChange={(value) => {
if (value === "indeterminate") return;
onChange(
setEnableFlag(
plugin,
flag,
value ? undefined : false
)
);
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

When a checkbox is checked, passing undefined to setEnableFlag deletes the key from the plugin object. While this keeps the YAML clean for flags that default to true, it makes it impossible to explicitly enable any flag that defaults to false in Volcano.

To ensure correct behavior across all Volcano versions and allow explicit configuration, set the flag value to true when checked.

Suggested change
onCheckedChange={(value) => {
if (value === "indeterminate") return;
onChange(
setEnableFlag(
plugin,
flag,
value ? undefined : false
)
);
}}
onCheckedChange={(value) => {
if (value === "indeterminate") return;
onChange(
setEnableFlag(
plugin,
flag,
value ? true : false
)
);
}}

Comment on lines +108 to +110
const handler = (event: BeforeUnloadEvent) => {
event.preventDefault();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

In many modern browsers (such as Chrome and Firefox), calling event.preventDefault() alone is not sufficient to trigger the unsaved changes confirmation dialog on tab close or reload. Setting event.returnValue to an empty string is required for broad browser compatibility.

Suggested change
const handler = (event: BeforeUnloadEvent) => {
event.preventDefault();
};
const handler = (event: BeforeUnloadEvent) => {
event.preventDefault();
event.returnValue = "";
};

Comment on lines +53 to +54
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
useSortable({ id: action });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using the action name as the @dnd-kit sortable id will cause drag-and-drop glitches or crashes if the pipeline contains duplicate actions (which is valid and supported in Volcano). Using the array index as the sortable id ensures uniqueness and correct drag-and-drop behavior.

Suggested change
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
useSortable({ id: action });
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
useSortable({ id: index });

Comment on lines +121 to +123
const oldIndex = actions.indexOf(String(active.id));
const newIndex = actions.indexOf(String(over.id));
if (oldIndex === -1 || newIndex === -1) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Update handleDragEnd to retrieve indices directly from the active.id and over.id when using index-based sortable IDs.

Suggested change
const oldIndex = actions.indexOf(String(active.id));
const newIndex = actions.indexOf(String(over.id));
if (oldIndex === -1 || newIndex === -1) return;
const oldIndex = Number(active.id);
const newIndex = Number(over.id);
if (isNaN(oldIndex) || isNaN(newIndex)) return;

collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
>
<SortableContext items={actions} strategy={verticalListSortingStrategy}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Pass the array of indices as items to SortableContext to match the index-based sortable IDs.

Suggested change
<SortableContext items={actions} strategy={verticalListSortingStrategy}>
<SortableContext items={actions.map((_, i) => i)} strategy={verticalListSortingStrategy}>

Comment on lines +187 to +190
if (seenPlugins.has(plugin.name)) {
warnings.push(`Plugin "${plugin.name}" appears in multiple tiers`);
}
seenPlugins.add(plugin.name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate plugin names within the same tier still produce "appears in multiple tiers", which is wrong and can hide a real misconfiguration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +263 to +277
onChange={(e) => {
const raw = e.target.value;
const parsed =
field.type === "number"
? raw === ""
? undefined
: Number(raw)
: raw;
onChange(
setArgument(
plugin,
field.key,
parsed
)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typing a half-finished number (like - or 5e) can get saved as NaN. The scheduler won’t treat that as a real number — so the setting may be ignored or break the config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

import { z } from "zod";
import { PLUGIN_ENABLE_FLAG_KEYS } from "./metadata";

const argumentValueSchema = z.union([z.string(), z.number(), z.boolean()]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const argumentValueSchema = z.union([z.string(), z.number(), z.boolean()]);
const argumentValueSchema = z.union([
z.string(),
z.number().finite(),
z.boolean(),
]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +163 to +169
for (const action of config.actions) {
if (!isKnownAction(action)) {
warnings.push(
`Action "${action}" is not in the built-in registry (custom action or different Volcano version?)`
);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A typo in an action name (like enqueu) only shows a warning, but save still works. Volcano then rejects that config and may stop reloading — scheduling can get stuck.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +115 to +126
onChange={(e) => {
const nextArgs: Record<string, typeof value> = {};
for (const [k, v] of Object.entries(config.arguments)) {
if (k === key) {
nextArgs[e.target.value] = value;
} else {
nextArgs[k] = v;
}
}
updateConfiguration(index, {
...config,
arguments: nextArgs,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you rename an argument key to one that already exists, one of the two values disappears with no error - last one wins.

Suggested change
onChange={(e) => {
const nextArgs: Record<string, typeof value> = {};
for (const [k, v] of Object.entries(config.arguments)) {
if (k === key) {
nextArgs[e.target.value] = value;
} else {
nextArgs[k] = v;
}
}
updateConfiguration(index, {
...config,
arguments: nextArgs,
onChange={(e) => {
const newKey = e.target.value;
if (newKey !== key && Object.prototype.hasOwnProperty.call(config.arguments, newKey)) {
return; // or set an inline error — do not clobber
}
const nextArgs: Record<string, typeof value> = {};
for (const [k, v] of Object.entries(config.arguments)) {
if (k === key) nextArgs[newKey] = value;
else nextArgs[k] = v;
}
updateConfiguration(index, { ...config, arguments: nextArgs });
}}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@de6p

de6p commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

please fix the CI, and commits .

Add scheduler ConfigMap API, validation, management page, and Chinese
translations. Linearize history onto main to drop merge commits blocked
by do-not-merge/contains-merge-commits.

Signed-off-by: Shive <shiverse94@gmail.com>
@shiverse94

Copy link
Copy Markdown
Contributor Author

it’s fixed now.

@de6p de6p left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: de6p

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot
volcano-sh-bot merged commit 6a484a3 into volcano-sh:main Oct 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants