Skip to content

feat: add support for blue/green deployments #911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

feat: add support for blue/green deployments #911

wants to merge 47 commits into from

Conversation

aaron-congo
Copy link
Contributor

Description

Adds support for Blue/Green Deployments for the following DB types:

  • Aurora Mysql cluster
  • Aurora Postgres cluster
  • RDS Mysql Multi-AZ Instance
  • RDS Postgres Multi-AZ Instance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

logger.debug(
Messages.get_formatted(
"SuspendConnectRouting.SwitchoverCompleteContinueWithConnect",
(time.time() - start_time_sec) // 1000))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(time.time() - start_time_sec) // 1000))
(time.time() - start_time_sec) * 1000))

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we track the time using ms or ns instead of seconds for more detailed time reporting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

time.time() returns a floating point that includes fractions of a second, for example if I run time.time() on my machine I get 1752773235.3210173, so I believe we will still get ms precision

switchover_completed = (not self._rollback and self._summary_status.phase == BlueGreenPhase.COMPLETED) or \
(self._rollback and self._summary_status.phase == BlueGreenPhase.CREATED)
has_active_switchover_phases = \
any(phase_info.phase is not None and phase_info.phase.is_active_switchover_completed
Copy link
Contributor

@karenc-bq karenc-bq Jul 17, 2025

Choose a reason for hiding this comment

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

Suggested change
any(phase_info.phase is not None and phase_info.phase.is_active_switchover_completed
any(phase_info.phase is not None and phase_info.phase.is_switchover_active_or_completed

Copy link
Contributor

Choose a reason for hiding this comment

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

The log switchover final summary output's formatting looks off, would you be able to verify it?

----------------------------------------------------------------------------------
timestamp                         time offset (ms)                           event----------------------------------------------------------------------------------
>28s                    ms                                
----------------------------------------------------------------------------------


def _update_dns_flags(self, bg_role: BlueGreenRole, interim_status: BlueGreenInterimStatus):
if bg_role == BlueGreenRole.SOURCE and not self._blue_dns_update_completed and interim_status.all_start_topology_ip_changed:
logger.debug("bgd.blueDnsCompleted", self._bg_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.debug("bgd.blueDnsCompleted", self._bg_id)
logger.debug("BlueGreenStatusProvider.BlueDnsCompleted", self._bg_id)

self._store_event_phase_time("Blue DNS updated")

if bg_role == BlueGreenRole.TARGET and not self._green_dns_removed and interim_status.all_start_topology_endpoints_removed:
logger.debug("bgd.greenDnsRemoved", self._bg_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.debug("bgd.greenDnsRemoved", self._bg_id)
logger.debug("BlueGreenStatusProvider.GreenDnsRemoved", self._bg_id)

self._store_event_phase_time("Green DNS removed")

if bg_role == BlueGreenRole.TARGET and not self._green_topology_changed and interim_status.all_topology_changed:
logger.debug("bgd.greenTopologyChanged", self._bg_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.debug("bgd.greenTopologyChanged", self._bg_id)
logger.debug("BlueGreenStatusProvider.GreenTopologyChanged", self._bg_id)

self._summary_status = self._get_status_of_completed()

else:
raise ValueError(Messages.get_formatted("bgd.unknownPhase", self._bg_id, self._latest_phase))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
raise ValueError(Messages.get_formatted("bgd.unknownPhase", self._bg_id, self._latest_phase))
raise ValueError(Messages.get_formatted("BlueGreenStatusProvider.UnknownPhase", self._bg_id, self._latest_phase))

execute_func: Callable,
*args: Any,
**kwargs: Any) -> ValueContainer[Any]:
logger.debug("SuspendExecuteRouting.InProgressSuspendMethod")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger.debug("SuspendExecuteRouting.InProgressSuspendMethod")
logger.debug("SuspendExecuteRouting.InProgressSuspendMethod", method_name)

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.

2 participants