> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway Drain and Undrain During Image Upgrade and Maintenance

> In 9.0, the Aviatrix Controller drains HA gateway pairs before image upgrade, delete, and resize operations, and undrains them only after the data plane has converged.

In 9.0, the Aviatrix Controller drains HA gateway pairs before performing image
upgrade, gateway delete, and gateway resize operations. The gateway is removed
from Aviatrix routing and from the CSP route tables before the operation begins.
After the operation, the gateway is undrained only when the data plane has
converged.

The drain and undrain sequence is automatic. There is no manual control over
drain state in this release.

## How It Works

When you start an in-scope maintenance operation on an HA gateway pair, the
Controller runs this sequence on the gateway being changed:

<Steps>
  <Step title="Drain">
    The Controller removes the gateway from the Aviatrix routing fabric and
    updates CSP route tables so all traffic flows through the HA peer.
  </Step>

  <Step title="Run the operation">
    The image upgrade, delete, or resize operation runs while traffic flows
    through the HA peer.
  </Step>

  <Step title="Convergence verification">
    The Controller waits for the gateway to confirm that tunnels, BGP sessions,
    and dependent services are stable.
  </Step>

  <Step title="Undrain">
    Once convergence is confirmed, the Controller returns the gateway to active
    routing. CSP route tables are updated to include the gateway again.
  </Step>
</Steps>

## In-Scope Operations

| Operation             | Drain applies |
| --------------------- | ------------- |
| Gateway image upgrade | Yes           |
| Gateway delete        | Yes           |
| Gateway resize        | Yes           |

Operations outside this list are not in scope for the drain and undrain sequence
in 9.0.

## Changes from Prior Releases

| Behavior                                                          | Before 9.0   | 9.0                                 |
| ----------------------------------------------------------------- | ------------ | ----------------------------------- |
| CSP route tables updated to redirect traffic before the operation | Inconsistent | Always updated as part of the drain |
| Traffic restored to the gateway before convergence                | Possible     | No; convergence is verified first   |
| Drain during gateway delete                                       | No           | Yes                                 |
| Drain during gateway resize                                       | No           | Yes                                 |

## Error Handling

If the HA peer is unavailable when the drain sequence starts, the operation
fails. Bring the HA peer back to a healthy state before retrying.

## Limitations

* Drain and undrain apply to HA gateway pairs only. Single gateways without an
  HA peer are not protected by this sequence.
* Manual drain and undrain control is not available in this release.

## Related Topics

* <a href={"/docs/enterprise/" + "10.1" + "/guides/maintenance/upgrade-overview"}>Overview of Controller and Gateway Upgrades</a>
* <a href={"/docs/enterprise/" + "10.1" + "/guides/maintenance/gateway-image-upgrade"}>Gateway Image Upgrade</a>
