TCA provides REST API to backup and restore a TKG workload cluster and remedy CNFs in addition to TCA web interface. It’s supported to use the API to integrate required external components and TCA as a backup and restore solution.
For example, when integrating with another backup/restore product, a solution is to backup or restore the TKG workload clusters directly with backup/restore product and then call TCA API to handle rest procedures such as creating new workload clusters and remedying CNFs in the restored clusters.
The workaround below will demonstrate the solution about how to integrate an external backup/restore product or component with TCA API.
Workaround:
Note: Replace the following variables with the appropriate referring value:
Variable |
Referring Value |
tca_m_ip |
TCA Manager IP |
sso_vc_pwd |
SSO vCenter Password |
mc_name |
Master Cluster Name |
tcacp_id |
TCA CP IP |
cluster_name |
Cluster Name |
cnf_instance_id |
CNF Instance ID |
vim_tenant_id |
VIM Tenant ID |
Obtain TCA IDs using API:
tcacp_id: (will return tcacp_id for each cluster)
curl -X GET https://tca_m_ip/telco/api/caas/v2/clusters -H "accept: application/json"
cnf_id (will return all CNF IDst):
curl -X GET https://tca_m_ip/telco/api/vnflcm/v2/extension/vnf_instances -H "accept: application/json"
vim_tenant_id: (will return all VIM tenant IDs)
curl -X GET https://tca_m_ip/hybridity/api/vims/v1/tenants -H "accept: application/json"
Procedure
- Obtain the TCA API authorization token y running the following command:
curl -X POST "https://tca_m_ip/hybridity/api/sessions" -H "accept: application/json" -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"username\": \"[email protected]\", \"password\": \"sso_vc_pwd\"}" -k -D - | grep x-hm-authorization: | awk '{print $2}' | sed 's/\r$//'Note: All API details are described at https://tca_m_ip/hybridity/docs/index.html.
- Backup the target cluster with the external backup/restore product or component.
- Create a new workload cluster with Copy Specification and Deploy new Cluster through the TCA UI or API:
- GET information of the old target clusters
https://tca_m_ip/telco/api/caas/v2/clusters
- POST to create new cluster
https://tca_m_ip/telco/api/caas/v2/clusters?mgmtClusterName=mc_name&tcaCpId=tcacp_id
- POST to create all Addons in new cluster
https://tca_m_ip/telco/api/caas/v2/clusters/cluster_name/addons?mgmtClusterName=mc_name&tcaCpId=tcacp_id
- POST to create all node pools in new cluster
https://tca_m_ip/telco/api/caas/v2/clusters/cluster_name/nodepools?mgmtClusterName=mc_name&tcaCpId=tcacp_id
- Restore to new workload cluster with the external backup/restore product or component.
- Remedy CNF instances to new cluster:
- GET all CNF instances which belong to the old cluster and need to be remedied to new cluster
https://tca_m_ip/telco/api/vnflcm/v2/extension/vnf_instances
- POST to remedy a CNF instance to new cluster
https://tca_m_ip/telco/api/vnflcm/v2/vnf_instances
Set new cluster as the target VIM and set below two attributes in payload:
"disableGrant": True,
"disableHelmInstall": True,
- Cleanup stale CNF instances and the old cluster:
- POST to terminate stale CNF instances
https://tca_m_ip/telco/api/vnflcm/v2/vnf_instances/cnf_instance_id/terminate
- DELETE stale CNF instances
https://tca_m_ip/telco/api/vnflcm/v2/vnf_instances/cnf_instance_id?isForce=true
- DELETE stale WC from Virtual Infrastructure
https://tca_m_ip/hybridity/api/vims/v1/tenants/vim_tenant_id
- DELETE stale WC from Caas Infrastructure
https://tca_m_ip/telco/api/caas/v2/clusters/%s?mgmtClusterName=mc_name&tcaCpId=tcacp_id