This page provides instructions for how to restore a Harbor instance backup in
Google Distributed Cloud (GDC) air-gapped.

Restores require an existing backup to function. The restore uses the specified
backup data for the restoration.
A restore only supports restoring a Harbor instance that has the same reference as
the backup. The original Harbor instance must be deleted before
restoration starts.

## Before you begin

You must have an existing backup. You create backups by doing one of the
following:

- **Automatically** : schedule automatic backups using a backup plan. For more information, see [Create a backup plan](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/harbor-backup/create-backup-plan-harbor.md.txt).
- **Manually** : create manual backups on demand. For more information, see [Create a manual backup](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/harbor-backup/create-manual-backup-harbor.md.txt).

### Required IAM roles

Request the necessary permissions from your IAM Project Admin. Enforce
least privilege access by requesting only the roles required for your specific
tasks.

- **Secret Admin** (`secret-admin`): get, list, create, update, patch, and delete all Kubernetes secrets within the project namespace. This is a project-level permission that includes the sensitive authentication credentials needed by the backup repository.
- **Harbor Instance Admin** (`harbor-instance-admin`): get, list, watch, create, update, patch, and delete Harbor instances, backup repositories, backup plans, backups, and restores within a specific project namespace.

## Create a restore

Create a restore in the GDC console or the API.

### Console

1. Sign in to the GDC console.
2. In the navigation menu, click **Backup for harbor instance**.
3. Click **Backups**.
4. Click the name of the backup you want to restore.
5. Click **Restore a backup**.

### API

```yaml
apiVersion: artifactregistry.gdc.goog/v1
kind: HarborInstanceRestore
metadata:
  name: RESTORE_NAME
  namespace: INSTANCE_NAMESPACE
spec:
  backupName: BACKUP_NAME
  description: RESTORE_DESCRIPTION
```

Replace the following:

- `RESTORE_NAME`: the name of the restore.
- `INSTANCE_NAMESPACE`: the namespace containing the Harbor instance. The backup plan containing the backup to restore must be in the same namespace as the Harbor instance to restore.
- `BACKUP_NAME`: the name of the backup that the system restores.
- `RESTORE_DESCRIPTION`: a text description of the restore being created.