Skip to content

[FLINK-40092] Finalize BlueGreen transition after deleting previous deployment #1154

Merged
gyfora merged 3 commits into
apache:mainfrom
Shopify:finalize-forward-to-ACTIVE_GREEN-when-blue-is-deleted
Jul 14, 2026
Merged

[FLINK-40092] Finalize BlueGreen transition after deleting previous deployment #1154
gyfora merged 3 commits into
apache:mainfrom
Shopify:finalize-forward-to-ACTIVE_GREEN-when-blue-is-deleted

Conversation

@fqshopify

@fqshopify fqshopify commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

This pull request removes an unnecessary extra reconciliation loop during FlinkBlueGreenDeployment cutover, and in doing so closes a window that could cause a spurious abort with no rollback target.

Previously, after the operator successfully deleted the previous (Blue) FlinkDeployment, it returned noUpdate().rescheduleAfter(RETRY_DELAY_MS) without finalizing, leaving the BlueGreen resource in TRANSITIONING_TO_GREEN. Finalization to the terminal ACTIVE_GREEN state only happened on a later reconciliation.

That extra loop is not just wasteful, it re-runs monitorTransition on Green while the transition is still considered in-flight, so if Green is observed not ready in that window it is routed to shouldWeAbort and Green is suspended. With Blue already deleted, there is no rollback target left so the terminal state is no pipelines running i.e. downtime!

As a result, once the previous deployment has been successfully deleted, the transition can and should be committed forward immediately. This change reuses the existing finalizeBlueGreenDeployment logic in the same reconciliation that deletes Blue, so the abort path is no longer reachable after cutover.

Brief change log

  • Pass the target FlinkBlueGreenDeploymentState into deleteDeployment.
  • Finalize the BlueGreen transition immediately after successful deletion of the previous FlinkDeployment.
  • Preserve the existing retry behavior when deletion fails or is not acknowledged.
  • Add a regression test verifying that the transition commits to ACTIVE_GREEN in the same reconciliation that deletes Blue.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changes to the CustomResourceDescriptors: no
  • Core observer or reconciler logic that is regularly executed: yes

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@fqshopify
fqshopify marked this pull request as ready for review July 7, 2026 19:01
@fqshopify
fqshopify force-pushed the finalize-forward-to-ACTIVE_GREEN-when-blue-is-deleted branch from 31fbab1 to 3b46e13 Compare July 10, 2026 16:45

@drossos drossos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great fix for the BG bug we found.

CC: @gyfora & @schongloo for 👀 and FYI

@Dennis-Mircea Dennis-Mircea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice change, and it's more than the description says: finalizing in the same reconcile that deletes Blue doesn't just save a loop, it closes a real correctness window. In the old flow, after Blue was deleted the transition stayed in TRANSITIONING_TO_GREEN with abortTimestamp set, so a later reconcile that saw a not-ready Green blip past the abort deadline would abortDeployment and roll back to an already-deleted Blue.

@gyfora
gyfora merged commit 567ac1c into apache:main Jul 14, 2026
230 of 382 checks passed
@fqshopify
fqshopify deleted the finalize-forward-to-ACTIVE_GREEN-when-blue-is-deleted branch July 14, 2026 20:25
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.

5 participants