Skip to content

feat(planner): make the rollback-detection window configurable - #709

Open
blaketsk wants to merge 1 commit into
temporalio:mainfrom
blaketsk:configurable-rollback-window
Open

blaketsk wants to merge 1 commit into
temporalio:mainfrom
blaketsk:configurable-rollback-window

Conversation

@blaketsk

Copy link
Copy Markdown

Closes #698

What

  • New optional field spec.rollout.rollbackWindow (metav1.Duration). It replaces the fixed one-hour window isRollbackScenario uses to decide whether returning to a previously current version is a rollback.
  • Defaults to 1h through the CRD default and WorkerDeploymentSpec.Default, so existing deployments behave exactly as before.
  • 0s disables rollback detection: every change of the target version goes through the configured strategy. This is an explicit check, so a server clock running slightly ahead of the controller cannot trigger a rollback.
  • Negative values are rejected by a CEL rule on the CRD.
  • defaults.RollbackMaxVersionAge is renamed to defaults.RollbackWindow.
  • Docs: the Rollback Strategy section in configuration.md no longer says rollback is not configurable, and the field is listed in concepts.md. The docs also state that a rollback does not wait for the gate workflow.

I put the field under rollout because it decides whether that strategy is bypassed. If you'd prefer a different name or shape, for example a nested rollback: struct or a controller-level default as the issue also mentions, I'm happy to change it.

Note on what the window measures

The window is compared against the target version's LastCurrentTime. The Temporal API defines that as when the version last became current, not when it was replaced. So to cover a rollback after a long rollout, the window has to span both how long the previous version stayed current and how long the new rollout took. The docs now say this explicitly.

Measuring from the moment the version was replaced instead would match operators' intuition better. One option is the LastCurrentTime of the next version that became current. That changes the default behaviour, though, so I left it out of this PR. I can follow up if you think it's worth doing.

Tested locally

  • go test ./... with envtest, including:
    • new TestIsRollbackScenario cases: a custom window inside and outside the version's age, and a zero window with a future LastCurrentTime;
    • Default() cases for the default and an explicit 0s;
    • CEL tests: default to 1h, 0s accepted, negative rejected.
  • make lint.
  • make manifests generate. Only the WorkerDeployment and deprecated TemporalWorkerDeployment CRDs change, since they share RolloutStrategy.

Add spec.rollout.rollbackWindow, which replaces the fixed one-hour window
used to decide whether a return to a previously current version is a
rollback. It defaults to 1h, so existing deployments behave as before, and
0s disables rollback detection. Negative values are rejected by the CRD.

Closes temporalio#698

Signed-off-by: Andrey Osipov <blaketsk@gmail.com>
@blaketsk
blaketsk requested review from a team, eniko-dif and jlegrone as code owners November 28, 2026 07:50
@CLAassistant

CLAassistant commented Nov 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Make the rollback-detection window configurable

2 participants