Skip to content

atecontroller: set the worker Deployment rollout strategy - #1783

Merged
Scott Funkenhauser (sfunkenhauser) merged 1 commit into
agent-substrate:mainfrom
HavenXia:workerpool-rollout-strategy
Sep 22, 2026
Merged

Scott Funkenhauser (sfunkenhauser) merged 1 commit into
agent-substrate:mainfrom
HavenXia:workerpool-rollout-strategy

Conversation

@HavenXia

Copy link
Copy Markdown
Member

The Kubernetes default strategy (maxSurge=25%, maxUnavailable=25%) can stall small pools when a workerpool edit and get k8s deployment rolling:

below 4 replic, as maxUnavailable rounds to 0, the surge pod needs to land first, and if existing pods already take all spaces of their node, the new one never lands and the rollout is stuck.

Use maxSurge 0 with maxUnavailable 10%, which Kubernetes will evaluate as removing remove least one pod first so it will never block.

Also modify progressDeadlineSecondsto be 3600s so a batch waiting out the drain window (currently 30min) is not reported as a failed rollout.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

const (
workerRolloutMaxSurge = 0
workerRolloutMaxUnavailable = "10%"
workerRolloutProgressDeadlineSeconds = int32(3600)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the rollout deadline slightly longer than the termination grace period? If they are exactly the same we could potentially still hit failed rollout errors.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to 4800

// - progressDeadlineSeconds above that 30min window, so a batch waiting out the
// drain does not have kubectl rollout status report a failed rollout.
const (
workerRolloutMaxSurge = 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands, you're guaranteed to have 90% capacity during upgrades, correct?

What if we had 2 configurations? If your workerpool is large enough, we use the default settings to potentially give you better availability (surge first), but if your workerpool is small enough that the 25% unavailable (<4 replicas) could cause it to get stuck we use the more conservative rollout strategy?

@HavenXia Haven Xia (HavenXia) Sep 21, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 90% is guaranteed floor.

nit: k8s is not surge-first, its default is removing and adding at the same time.

I don't buy 2 configuration too much, it's a little bit burden for documentation and tests and could have edge cases when replica=4. Also the current "remove" is graceful, controller mark the first batch worker pods as TERMINATING but every actor can still run for 30mins, there are three cases for the new pods:

  1. if there are still spaces, or the pod has no resource request: it can lands immediately, no availability lost.
  2. if there are no space, but this cluster has autoscaler or similar: new pods land on new nodes, no availability lost.
  3. if there are no space and the nodes count(pool) is fixed: the 10% needs to exit so new pods can land, this is the 90% floor. notice the default k8s rollout will also stuck the new pods since there are no spaces from k8s scheduler perspective

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this for now, but my understanding was that with maxSurge: 0 the deployment would never have any additional pods created during upgrade. So 1) and 2) won't happen, there will always be at least 1 pod that's unavailable (and more than likely closer to 10%).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with maxSurge: 0 the deployment would never have any additional pods created during upgrade

I think maxSurge=0 is to make active pods number capped at total, but a TERMINATING pod is not counted as active pods. So the moment the 10% get marked as TERMINATING, the new 10% can come up if there's space (which is 1) and 2)). Physically that is 90 old + 10 draining + 10 new.

https://github.com/kubernetes/kubernetes/blob/v1.34.0/pkg/controller/controller_utils.go#L1088-L1092

Merged via the queue into agent-substrate:main with commit d0d85c3 Sep 22, 2026
11 checks passed
@HavenXia
Haven Xia (HavenXia) deleted the workerpool-rollout-strategy branch October 28, 2026 16:26
@HavenXia
Haven Xia (HavenXia) restored the workerpool-rollout-strategy branch October 28, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants