fix(k8s): Deployment 存储挂载六种卷类型 YAML 双向映射
- 抽取 deployment-volume-utils,修正 PVC/NFS/CM/Secret/HostPath/EmptyDir 读写 - 保存时保留系统卷与 serviceAccount 挂载,合并用户卷与挂载点 - 挂载支持 subPath;ConfigMap/Secret items 支持 key:path 简写
This commit is contained in:
1 parent
5fad2db0c6
commit
a8305de0f5
98 files changed
+453
-250
No files matched your search
@@ -100,18 +100,8 @@ export function DeploymentWorkload({ clusterCode, namespace, deploymentName, mod
|
||||
const loadManifest = useCallback(async () => {
|
||||
try {
|
||||
const yamlText = await kubernetesApi.getResourceYaml(clusterCode, namespace, 'deployments', deploymentName);
|
||||
// 简易 YAML→JSON:交给浏览器原生 JSON.parse 兜底(K8s API 多以 JSON 返回);
|
||||
// 若是纯 YAML,则尝试用 js-yaml(如项目已安装),否则保留为 null 让编辑模式降级。
|
||||
let parsed: Record<string, any> = null;
|
||||
try { parsed = JSON.parse(yamlText); } catch {
|
||||
// 非纯 JSON,尝试动态加载 js-yaml
|
||||
try {
|
||||
const jsyaml: Record<string, any> = await import('js-yaml');
|
||||
parsed = jsyaml.load(yamlText);
|
||||
} catch {
|
||||
parsed = null;
|
||||
}
|
||||
}
|
||||
const { parseEditableManifest } = await import('./k8s-manifest-utils');
|
||||
const { manifest: parsed } = await parseEditableManifest(yamlText);
|
||||
setManifest(parsed || deployment);
|
||||
} catch (e) {
|
||||
console.warn('加载 manifest 失败(编辑功能降级):', e);
|
||||
|
||||
Reference in new issue
Block a user