fix(v02): remove legacy code agent control plane
This commit is contained in:
@@ -33,8 +33,6 @@ const defaultDevBaseImage = process.env.HWLAB_G14_DEV_BASE_IMAGE || "127.0.0.1:5
|
||||
const defaultServiceIds = Object.freeze([
|
||||
"hwlab-cloud-api",
|
||||
"hwlab-cloud-web",
|
||||
"hwlab-agent-mgr",
|
||||
"hwlab-agent-worker",
|
||||
"hwlab-device-pod",
|
||||
"hwlab-gateway",
|
||||
"hwlab-edge-proxy",
|
||||
@@ -43,14 +41,16 @@ const defaultServiceIds = Object.freeze([
|
||||
const v02RuntimeServiceIds = Object.freeze([
|
||||
"hwlab-cloud-api",
|
||||
"hwlab-cloud-web",
|
||||
"hwlab-agent-mgr",
|
||||
"hwlab-agent-worker",
|
||||
"hwlab-device-pod",
|
||||
"hwlab-gateway",
|
||||
"hwlab-edge-proxy",
|
||||
"hwlab-agent-skills"
|
||||
]);
|
||||
const v02RemovedServiceIds = new Set([
|
||||
"hwlab-agent-mgr",
|
||||
"hwlab-agent-worker",
|
||||
"hwlab-agent-worker-template",
|
||||
"hwlab-code-agent-workspace",
|
||||
"hwlab-router",
|
||||
"hwlab-tunnel-client",
|
||||
"hwlab-gateway-simu",
|
||||
@@ -58,6 +58,18 @@ const v02RemovedServiceIds = new Set([
|
||||
"hwlab-patch-panel"
|
||||
]);
|
||||
const v02RemovedServiceEnvNames = new Set([
|
||||
"CODEX_HOME",
|
||||
"OPENAI_API_KEY",
|
||||
"HWLAB_CODE_AGENT_PROVIDER",
|
||||
"HWLAB_CODE_AGENT_MODEL",
|
||||
"HWLAB_CODE_AGENT_OPENAI_BASE_URL",
|
||||
"HWLAB_CODE_AGENT_WORKSPACE",
|
||||
"HWLAB_CODE_AGENT_CODEX_HOME",
|
||||
"HWLAB_CODE_AGENT_CODEX_WORKSPACE",
|
||||
"HWLAB_CODE_AGENT_CODEX_SANDBOX",
|
||||
"HWLAB_CODE_AGENT_CODEX_COMMAND",
|
||||
"HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED",
|
||||
"HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR",
|
||||
"HWLAB_M3_GATEWAY_SIMU_1_URL",
|
||||
"HWLAB_M3_GATEWAY_SIMU_2_URL",
|
||||
"HWLAB_M3_PATCH_PANEL_URL",
|
||||
@@ -728,6 +740,21 @@ function removeV02LegacySimulatorEnv(envList) {
|
||||
return envList.filter((entry) => !v02RemovedServiceEnvNames.has(entry?.name));
|
||||
}
|
||||
|
||||
function removeV02RepoOwnedCodeAgentPodConfig(podSpec) {
|
||||
if (!podSpec) return;
|
||||
podSpec.initContainers = (podSpec.initContainers ?? []).filter((entry) => entry?.name !== "hwlab-code-agent-workspace-init");
|
||||
const removedVolumeNames = new Set([
|
||||
"hwlab-code-agent-workspace",
|
||||
"hwlab-code-agent-codex-home",
|
||||
"hwlab-code-agent-codex-config",
|
||||
"hwlab-code-agent-codex-auth"
|
||||
]);
|
||||
podSpec.volumes = (podSpec.volumes ?? []).filter((volume) => !removedVolumeNames.has(volume?.name));
|
||||
for (const container of podSpec.containers ?? []) {
|
||||
container.volumeMounts = (container.volumeMounts ?? []).filter((mount) => !removedVolumeNames.has(mount?.name));
|
||||
}
|
||||
}
|
||||
|
||||
function deployServicesForProfile(deploy, profile) {
|
||||
const allowed = new Set(serviceIdsForProfile(profile));
|
||||
const services = new Map((deploy.services ?? [])
|
||||
@@ -867,8 +894,8 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
upsertEnv(container.env, "HWLAB_PUBLIC_ENDPOINT", runtimeEndpoint);
|
||||
}
|
||||
if (serviceId === "hwlab-cloud-api") {
|
||||
syncCodeAgentWorkspaceInitContainer(podTemplate.spec.initContainers, { image, runtimeCommit, runtimeImageTag });
|
||||
if (profile === "v02") {
|
||||
removeV02RepoOwnedCodeAgentPodConfig(podTemplate.spec);
|
||||
upsertEnv(container.env, "HWLAB_M3_IO_CONTROL_ENABLED", "false");
|
||||
upsertEnv(container.env, "HWLAB_ACCESS_CONTROL_REQUIRED", "1");
|
||||
upsertEnv(container.env, "HWLAB_BOOTSTRAP_ADMIN_ID", "usr_v02_admin");
|
||||
@@ -885,6 +912,8 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_SECRET_NAMESPACE", "agentrun-v01");
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_REPO_URL", "http://git-mirror-http.devops-infra.svc.cluster.local/pikasTech/HWLAB.git");
|
||||
upsertEnv(container.env, "UNIDESK_MAIN_SERVER_IP", "http://74.48.78.17:18081");
|
||||
} else {
|
||||
syncCodeAgentWorkspaceInitContainer(podTemplate.spec.initContainers, { image, runtimeCommit, runtimeImageTag });
|
||||
}
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_DEFAULT_PROVIDER_PROFILE", "deepseek");
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_DEEPSEEK_MODEL", deepSeekProfileModel);
|
||||
@@ -4339,7 +4368,8 @@ function v02PostgresManifest({ migrationSql, source }) {
|
||||
}
|
||||
|
||||
function runtimeKustomization({ profile = "dev", includeDeviceAgent = profile === "dev" } = {}) {
|
||||
const resources = ["namespace.yaml", "code-agent-codex-config.yaml", "services.yaml", "health-contract.yaml", "workloads.yaml", "deepseek-proxy.yaml"];
|
||||
const resources = ["namespace.yaml", "services.yaml", "health-contract.yaml", "workloads.yaml", "deepseek-proxy.yaml"];
|
||||
if (profile !== "v02") resources.splice(1, 0, "code-agent-codex-config.yaml");
|
||||
if (profile === "v02") resources.push("postgres.yaml");
|
||||
if (includeDeviceAgent) resources.push("device-agent-71-freq.yaml");
|
||||
resources.push("g14-frpc.yaml");
|
||||
@@ -4467,7 +4497,7 @@ async function plannedFiles(args) {
|
||||
const endpoints = profileEndpoint(args, profile);
|
||||
putJson(`${runtimePath}/kustomization.yaml`, runtimeKustomization({ profile, includeDeviceAgent }));
|
||||
putJson(`${runtimePath}/namespace.yaml`, runtimeNamespace);
|
||||
putJson(`${runtimePath}/code-agent-codex-config.yaml`, transformListNamespace(config, namespace, profileLabels, annotations));
|
||||
if (profile !== "v02") putJson(`${runtimePath}/code-agent-codex-config.yaml`, transformListNamespace(config, namespace, profileLabels, annotations));
|
||||
putJson(`${runtimePath}/services.yaml`, transformServices({ services, namespace, labels: profileLabels, annotations, profile }));
|
||||
putJson(`${runtimePath}/health-contract.yaml`, transformHealthContract(health, namespace, profileLabels, annotations, endpoints.runtimeEndpoint, endpoints.webEndpoint, profile));
|
||||
putJson(`${runtimePath}/workloads.yaml`, transformWorkloads({ workloads, deploy, catalog: artifactCatalog, source, sourceBranch: args.sourceBranch, registryPrefix: args.registryPrefix, runtimeEndpoint: endpoints.runtimeEndpoint, webEndpoint: endpoints.webEndpoint, profile, useDeployImages: args.useDeployImages }));
|
||||
|
||||
Reference in New Issue
Block a user