# Add a new dynamic backup target on RHOSO

Please follow the below steps to add new backup target on RHOSO18.

## 1] Mount Backup target on Trilio Control Plane

Navigate to trilio ctlplane-scripts directory

```
cd /PATH/TO/triliovault-cfg-scripts/redhat-director-scripts/rhosp18/ctlplane-scripts
```

Plan which type of backup target you want to add. T4O supports two types of backup targets.

1. nfs
2. s3

If you want to add backup target of type 'nfs' then edit the following yaml file and create TVOBackupTarget resource.

```
vi tvo-backup-target-cr-nfs.yaml
oc -n trilio-openstack apply -f tvo-backup-target-cr-nfs.yaml
```

## To add a backup target of type 'S3', follow the steps below:

Copy the template YAML file\
Navigate to the scripts directory and copy the existing `trilio-s3-backup-target-secret.yaml` file to a new one named according to your backup target:

```
cd /PATH/TO/triliovault-cfg-scripts/redhat-director-scripts/rhosp18/ctlplane-scripts
cp trilio-s3-backup-target-secret.yaml trilio-s3-backup-target-secret-<BACKUP_TARGET_NAME>.yaml
Example:-
cp trilio-s3-backup-target-secret.yaml trilio-s3-backup-target-secret-s3-bt8.yaml
```

## Base64 encode the S3 access and secret keys.

You will need to provide base64-encoded values for both the S3 access key and secret key. Use the following command to encode them:

```
echo -n "s3_key_string" | base64
```

Replace "s3\_key\_string" with your actual S3 access key or secret key. The output is the base64-encoded string to be used in the new s3 yaml file.

## Edit the copied S3 YAML file

Open the newly created file with your preferred editor (e.g., vi):

```
vi trilio-s3-backup-target-secret-<BACKUP_TARGET_NAME>.yaml
```

Update the following fields with the backup target name and the corresponding base64-encoded values:

```
<BACKUP_TARGET_NAME>_s3_access_key: <base64_encoded_access_key>
<BACKUP_TARGET_NAME>_s3_secret_key: <base64_encoded_secret_key>
Example:-
s3_bt8_s3_access_key: ABDCD1234.......
s3_bt8_s3_secret_key: ABCD1234........
```

## Apply the updated secret to the cluster

After saving the file, apply it to the `trilio-openstack` namespace:

```
oc -n trilio-openstack apply -f trilio-s3-backup-target-secret-<BACKUP_TARGET_NAME>.yaml
Example:-
oc -n trilio-openstack apply -f trilio-s3-backup-target-secret-s3-bt8.yaml
```

If your S3 bucket is an Amazon S3 bucket.

```
vi tvo-backup-target-cr-amazon-s3.yaml
oc -n trilio-openstack apply -f tvo-backup-target-cr-amazon-s3.yaml
```

If your S3 is of any other type edit following file and create TVOBackupTarget resource

```
vi tvo-backup-target-cr-other-s3.yaml
oc -n trilio-openstack apply -f tvo-backup-target-cr-other-s3.yaml
```

## Verify that the dynamic backup target added was successfully deployed for the T4O control plane services

```
oc get pods -n trilio-openstack
[root@localhost ctlplane-scripts]# oc get pods -n trilio-openstack
NAME                                                READY   STATUS             RESTARTS           AGE
job-triliovault-datamover-api-db-init-5fcvs         0/1     Completed          0                  44h
job-triliovault-datamover-api-keystone-init-hf89t   0/1     Completed          0                  44h
job-triliovault-datamover-api-rabbitmq-init-zd9lf   0/1     Completed          0                  44h
job-triliovault-wlm-cloud-trust-mzj8b               0/1     Completed          0                  44h
job-triliovault-wlm-db-init-nzqxd                   0/1     Completed          0                  44h
job-triliovault-wlm-keystone-init-s82ph             0/1     Completed          0                  44h
job-triliovault-wlm-rabbitmq-init-xvhcf             0/1     Completed          0                  44h
triliovault-datamover-api-789c55cb7c-4xkln          1/1     Running            0                  44h
triliovault-datamover-api-789c55cb7c-799lr          1/1     Running            0                  44h
triliovault-datamover-api-789c55cb7c-nv8wl          1/1     Running            0                  44h
triliovault-object-store-bt1-s3-45sz5               1/1     Running            0                  44h
triliovault-object-store-bt1-s3-fhmgz               1/1     Running            0                  44h
triliovault-object-store-bt1-s3-xn78b               1/1     Running            0                  44h
triliovault-object-store-s3-bt8-flhws               1/1     Running            0                  55s
triliovault-object-store-s3-bt8-l2tbl               1/1     Running            0                  55s
triliovault-object-store-s3-bt8-x758v               1/1     Running            0                  55s
triliovault-wlm-api-5f9fccf467-djmn6                1/1     Running            0                  44h
triliovault-wlm-api-5f9fccf467-mvxt4                1/1     Running            0                  44h
triliovault-wlm-api-5f9fccf467-tmjr8                1/1     Running            0                  44h
triliovault-wlm-cron-58b75c464-75wnh                1/1     Running            0                  44h
triliovault-wlm-scheduler-74c9f6f86-5pt66           1/1     Running            0                  44h
triliovault-wlm-scheduler-74c9f6f86-klpw2           1/1     Running            0                  44h
triliovault-wlm-scheduler-74c9f6f86-p5frf           1/1     Running            0                  44h
triliovault-wlm-workloads-cb5f48549-4nzr2           1/1     Running            0                  44h
triliovault-wlm-workloads-cb5f48549-qp2b9           1/1     Running            0                  44h
triliovault-wlm-workloads-cb5f48549-xgl6j           1/1     Running            0                  44h
[root@localhost ctlplane-scripts]#
oc get daemonsets -n trilio-openstack
```

