feat: extend cluster k8s_options with multi-vendor manifest support

- New k8s_pod_spec form sections (image credentials, node selector,
  gpu vendor overrides) under k8s_options, replacing the legacy flat
  k8s_volume_mounts list. UI keys aligned to the backend wire shape
  (snake_case k8s_options + camelCase inside).
- System default container registry is pre-filled into the first image
  credential when creating a new cluster; empty username/password are
  coerced to null on submit to match the Optional[str] backend schema.
- Register cluster flow supports multi-runtime selection gated by the
  cluster's gpuVendorOverrides: non-override vendors stay single-select
  with an inline hint; multi-add only opens once an override vendor is
  picked, and non-override cards become disabled in that state.
- Manifest URL emits multiple ?runtime= params; check-env step combines
  per-vendor commands; downstream steps are disabled when no vendor is
  selected.
- Pre-validate gpuVendorOverrides at save time (non-empty selector, no
  duplicates across vendors, no key clash with base nodeSelector) so
  the user sees the error before hitting the manifest endpoint.
- Misc: dark-mode background of the k8s_pod_spec / volume mount titles
  no longer clashes with the drawer; cluster Steps no longer leaks the
  internal showModules/showForms props to the DOM.
This commit is contained in:
Yuxing Deng
2026-05-26 16:54:14 +08:00
parent 91c3d0b814
commit acb90531b2
21 changed files with 1023 additions and 112 deletions
@@ -96,6 +96,28 @@ const AddWorkerSteps: React.FC<AddWorkerProps> = (props) => {
);
}, [clusterList, stepList, StepNamesMap]);
// Downstream steps (check env, run command, ...) only make sense after a
// GPU vendor has been chosen. If the user toggled off every vendor in
// multi-select, gate them shut so the wrong panel can't be opened.
const selectedGPUs =
(summary.get('selectedGPUs') as string[] | undefined) || [];
const currentGPU = (summary.get('currentGPU') as string | undefined) || '';
const noVendorSelected = !currentGPU && selectedGPUs.length === 0;
const downstreamDisabled = disabled || noVendorSelected;
React.useEffect(() => {
// If the user just deselected everything, collapse any downstream
// panel back to the GPU step so they aren't left looking at a stale
// disabled-but-open command. Functional updater so we don't have to
// depend on `collapseKey` and re-run the effect on every toggle.
if (!noVendorSelected) return;
setCollapseKey((prev) =>
prev.has(StepNamesMap.SelectGPU)
? prev
: new Set([StepNamesMap.SelectGPU])
);
}, [noVendorSelected]);
return (
<AddWorkerContext.Provider
value={{
@@ -123,16 +145,20 @@ const AddWorkerSteps: React.FC<AddWorkerProps> = (props) => {
!stepList.includes(StepNamesMap.SelectCluster)) && (
<>
<SelectVendor disabled={disabled}></SelectVendor>
<CheckEnvironment disabled={disabled}></CheckEnvironment>
<CheckEnvironment disabled={downstreamDisabled}></CheckEnvironment>
{provider === ProviderValueMap.Kubernetes && (
<K8sRunCommand disabled={disabled}></K8sRunCommand>
<K8sRunCommand disabled={downstreamDisabled}></K8sRunCommand>
)}
{provider === ProviderValueMap.Docker && (
<>
<SpecifyArguments disabled={disabled}></SpecifyArguments>
<DockerRunCommand disabled={disabled}></DockerRunCommand>
<SpecifyArguments
disabled={downstreamDisabled}
></SpecifyArguments>
<DockerRunCommand
disabled={downstreamDisabled}
></DockerRunCommand>
</>
)}
</>