# Data plane upgrade authorization

> The authorization boundary around data plane upgrades since 0.5.0: which credential runs an upgrade, the order for deployments that run their own management plane, and what fails when a step is skipped.

Since 0.5.0, upgrading a <Term id="data-plane">data plane</Term> is authorized separately from managing one.

## What sits behind the boundary

Five upgrade operations require the `dataplane_upgrade.operate` permission or the effective `dataplane_operator` scope:

- `SubmitDataplaneUpgradeCredentials`
- `GetDataplaneUpgradeCredentials`
- `AckDataplaneUpgradeCredentials`
- `CancelDataplaneUpgrade`
- `RollbackDataplaneUpgrade`

`TriggerUpdate` applies the same requirement when its type is `DATAPLANE_UPGRADE`. Ordinary configuration updates keep their existing authorization, and trusted in-process auto-upgrade keeps its existing opt-in and eligibility checks: neither is affected by the boundary.

## Who holds the grant

- Only the `dataplane` machine role holds `dataplane_upgrade.operate`. The workers that fetch and acknowledge upgrade credentials hold it through their existing `dataplane` role binding; no re-scope of worker service accounts is needed.
- The `dataplane_operator` scope is carried by the platform credential. It is not in the customer-mintable management-key catalog, so it cannot be added to an ordinary management API key.
- **Organization admin credentials can no longer run upgrades.** Before 0.5.0 they could; a credential that ran upgrades through 0.4.x receives `permission_denied` on the operations above until the platform credential carries the operator scope.

On a Tetrate-hosted management plane these grants are prepared by Tetrate as part of the release, and nothing on this page is an operator step. The rest of this page applies to a deployment that runs its own management plane (the topology the `tetrate` CLI installs).

## The order

:::note
The auth service is removed in 0.11.0, so the steps that deploy it, and the failure that follows from skipping it, apply to a management plane on 0.10.x or earlier. A deployment that upgrades to 0.11.0 has no auth service to deploy.
:::

The steps run in this order because each one makes the next safe. Deploying the management plane first is the failure case, not a variant.

1. **Deploy the auth service at the new release.** It defines `dataplane_upgrade.operate` and binds it to the `dataplane` role.
1. **Verify the permission exists and belongs only to the `dataplane` role** before anything starts enforcing against it.
1. **Let the upgrade prepare the platform credential.** Database migration `0137_admin_api_keys_dataplane_operator.sql` adds the `dataplane_operator` scope to the existing platform credential and keeps its other scopes. The bootstrapper job applies it before the new management plane serves, so no credential is regenerated and no consumer is restarted. When the bootstrapper is disabled (`--no-bootstrap`, or `bootstrapper.enabled: false`), the migration is run by hand against the management plane database before the next step, with the deployment's customer named for the run:

   ```sh
   PGOPTIONS='-c app.customer_id=<customer>' psql "$DATABASE_URL" -v ON_ERROR_STOP=1 \
     -f src/db/migrations/0137_admin_api_keys_dataplane_operator.sql
   ```

   The migration can be run again safely, and it can run before the release is deployed.
1. **Verify the worker role bindings.** Every worker that calls `GetDataplaneUpgradeCredentials` or `AckDataplaneUpgradeCredentials` must hold its `dataplane` role binding.
1. **Deploy the management plane.** Enforcement begins here, and by this point every caller already holds what it needs.

## What fails when a step is skipped

- **Management plane deployed before the auth service**: `GetDataplaneUpgradeCredentials` and the credentials acknowledgement are denied for every data plane. No data plane can be upgraded until the auth service catches up.
- **Platform credential not prepared** (the bootstrapper was disabled and the migration was not run by hand): upgrade operations fail with `permission_denied`, and the error does not name the missing scope. The deployment keeps serving traffic and accepts ordinary configuration changes; only the ability to upgrade the data plane is lost, which is easy to misread as an upgrade bug rather than a credential gap.
- **A worker without its `dataplane` role binding**: that worker's credential fetch and acknowledgement are denied, and its data plane cannot complete an upgrade.

## Rolling back

If upgrade operations fail after enforcement, restoring the previous management plane image restores the previous behavior. The added permission and the prepared platform credential are additive and can stay in place; they do nothing until the new release is deployed again. This rollback temporarily restores organization-admin upgrade access, so the redeployment should follow once the cause is fixed rather than being left open-ended.

Where to go next

  <Link to="/agent-router-enterprise/self-hosted-data-plane/upgrade-the-data-plane/" className="tare-nav-card">
    Upgrade a self-hosted data plane
    The order and the rules around the upgrade command, and how to read a release before upgrading.
  </Link>
  <Link to="/reference/tetrate-cli/upgrade/" className="tare-nav-card">
    tetrate agentrouter dataplane upgrade
    Flags, atomic rollback, drain behavior, and the doctor rows.
  </Link>
