Chapter 10. 3scale backup and restore using custom resources


This chapter includes details about the backup and restore functionality for a Red Hat 3scale API Management installation deployed using the APIManager custom resource (CR). In this context, the CRD is provided by the 3scale operator.

Custom resources from operator capabilities are not part of the 3scale installation. For this reason, the custom resources are not included as part of the 3scale installation backup and restore functionality.

Important

3scale backup and restore using operators is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

Prerequisites

  • A 3scale installation

The following sections contain the procedures to perform 3scale backup and restore using the operator.

10.1. Backing up 3scale using the operator

The following section provides the information and procedure you require to backup a 3scale installation that was deployed by an APIManager custom resource.

10.1.1. Backup compatible scenarios

To see the 3scale installation configurations that can be backed up, see the following sections:

Prerequisites

  • Backup the 3scale external databases:

    • backend-redis
    • system-redis
    • system-database - MySQL or PostgreSQL
  • Provision enough space for the PVC to contain the data backed up.
Note

A 3scale deployment, which is deployed using APIManager cannot be backed up using S3 as System’s FileStorage.

10.1.2. Backup scenarios scope

Backup functionality is available when the following databases are configured externally:

  • Backend Redis database
  • System Redis database
  • System database - MySQL or PostgreSQL

10.1.3. Backed up data

The following table shows a list of the data that is backed up.

Table 10.1. Data that is backed up
ObjectObject-type data

Secrets

  • system-smtp
  • system-seed
  • backend-internal-api
  • backend-listener
  • system-events-hook
  • system-app
  • system-recaptcha
  • zync
  • system-master-apicast
  • system-memcache
  • system-database
  • backend-redis
  • system-redis

ConfigMaps

  • system-environment
  • apicast-environment

APIManager

APIManager custom resource Kubernetes object definition - json schema definition

System FileStorage

When the location of System FileStorage is in a PersistentVolumeClaim (PVC)

10.1.4. Backing up 3scale

To backup a 3scale installation deployed with an existing APIManager, use the following steps:

Procedure

  1. Backup the following Kubernetes secrets:

    • backend-redis
    • system-redis
    • system-database
  2. Create the APIManagerBackup custom resource in the same namespace where the 3scale installation managed by the APIManager object is deployed, as in example one:

    Example 1

      apiVersion: apps.3scale.net/v1alpha1
      kind: APIManagerBackup
      metadata:
       name: example-apimanagerbackup-pvc
      spec:
        backupDestination:
          persistentVolumeClaim:
            resources:
              requests: "10Gi"

    Example 2 provides a pre-existing PersistentVolume name:

      apiVersion: apps.3scale.net/v1alpha1
      kind: APIManagerBackup
      metadata:
       name: example-apimanagerbackup-pvc
      spec:
        backupDestination:
          persistentVolumeClaim:
            # resources specification is required but ignored when providing a volumeName as per K8s PVCs requirements behavior
            resources:
              requests: "10Gi"
            volumeName: "my-preexisting-persistent-volume"

  3. Wait until APIManagerBackup finishes. Check this by obtaining the content of APIManagerBackup and waiting until the .status.completed field is set to true.

The backup contents is detailed in Backed up data.

Other fields in the status section of the APIManagerBackup show details of the backup, such as the name of the PVC where the data has been backed up when the configured backup destination has been a PVC.

For future references, take note of the value of status.backupPersistentVolumeClaimName field. When restoring an APIManager installation with APIManagerRestore, one of the fields it requires is the PersistentVolumeClaimName backup source.

10.2. Restoring 3scale using the operator

The following section provides the information and procedure you require to restore a 3scale installation that was previously deployed by an APIManager custom resource and backed up by APIManagerBackup.

10.2.1. Restore compatible scenarios

To see the 3scale installation configurations that can be restored, see the following sections:

Prerequisites

  • Restore the 3scale external databases:

    • backend-redis
    • system-redis
    • system-database - MySQL or PostgreSQL

10.2.2. Restore scenarios scope

The restore functionality of the 3scale operator is available using a backup generated from an APIManagerBackup custom resource.

For a list of the 3scale solution scenarios you can backup, see Backed up data for reference.

The following are not in the scope of the restore functionality of the operator:

  • Restoring backup data that was not performed using an APIManagerBackup custom resource.
  • Restoring backup data provided through an APIManagerBackup from different 3scale versions.

10.2.3. Restored data

The following table shows a list of the data that is restored.

Table 10.2. Data that is restored
ObjectObject-type data

Secrets

  • system-smtp
  • system-seed
  • backend-internal-api
  • system-events-hook
  • system-app
  • system-recaptcha
  • zync
  • system-master-apicast

ConfigMaps

  • system-environment
  • apicast-environment

APIManager

APIManager custom resource Kubernetes object definition - json schema definition

System FileStorage

When the location of System FileStorage is in a PersistentVolumeClaim (PVC)

Routes

3scale-related OpenShift routes, for example master and tenants

10.2.4. Restoring 3scale

To restore a 3scale installation previously deployed with an APIManager that was backed up using an APIManagerBackup custom resource, follow these steps:

  1. Ensure that the project where you are performing the restoration does not contain an APIManager custom resource and its corresponding 3scale installation.
  2. Restore the following Kubernetes secrets:

    • backend-redis
    • system-redis
    • system-database
  3. Create the APIManagerRestore custom resource and specify the backup data of the installation that was previously backed up by an APIManagerBackup custom resource.

    For details, see Backup scenarios scope.

    The following is an example of an APIManagerRestore custom resource:

      apiVersion: apps.3scale.net/v1alpha1
      kind: APIManagerRestore
      metadata:
        name: example-apimanagerrestore-pvc
      spec:
       restoreSource:
         persistentVolumeClaim:
           claimSource:
             claimName: example-apimanagerbackup-pvc # Name of the PVC produced as the backup result of an `APIManagerBackup`
             readOnly: true
  4. Wait until APIManagerRestore finishes. Check this by obtaining the content of APIManagerRestore and waiting until the .status.completed field is set to true.

    You should see a new APIManager custom resource has been created and a 3scale installation deployed.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.