## 2] Mount Backup target on Trilio Data Plane

Navigate to data plane scripts directory

```
cd /PATH/TO/triliovault-cfg-scripts/redhat-director-scripts/rhosp18/dataplane-scripts/
```

Create templates needed for adding backup targets. Please note that use unique backup target name for parameter \<BACKUP\_TARGET\_NAME>. You should not have used this backup target name earlier for any other trilio backup target. For parameter \<BACKUP\_TARGET\_TYPE>, valid choices are ‘s3' and 'nfs’

```
./create-templates.sh <BACKUP_TARGET_NAME> <BACKUP_TARGET_TYPE>
./create-templates.sh s3-bt8 s3
```

A new directory gets created with backup target name having necessary templates. You can list these templates.

```
cd <BACKUP_TARGET_NAME>/
ls -ll
```

Backup target name gets set in all the yaml files created in this directory. BACKUP\_TARGET\_NAME gets converted to all small case and if any underscore ‘\_' character is there in it, it gets replaced by hyphen character '-'. Add backup target details to template

Change to \<BACKUP\_TARGET\_NAME> if not done already

```
cd <BACKUP_TARGET_NAME>/
```

Edit config map file

```
vi cm-trilio-backup-target.yaml
```

Create config map

```
oc -n openstack apply -f cm-trilio-backup-target.yaml
```

If you are adding 's3' type backup target, then only you need to create following secret. We have already filled in all details in yaml file. We just need to apply it.

```
oc -n openstack apply -f ../../ctlplane-scripts/trilio-s3-backup-target-secret-<BACKUP_TARGET_NAME>.yaml
Example:-
oc -n openstack apply -f ../../ctlplane-scripts/trilio-s3-backup-target-secret-s3-bt8.yaml
```

Set Trilio Ansible Runner container image url and tag in parameter 'openStackAnsibleEERunnerImage:' of trilio-add-backup-target-service.yaml You don’t need to change any other parameter.

```
vi trilio-add-backup-target-service.yaml
```

Create custom data plane service for this backup target

```
oc -n openstack apply -f trilio-add-backup-target-service.yaml
sleep 5s
```

Edit trilio-add-backup-target-deployment.yaml file and set parameter ‘nodeSets' with correct value from your environment. You don’t need to change any other parameter.

Get OpenStackDataPlaneNodeSet name

```
oc -n openstack get OpenStackDataPlaneNodeSet
```

Set 'nodeSets' parameter

```
vi trilio-add-backup-target-deployment.yaml
```

Trigger deployment of this backup target

```
oc -n openstack apply -f trilio-add-backup-target-deployment.yaml
```

Check logs Edit \<DEPLOYMENT\_NAME>, take it from above deployment yaml.

```
# Get deployment pod name
oc -n openstack get pods -l openstackdataplanedeployment=<DEPLOYMENT_NAME>
# Example:
oc -n openstack get pods -l openstackdataplanedeployment=edpm-trilio-add-backup-target-s3-bt8
## Check logs
oc -n openstack logs <POD_NAME>
# Example:
oc -n openstack logs trilio-add-backup-target-s3-bt8-edpm-trilio-add-backup-tarkx5xx
```

If this pod does not get created, it means you have not used unique backup target name or some other issue happend. Please verify that

## Verify that the dynamic backup target added was successfully deployed for the T4O dataplane services

```
oc -n openstack get openstackdataplanedeployment | grep trilio
Example:-
[openstackdev@localhost ~]$ oc -n openstack get openstackdataplanedeployment | grep trilio
edpm-trilio-add-backup-target-s3-bt8         ["openstack-data-plane"]   True     Setup complete
edpm-trilio-add-backup-target-s3-bt5         ["openstack-data-plane"]   True     Setup complete
edpm-trilio-add-backup-target-s3-bt6         ["openstack-data-plane"]   True     Setup complete
edpm-trilio-data-plane-deployment-1          ["openstack-data-plane"]   True     Setup complete
```

## 3] Add Backup Target Records

Login to triliovault-wlm-api pod and run below CLI command to create backup target in Trilio DB.

```
oc get pods -n trilio-openstack | grep wlm-api
oc exec -n trilio-openstack -it <trilio wlm api pod name> bash
source <admin rc file>
```

For NFS Backup Target:

```
workloadmgr backup-target-create --type nfs --filesystem-export <filesystem_export> --btt-name <btt name>
```

Sample command:

```
workloadmgr backup-target-create --type nfs --filesystem-export 192.168.0.53:/home/rhosp2 --btt-name bt3-nfs
```

For Object lock enabled S3 Backup Target:

```
workloadmgr backup-target-create --type s3 --s3-endpoint-url <s3_endpoint_url> --s3-bucket <s3_bucket> --btt-name <btt name> --immutable --metadata object_lock=1 bucket=s3-object-lock
```

Sample command:

```
workloadmgr backup-target-create --type s3 --s3-endpoint-url https://s3.wasabisys.com --s3-bucket object-locked-s3-2 --btt-name s3-bt8 --immutable --metadata object_lock=1 bucket=s3-object-lock
```

For non-object lock S3 Backup Target:

```
workloadmgr backup-target-create --type s3 --s3-endpoint-url <s3_endpoint_url> --s3-bucket <s3_bucket> --btt-name <btt name>
```

Sample command:

```
workloadmgr backup-target-create --type s3 --s3-endpoint-url https://s3.wasabisys.com --s3-bucket qa-sachin --btt-name s3-bt8
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilio.io/openstack/admin-guide/backup-targets/add_dynamic_backup_target_rhoso18.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
