Repository navigation
fix(keda): hold one replica until the new revision is ready - #4143
Elvand-Lie wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Elvand-Lie The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Elvand-Lie. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
eac53a3 to
e5da8ff
Compare
|
Thanks @Elvand-Lie. Holding the minimum at 1 across the redeploy looks like the right direction for #4118, and it sits well with #4075 and #4089 now that both are in. A few questions:
/ok-to-test |
On a redeploy the existing scaler can still be at min 0, so KEDA may scale the Deployment away before the readiness wait sees a pod of the new revision. The deploy then reports success without proving the new image ever started. Before the raw deploy (and after exposure preflight validation), raise an existing HTTPScaledObject or Kafka ScaledObject from min 0 to 1, whatever minimum is now configured. For HTTP, also wait until the generated ScaledObject KEDA scales from reports min 1. Opt KEDA into k8s.WithRequireReadyReplica(true) so the readiness wait keeps polling through any settled zero caused by a stale KEDA loop until a pod of the new revision becomes ready, while keeping the raw deployer's scale-to-zero readiness behavior unchanged. Also require ObservedGeneration >= Generation before evaluating nonzero readiness so stale ready counts and pods from the previous revision cannot satisfy the wait after an image update. Disarm the deferred restore to min 0 once ensureHTTPScaledObject or ensureScaledObject has reconciled the configured scaler spec, so a later failure cannot roll a configured scale.min back to 0. If the deploy fails before scaler reconciliation, restore min 0 under a bounded timeout. The scaler is written with update, which the documented deploy roles already grant. Fixes knative#4118 Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
e5da8ff to
29ce097
Compare
|
@lkingland I rebased onto
|
On a
kedaredeploy, an existing scaler at min 0 can scale the Deployment to zero before the readiness wait sees a pod of the new revision. The deploy then reports success without proving the new image started, so a broken image deploys "successfully".Before the raw deploy (and after exposure preflight validation), raise an existing HTTPScaledObject or Kafka ScaledObject from min 0 to 1. For HTTP, also wait until the ScaledObject the KEDA HTTP add-on generates reports min 1, since KEDA scales from that one. Opt
keda.NewDeployerintok8s.WithRequireReadyReplica(true)so the readiness wait keeps polling through any settled zero caused by a stale KEDA loop until a pod of the new revision becomes ready, and requireObservedGeneration >= Generationbefore evaluating nonzero readiness so stale status and pods from the previous revision cannot satisfy the wait. Therawdeployer and exportedk8s.WaitForDeploymentAvailable*functions keep#4075's scale-to-zero behavior unchanged.Once
ensureHTTPScaledObjectorensureScaledObjectreconciles the configured scaler spec, disarm the deferred restore so a later failure (for exampleRecordExposure,clearExposure, orWaitForHTTPScaledObjectAvailableafter Update) cannot roll a configuredscale.minback to 0. If the deploy fails before scaler reconciliation, the minimum is restored to 0 under a bounded timeout.Changes
k8s.WithRequireReadyReplica(bool)andwaitForDeploymentAvailable(..., allowZero bool)inpkg/k8s/deployer.goandpkg/k8s/wait.go; guard nonzero readiness withObservedGeneration >= Generationkeda.NewDeployerintok8s.WithRequireReadyReplica(true), movevalidateExposurebefore the hold, addsetScalerMin/WaitForScaledObjectMinReplicas, and disarm the deferred restore onceensureHTTPScaledObjectorensureScaledObjectreconciles the configured spec (pkg/keda/deployer.go,pkg/keda/kafka_scaling.go,pkg/keda/wait.go)update, since the documented deploy roles do not grantpatchpkg/k8s/wait_test.go,pkg/k8s/wait_poll_test.go,pkg/keda/deployer_hold_test.go, andpkg/keda/kafka_scaling_test.go/kind bug
Fixes #4118
Related: #4068, #4075, #4089
Testing
Covers HTTP and Kafka hold/restore ordering, waiting through settled zero and stale previous-revision generations,
rawkeeping settled-zero acceptance, and restore disarming afterensureHTTPScaledObject(Update andDeepEqualno-op). Not run locally: a live cluster with KEDA installed.Release Note
Docs