fix: cluster worker_config refill

This commit is contained in:
jialin
2026-05-28 15:51:51 +08:00
committed by jialin
parent 9488fc1251
commit e47a9304f4
7 changed files with 252 additions and 121 deletions
@@ -119,8 +119,8 @@ const ClusterForm: React.FC<AddModalProps> = forwardRef(
if (!Array.isArray(creds)) return values;
const fixed = creds.map((c: any) => ({
...c,
username: c?.username ? c.username : null,
password: c?.password ? c.password : null
username: c?.username || null,
password: c?.password || null
}));
return {
...values,
@@ -0,0 +1,106 @@
{
"type": "object",
"additionalProperties": false,
"properties": {
"debug": {
"type": "boolean",
"description": "Enable debug mode"
},
"cache_dir": {
"type": "string",
"description": "Cache directory path"
},
"log_dir": {
"type": "string",
"description": "Log directory path"
},
"bin_dir": {
"type": "string",
"description": "Binary directory path"
},
"system_default_container_registry": {
"type": "string",
"description": "Default container registry"
},
"image_name_override": {
"type": "string",
"description": "Override image name"
},
"image_repo": {
"type": "string",
"description": "Container image repository"
},
"huggingface_token": {
"type": "string",
"description": "Hugging Face access token"
},
"disable_worker_metrics": {
"type": "boolean",
"description": "Disable worker metrics collection"
},
"worker_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker service port"
},
"worker_metrics_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker metrics port"
},
"service_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Service port range, e.g. 30000-31000"
},
"ray_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Ray port range, e.g. 20000-20100"
},
"system_reserved": {
"type": "object",
"description": "System reserved resources",
"properties": {
"ram": {
"type": "number",
"minimum": 0,
"description": "Reserved RAM in GiB"
},
"vram": {
"type": "number",
"minimum": 0,
"description": "Reserved VRAM in GiB"
}
}
},
"resources": {
"type": "object",
"description": "Additional resource definitions",
"additionalProperties": {}
},
"pipx_path": {
"type": "string",
"description": "pipx installation path"
},
"tools_download_base_url": {
"type": "string",
"description": "Base URL for downloading tools"
},
"enable_hf_transfer": {
"type": "boolean",
"description": "Enable Hugging Face transfer acceleration"
},
"enable_hf_xet": {
"type": "boolean",
"description": "Enable Hugging Face Xet support"
},
"proxy_mode": {
"type": "string",
"enum": ["worker", "system", "disabled"],
"description": "Proxy mode"
}
}
}
@@ -1,117 +0,0 @@
{
"type": "object",
"properties": {
"worker_config": {
"type": "object",
"additionalProperties": false,
"properties": {
"debug": {
"type": "boolean",
"description": "Enable debug mode"
},
"cache_dir": {
"type": "string",
"description": "Cache directory path"
},
"log_dir": {
"type": "string",
"description": "Log directory path"
},
"bin_dir": {
"type": "string",
"description": "Binary directory path"
},
"system_default_container_registry": {
"type": "string",
"description": "Default container registry"
},
"image_name_override": {
"type": "string",
"description": "Override image name"
},
"image_repo": {
"type": "string",
"description": "Container image repository"
},
"gateway_mode": {
"type": "string",
"description": "Gateway mode",
"enum": ["worker", "gateway", "disabled", "auto"]
},
"gateway_kubeconfig": {
"type": "string",
"description": "Path to kubeconfig used by gateway"
},
"gateway_concurrency": {
"type": "integer",
"minimum": 0,
"description": "Gateway concurrency limit"
},
"service_discovery_name": {
"type": "string",
"description": "Service discovery name"
},
"namespace": {
"type": "string",
"description": "Kubernetes namespace"
},
"huggingface_token": {
"type": "string",
"description": "Hugging Face access token"
},
"disable_worker_metrics": {
"type": "boolean",
"description": "Disable worker metrics collection"
},
"worker_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker service port"
},
"worker_metrics_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker metrics port"
},
"service_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Service port range, e.g. 30000-31000"
},
"ray_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Ray port range, e.g. 20000-20100"
},
"resources": {
"type": "object",
"description": "Additional resource definitions",
"additionalProperties": {}
},
"pipx_path": {
"type": "string",
"description": "pipx installation path"
},
"tools_download_base_url": {
"type": "string",
"description": "Base URL for downloading tools"
},
"enable_hf_transfer": {
"type": "boolean",
"description": "Enable Hugging Face transfer acceleration"
},
"enable_hf_xet": {
"type": "boolean",
"description": "Enable Hugging Face Xet support"
},
"proxy_mode": {
"type": "string",
"enum": ["worker", "system", "disabled"],
"description": "Proxy mode"
}
}
}
}
}
@@ -0,0 +1,125 @@
{
"type": "object",
"additionalProperties": false,
"properties": {
"debug": {
"type": "boolean",
"description": "Enable debug mode"
},
"cache_dir": {
"type": "string",
"description": "Cache directory path"
},
"log_dir": {
"type": "string",
"description": "Log directory path"
},
"system_default_container_registry": {
"type": "string",
"description": "Default container registry"
},
"image_name_override": {
"type": "string",
"description": "Override image name"
},
"image_repo": {
"type": "string",
"description": "Container image repository"
},
"operator_image": {
"type": "string",
"description": "GPUStack operator image, format: <repo>:<tag>",
"examples": ["gpustack/gpustack-operator:<related version>"]
},
"gpu_instances_access_static_address": {
"type": "string",
"description": "Static address used to access GPU instances"
},
"gateway_mode": {
"type": "string",
"description": "Gateway mode",
"enum": ["worker", "gateway", "disabled", "auto"]
},
"gateway_kubeconfig": {
"type": "string",
"description": "Path to kubeconfig used by gateway"
},
"gateway_concurrency": {
"type": "integer",
"minimum": 0,
"description": "Gateway concurrency limit"
},
"service_discovery_name": {
"type": "string",
"description": "Service discovery name"
},
"namespace": {
"type": "string",
"description": "Kubernetes namespace"
},
"huggingface_token": {
"type": "string",
"description": "Hugging Face access token"
},
"disable_worker_metrics": {
"type": "boolean",
"description": "Disable worker metrics collection"
},
"worker_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker service port"
},
"worker_metrics_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Worker metrics port"
},
"service_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Service port range, e.g. 30000-31000"
},
"ray_port_range": {
"type": "string",
"pattern": "^\\d+-\\d+$",
"description": "Ray port range, e.g. 20000-20100"
},
"system_reserved": {
"type": "object",
"description": "System reserved resources",
"properties": {
"ram": {
"type": "number",
"minimum": 0,
"description": "Reserved RAM in GiB"
},
"vram": {
"type": "number",
"minimum": 0,
"description": "Reserved VRAM in GiB"
}
}
},
"resources": {
"type": "object",
"description": "Additional resource definitions",
"additionalProperties": {}
},
"enable_hf_transfer": {
"type": "boolean",
"description": "Enable Hugging Face transfer acceleration"
},
"enable_hf_xet": {
"type": "boolean",
"description": "Enable Hugging Face Xet support"
},
"proxy_mode": {
"type": "string",
"enum": ["worker", "system", "disabled"],
"description": "Proxy mode"
}
}
}
@@ -56,6 +56,11 @@ export const kubernetesConfig = `# This is a template for worker_config.
# system_default_container_registry: "docker.io"
# image_name_override: "gpustack/gpustack:dev"
# image_repo: "gpustack/gpustack"
# operator_image: "gpustack/gpustack-operator:<related version>
# ========= GPU instances ===========
# gpu_instances_access_static_address: <ip or dns name>
# ========= service & networking ===========
@@ -14,7 +14,8 @@ import {
ClusterFormData as FormData,
ClusterListItem as ListItem
} from '../config/types';
import schema from '../config/worker-config.json';
import dockerSchema from '../config/worker-config.docker.json';
import kubernetesSchema from '../config/worker-config.kubernetes.json';
import { dockerConfig, kubernetesConfig } from '../config/yaml-template';
const Title = styled.div`
@@ -40,6 +41,8 @@ const ClusterAdvanceConfig: React.FC<{
const editorRef = React.useRef<any>(null);
const { isDarkTheme } = useUserSettings();
const [fileContent, setFileContent] = React.useState<string>('');
const schema =
provider === ProviderValueMap.Kubernetes ? kubernetesSchema : dockerSchema;
useImperativeHandle(ref, () => ({
getYamlValue: () => {
@@ -62,8 +65,16 @@ const ClusterAdvanceConfig: React.FC<{
? kubernetesConfig
: dockerConfig
);
} else if (action === PageAction.EDIT) {
const workerConfig = currentData?.worker_config;
const content =
workerConfig ||
(provider === ProviderValueMap.Kubernetes
? kubernetesConfig
: dockerConfig);
setFileContent(content as string);
}
}, [provider, action]);
}, [provider, action, currentData?.worker_config]);
return (
<>
@@ -96,6 +96,7 @@ export const templateActions = [
label: 'common.button.edit',
key: 'edit',
locale: true,
access: 'canSeeAdmin',
icon: icons.EditOutlined
},
{