:_mod-docs-content-type: PROCEDURE

//included in backing-up-3scale-api-management-by-using-oadp.adoc assembly

[id="backing-up-the-3scale-operator-secret-apimanager_{context}"]
= Backing up the 3scale API Management operator, secret, and APIManager

[role="_abstract"]
Back up the Red{nbsp}Hat 3scale API Management operator resources, including the `Secret` and APIManager custom resources (CRs), by creating backup CRs. This helps you preserve your 3scale operator configuration for recovery scenarios.

.Prerequisites

* You created the Data Protection Application (DPA). 

.Procedure

. Back up your 3scale operator CRs, such as `operatorgroup`, `namespaces`, and `subscriptions`, by creating a YAML file with the following configuration: 
+

[source,yaml]
----
apiVersion: velero.io/v1
kind: Backup
metadata:
  name: operator-install-backup
  namespace: openshift-adp
spec:
  csiSnapshotTimeout: 10m0s
  defaultVolumesToFsBackup: false
  includedNamespaces:
  - threescale
  includedResources:
  - operatorgroups
  - subscriptions
  - namespaces
  itemOperationTimeout: 1h0m0s
  snapshotMoveData: false
  ttl: 720h0m0s
----
+
where:
+
`operator-install-backup`:: Specifies the value of the `metadata.name` parameter in the backup. This is the same value used in the `metadata.backupName` parameter used when restoring the 3scale operator.
`threescale`:: Specifies the namespace where the 3scale operator is installed.
+
[NOTE]
====
You can also back up and restore `ReplicationControllers`, `Deployment`, and `Pod` objects to ensure that all manually set environments are backed up and restored. This does not affect the flow of restoration.
====

. Create a backup CR by running the following command:
+
[source,terminal]
----
$ oc create -f backup.yaml
----
+
.Example output

[source,terminal]
----
backup.velero.io/operator-install-backup created
----

. Back up the `Secret` CR by creating a YAML file with the following configuration:
+

[source,yaml]
----
apiVersion: velero.io/v1
kind: Backup
metadata:
  name: operator-resources-secrets
  namespace: openshift-adp
spec:
  csiSnapshotTimeout: 10m0s
  defaultVolumesToFsBackup: false
  includedNamespaces:
  - threescale
  includedResources:
  - secrets
  itemOperationTimeout: 1h0m0s
  labelSelector:
    matchLabels:
      app: 3scale-api-management
  snapshotMoveData: false
  snapshotVolumes: false
  ttl: 720h0m0s
----
+
`name`:: Specifies the value of the `metadata.name` parameter in the backup. Use this value in the `metadata.backupName` parameter when restoring the `Secret`.

. Create the `Secret` backup CR by running the following command:
+
[source,terminal]
----
$ oc create -f backup-secret.yaml
----
+
.Example output

[source,terminal]
----
backup.velero.io/operator-resources-secrets created
----

. Back up the APIManager CR by creating a YAML file with the following configuration:
+

[source,yaml]
----
apiVersion: velero.io/v1
kind: Backup
metadata:
  name: operator-resources-apim
  namespace: openshift-adp
spec:
  csiSnapshotTimeout: 10m0s
  defaultVolumesToFsBackup: false
  includedNamespaces:
  - threescale
  includedResources:
  - apimanagers
  itemOperationTimeout: 1h0m0s
  snapshotMoveData: false
  snapshotVolumes: false
  storageLocation: ts-dpa-1
  ttl: 720h0m0s
  volumeSnapshotLocations:
  - ts-dpa-1
----
+
`name`:: Specifies the value of the `metadata.name` parameter in the backup. Use this value in the `metadata.backupName` parameter when restoring the APIManager.

. Create the APIManager CR by running the following command:
+
[source,terminal]
----
$ oc create -f backup-apimanager.yaml
----
+
.Example output

[source,terminal]
----
backup.velero.io/operator-resources-apim created
----