- 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.
230 lines
6.9 KiB
TypeScript
230 lines
6.9 KiB
TypeScript
import ascendLogo from '@/assets/logo/ascend.png';
|
|
import CambriconPNG from '@/assets/logo/cambricon.png';
|
|
import hyponPNG from '@/assets/logo/hygon.png';
|
|
import iluvatarWEBP from '@/assets/logo/Iluvatar.png';
|
|
import metaxLogo from '@/assets/logo/metax.png';
|
|
import mooreLogo from '@/assets/logo/moore-logo.png';
|
|
import nvidiaLogo from '@/assets/logo/nvidia.png';
|
|
import theadLogoEN from '@/assets/logo/t-head-en.png';
|
|
import theadLogoZH from '@/assets/logo/t-head-zh.png';
|
|
import useUserSettings from '@/hooks/use-user-settings';
|
|
import {
|
|
AddWorkerDockerNotes,
|
|
GPUDriverMap
|
|
} from '@/pages/resources/config/gpu-driver';
|
|
import { IconFont } from '@gpustack/core-ui';
|
|
import { useIntl } from '@umijs/max';
|
|
import styled from 'styled-components';
|
|
import ProviderCatalog from './provider-catalog';
|
|
|
|
const Box = styled.div`
|
|
.template-card-wrapper {
|
|
position: relative;
|
|
justify-content: center;
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
&.active {
|
|
background-color: var(--ant-color-fill-tertiary);
|
|
}
|
|
.template-card-icon {
|
|
margin-right: 0;
|
|
}
|
|
.template-card-inner {
|
|
line-height: 1;
|
|
flex-direction: row;
|
|
height: auto;
|
|
width: 0;
|
|
overflow: visible;
|
|
.template-card-content {
|
|
font-size: 13px;
|
|
}
|
|
}
|
|
.extra {
|
|
position: absolute;
|
|
right: 2px;
|
|
top: 2px;
|
|
padding: 2px;
|
|
border-radius: 2px;
|
|
font-size: 10px;
|
|
font-weight: 400;
|
|
background-color: var(--ant-blue-1);
|
|
}
|
|
}
|
|
&.dark-theme {
|
|
.template-card-wrapper {
|
|
background-color: rgba(255, 255, 255, 0.05);
|
|
&:hover {
|
|
background-color: var(--ant-color-bg-solid);
|
|
}
|
|
&.active {
|
|
background-color: var(--ant-color-bg-solid);
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
const ProviderImage = ({ src, height }: { src: string; height?: number }) => {
|
|
return (
|
|
<img
|
|
src={src}
|
|
style={{
|
|
height: height || 20,
|
|
objectFit: 'contain'
|
|
}}
|
|
/>
|
|
);
|
|
};
|
|
|
|
interface SupportedHardwareProps {
|
|
onSelect?: (provider: string, item: any) => void;
|
|
// Single (legacy) or array of selected GPU driver keys (multi-select).
|
|
current?: string | string[];
|
|
clickable?: boolean;
|
|
// Set of GPU driver keys that are valid to pick. When provided, items
|
|
// outside this set render as disabled. Undefined means "no restriction".
|
|
availableKeys?: Set<string>;
|
|
}
|
|
|
|
const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
|
onSelect,
|
|
clickable,
|
|
current,
|
|
availableKeys
|
|
}) => {
|
|
const intl = useIntl();
|
|
const { userSettings } = useUserSettings();
|
|
|
|
const supportedHardPlatforms = [
|
|
{
|
|
label: 'NVIDIA',
|
|
hiddenTitle: true,
|
|
value: GPUDriverMap.NVIDIA,
|
|
description: '',
|
|
key: GPUDriverMap.NVIDIA,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.NVIDIA],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#nvidia-gpu',
|
|
icon: <ProviderImage src={nvidiaLogo} height={18} />
|
|
},
|
|
{
|
|
label: `AMD `,
|
|
hiddenTitle: true,
|
|
description: '',
|
|
value: GPUDriverMap.AMD,
|
|
key: GPUDriverMap.AMD,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.AMD],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#amd-gpu',
|
|
icon: (
|
|
<IconFont
|
|
type="icon-amd-logo"
|
|
style={{ fontSize: 64, color: '#000' }}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.ascend' }),
|
|
hiddenTitle: true,
|
|
description: '',
|
|
value: GPUDriverMap.ASCEND,
|
|
key: GPUDriverMap.ASCEND,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.ASCEND],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#ascend-npu',
|
|
icon: <ProviderImage src={ascendLogo} height={30} />
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.hygon' }),
|
|
hiddenTitle: true,
|
|
description: '',
|
|
value: GPUDriverMap.HYGON,
|
|
key: GPUDriverMap.HYGON,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.HYGON],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#hygon-dcu',
|
|
icon: <ProviderImage src={hyponPNG} height={18} />
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.metax' }),
|
|
hiddenTitle: true,
|
|
value: GPUDriverMap.METAX,
|
|
key: GPUDriverMap.METAX,
|
|
locale: false,
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#metax-gpu',
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.METAX],
|
|
icon: <ProviderImage src={metaxLogo} height={20} />
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.moorthreads' }),
|
|
hiddenTitle: true,
|
|
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
|
|
value: GPUDriverMap.MOORE_THREADS,
|
|
key: GPUDriverMap.MOORE_THREADS,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.MOORE_THREADS],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#mthreads-gpu',
|
|
icon: <ProviderImage src={mooreLogo} height={24} />
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.iluvatar' }),
|
|
hiddenTitle: true,
|
|
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
|
|
value: GPUDriverMap.ILUVATAR,
|
|
key: GPUDriverMap.ILUVATAR,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.ILUVATAR],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#iluvatar-gpu',
|
|
icon: <ProviderImage src={iluvatarWEBP} height={24} />
|
|
},
|
|
{
|
|
label: intl.formatMessage({ id: 'vendor.cambricon' }),
|
|
hiddenTitle: true,
|
|
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
|
|
value: GPUDriverMap.CAMBRICON,
|
|
key: GPUDriverMap.CAMBRICON,
|
|
locale: false,
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.CAMBRICON],
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#cambricon-mlu',
|
|
icon: <ProviderImage src={CambriconPNG} height={24} />
|
|
},
|
|
{
|
|
label: `${intl.formatMessage({ id: 'vendor.thead' })} `,
|
|
hiddenTitle: true,
|
|
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
|
|
value: GPUDriverMap.THEAD,
|
|
key: GPUDriverMap.THEAD,
|
|
locale: false,
|
|
link: 'https://docs.gpustack.ai/latest/installation/requirements/#thead-gpu',
|
|
notes: AddWorkerDockerNotes[GPUDriverMap.THEAD],
|
|
icon: (
|
|
<ProviderImage
|
|
src={intl?.locale === 'zh-CN' ? theadLogoZH : theadLogoEN}
|
|
height={22}
|
|
/>
|
|
)
|
|
}
|
|
];
|
|
|
|
const platformsWithDisabled = availableKeys
|
|
? supportedHardPlatforms.map((p) => ({
|
|
...p,
|
|
disabled: !availableKeys.has(p.value)
|
|
}))
|
|
: supportedHardPlatforms;
|
|
|
|
return (
|
|
<Box className={userSettings?.theme === 'realDark' ? 'dark-theme' : ''}>
|
|
<ProviderCatalog
|
|
onSelect={onSelect}
|
|
height={60}
|
|
current={current}
|
|
dataList={platformsWithDisabled}
|
|
clickable={clickable}
|
|
showTooltip={true}
|
|
cols={5}
|
|
/>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default SupportedHardware;
|