# Configuration Settings for an Aerospike Restore on Kubernetes

## Overview

Aerospike Restore (AR) configuration settings are in the AR Custom Resource (CR). The Aerospike Kubernetes Operator (AKO) monitors this file to trigger a restore.

The [AerospikeRestore Custom Resource Definition (CRD)](https://github.com/aerospike/aerospike-kubernetes-operator/blob/v4.1.2/config/crd/bases/asdb.aerospike.com_aerospikebackups.yaml) specifies the CR structure that AKO uses to configure and perform a restore.

## CR examples

CR examples are available in [the main Aerospike Kubernetes Operator repository](https://github.com/aerospike/aerospike-kubernetes-operator/tree/v4.1.2/config/samples).

### Example 1: Full restore CR with local storage

This example triggers a full restore in an Aerospike cluster.

Example 1

```yaml
apiVersion: asdb.aerospike.com/v1beta1

kind: AerospikeRestore

metadata:

  name: aerospikerestore

  namespace: aerospike

spec:

  backupService:

    name: aerospikebackupservice

    namespace: aerospike

  type: Full

  config:

    destination:

      label: destinationCluster

      credentials:

        password: admin123

        user: admin

      seed-nodes:

        - host-name: aerocluster.test.svc.cluster.local

          port: 3000

    policy:

      parallel: 3

      no-generation: true

      no-indexes: true

    source:

      local-storage:

        path: /tmp/localStorage

    backup-data-path: "/path/to/full-backup/data/"
```

### Example 2: Incremental restore CR with local storage

This example triggers an Incremental restore in an Aerospike cluster.

Example 2

```yaml
apiVersion: asdb.aerospike.com/v1beta1

kind: AerospikeRestore

metadata:

  name: aerospikerestore

  namespace: aerospike

spec:

  backupService:

    name: aerospikebackupservice

    namespace: aerospike

  type: Incremental

  config:

    destination:

      label: destinationCluster

      credentials:

        password: admin123

        user: admin

      seed-nodes:

        - host-name: aerocluster.test.svc.cluster.local

          port: 3000

    policy:

      parallel: 3

      no-generation: true

      no-indexes: true

    source:

      local-storage:

        path: /tmp/localStorage

    backup-data-path: "/path/to/incremental-backup/data/"
```

### Example 3: Timestamp restore CR

This example triggers a restore in an Aerospike cluster based on Timestamp.

Example 3

```yaml
apiVersion: asdb.aerospike.com/v1beta1

kind: AerospikeRestore

metadata:

  name: aerospikerestore

  namespace: aerospike

spec:

  backupService:

    name: aerospikebackupservice

    namespace: aerospike

  type: Timestamp

  config:

    destination:

      label: destinationCluster

      credentials:

        password: admin123

        user: admin

      seed-nodes:

        - host-name: aerocluster.test.svc.cluster.local

          port: 3000

    policy:

      parallel: 3

      no-generation: true

      no-indexes: true

    routine: aerospike-aerospikebackup-test-routine

    time: 1739538000000
```

### Example 4: Full restore CR with S3 storage

This example triggers a full restore in an Aerospike cluster.

Example 4

```yaml
apiVersion: asdb.aerospike.com/v1beta1

kind: AerospikeRestore

metadata:

  name: aerospikerestore

  namespace: aerospike

spec:

  backupService:

    name: aerospikebackupservice

    namespace: aerospike

  type: Full

  config:

    destination:

      label: destinationCluster

      credentials:

        password: admin123

        user: admin

      seed-nodes:

        - host-name: aerocluster.test.svc.cluster.local

          port: 3000

    policy:

      parallel: 3

      no-generation: true

      no-indexes: true

    source:

      s3-storage:

        bucket: test-bucket

        s3-region: us-east-1

        s3-profile: default

    backup-data-path: "/path/to/full-backup/data/"
```

## Configuration

The initial part of the CR file selects the CRD and the namespace to use for the AR.

```yaml
apiVersion: asdb.aerospike.com/v1beta1

kind: AerospikeRestore

metadata:

  name: aerospikerestore

  namespace: aerospike
```

The rest of this page explains the parameters in the subsequent parts of the CR file.

## Spec

The spec section defines the restore’s configurations.

| Field | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| [backupService](#backup-service) | Yes | Structure |  | Aerospike backup service reference. |
| type | Yes | String |  | Type of restore. Supported types are Full, Incremental, Timestamp |
| [config](#config) | Yes | Structure |  | Aerospike restore configuration in freeform YAML format. |
| pollingPeriod | No | Sting | 60s | Polling period to check restore operation status. |

## Backup service

[`spec`](#spec) -> `backupService`

Configure the Aerospike backup service to be used for triggering restores.

| Field | Required | Type | Description |
| --- | --- | --- | --- |
| name | Yes | String | Name of the backup service. |
| namespace | Yes | String | Namespace of the backup service. |

## Config

[`spec`](#spec) -> `config`

The YAML form of AR configuration.

The following fields can be defined in the AR configuration based on the restore type:

1.  `destination`
2.  `policy`
3.  `source`
4.  `secret-agent`
5.  `backup-data-path`
6.  `routine`
7.  `time`

Example:

```yaml
config:

  destination:

    label: destinationCluster

    credentials:

      password: admin123

      user: admin

    seed-nodes:

      - host-name: aerocluster.test.svc.cluster.local

        port: 3000

  policy:

    parallel: 3

    no-generation: true

    no-indexes: true

  routine: aerospike-aerospikebackup-test-routine

  time: 1739538000000
```