Skip to content

Commit

Permalink
fix(k8s): fix rollout status check for Recreate
Browse files Browse the repository at this point in the history
Before this fix, the rollout status of deployments using the `Recreate`
strategy would be reported as ready before the new pods were fully
ready.

This was fixed by copying/following the latest logic from kubectl's
rollout status checking logic, comparing the requested number of
replicas from the deployment spec with the actual updated pod count.

See:
https://github.com/kubernetes/kubectl/blob/24d21a0ee42ecb5e5bed731f36b2d2c9c0244c35/pkg/polymorphichelpers/rollout_status.go
  • Loading branch information
thsig authored and edvald committed Jan 27, 2022
1 parent 94ab87f commit bcd2df2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/plugins/kubernetes/status/workload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
V1StatefulSetSpec,
V1DeploymentStatus,
CoreV1Event,
V1DeploymentSpec,
} from "@kubernetes/client-node"
import dedent = require("dedent")
import { getCurrentWorkloadPods } from "../util"
Expand Down Expand Up @@ -224,8 +225,9 @@ async function getRolloutStatus(workload: Workload) {
}
} else {
const status = <V1DeploymentStatus>workload.status
const deploymentSpec = <V1DeploymentSpec>workload.spec

const desired = status.replicas || 0
const desired = deploymentSpec.replicas || 1
const updated = status.updatedReplicas || 0
const replicas = status.replicas || 0
const available = status.availableReplicas || 0
Expand Down

0 comments on commit bcd2df2

Please sign in to comment.