fix(v03): keep cloud api available during rollout (#2000)
This commit is contained in:
@@ -914,7 +914,7 @@ function removeV02LegacySimulatorEnv(envList) {
|
||||
return envList.filter((entry) => !v02RemovedServiceEnvNames.has(entry?.name));
|
||||
}
|
||||
|
||||
function removeV02RepoOwnedCodeAgentPodConfig(podSpec) {
|
||||
function removeV02RepoOwnedCodeAgentPodConfig(deploymentSpec, podSpec) {
|
||||
if (!podSpec) return;
|
||||
podSpec.initContainers = (podSpec.initContainers ?? []).filter((entry) => entry?.name !== "hwlab-code-agent-workspace-init");
|
||||
const removedVolumeNames = new Set([
|
||||
@@ -927,6 +927,15 @@ function removeV02RepoOwnedCodeAgentPodConfig(podSpec) {
|
||||
for (const container of podSpec.containers ?? []) {
|
||||
container.volumeMounts = (container.volumeMounts ?? []).filter((mount) => !removedVolumeNames.has(mount?.name));
|
||||
}
|
||||
if (deploymentSpec?.strategy?.type === "Recreate") delete deploymentSpec.strategy;
|
||||
}
|
||||
|
||||
function applyDeployServiceReplicas(item, deployService) {
|
||||
if (!(item?.kind === "Deployment" || item?.kind === "StatefulSet")) return;
|
||||
const replicas = deployService?.replicas;
|
||||
if (!Number.isInteger(replicas) || replicas < 0) return;
|
||||
item.spec ??= {};
|
||||
item.spec.replicas = replicas;
|
||||
}
|
||||
|
||||
function deployServicesForProfile(deploy, profile) {
|
||||
@@ -1280,6 +1289,7 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
const serviceId = serviceIdForWorkload(item, container);
|
||||
const deployService = deployServices.get(serviceId);
|
||||
if (!deployService) continue;
|
||||
applyDeployServiceReplicas(item, deployService);
|
||||
const artifact = runtimeArtifactForService({ catalog, deploy, serviceId, source, registryPrefix, useDeployImages, digestPin, envReuseServiceIds });
|
||||
const envReuse = runtimeLane && v02EnvReuseEnabled(catalog, serviceId, envReuseServiceIds);
|
||||
const bootDeployService = envReuse ? deployServiceForBoot(deploy, serviceId, profile) : null;
|
||||
@@ -1327,7 +1337,7 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
}
|
||||
if (serviceId === "hwlab-cloud-api") {
|
||||
if (runtimeLane) {
|
||||
removeV02RepoOwnedCodeAgentPodConfig(podTemplate.spec);
|
||||
removeV02RepoOwnedCodeAgentPodConfig(item.spec, podTemplate.spec);
|
||||
upsertEnv(container.env, "HWLAB_M3_IO_CONTROL_ENABLED", "false");
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_REPO_URL", gitReadUrl ?? defaultRuntimeLaneGitReadUrl);
|
||||
upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_PROVIDER_ID", runtimeNodeIdForProfile(deploy, profile));
|
||||
|
||||
Reference in New Issue
Block a user