feat: release 2.5.1
This commit is contained in:
+10
-24
@@ -2,6 +2,7 @@ import type { V1Deployment, V1Pod } from "@kubernetes/client-node";
|
||||
import { LABELS } from "../const";
|
||||
import { ctx } from "./context";
|
||||
import { apps, core, objectApi } from "./k8s";
|
||||
import { waitForRollout } from "./rollout";
|
||||
|
||||
const ManagedBySelector = `app.kubernetes.io/managed-by=${LABELS["app.kubernetes.io/managed-by"]}`;
|
||||
|
||||
@@ -95,30 +96,15 @@ export async function waitForDeploymentRollout(
|
||||
name: string,
|
||||
timeoutMs = 300000,
|
||||
) {
|
||||
const startedAt = Date.now();
|
||||
|
||||
while (Date.now() - startedAt < timeoutMs) {
|
||||
const deployment = await getDeployment(name);
|
||||
const desiredReplicas = deployment.spec?.replicas ?? 1;
|
||||
const observedGeneration = deployment.status?.observedGeneration ?? 0;
|
||||
const generation = deployment.metadata?.generation ?? 0;
|
||||
const updatedReplicas = deployment.status?.updatedReplicas ?? 0;
|
||||
const availableReplicas = deployment.status?.availableReplicas ?? 0;
|
||||
const unavailableReplicas = deployment.status?.unavailableReplicas ?? 0;
|
||||
|
||||
if (
|
||||
observedGeneration >= generation &&
|
||||
updatedReplicas === desiredReplicas &&
|
||||
availableReplicas === desiredReplicas &&
|
||||
unavailableReplicas === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
await delay(2000);
|
||||
}
|
||||
|
||||
throw new Error(`Timed out waiting for deployment ${name} rollout`);
|
||||
return waitForRollout(
|
||||
name,
|
||||
Date.now() + timeoutMs,
|
||||
() => getDeployment(name),
|
||||
async () =>
|
||||
(await apps.listNamespacedReplicaSet({ namespace: getProject() })).items,
|
||||
async () =>
|
||||
(await core.listNamespacedPod({ namespace: getProject() })).items,
|
||||
);
|
||||
}
|
||||
|
||||
export function throwWhen<T, Narrowed extends T>(
|
||||
|
||||
Reference in New Issue
Block a user