7 Uninstalling Policy

This chapter provides information about uninstalling Oracle Communications Cloud Native Core, Converged Policy (Policy).

7.1 Uninstalling Policy using Helm

This chapter describes how to uninstall Policy using Helm.

To uninstall Policy, run the following command:

helm uninstall <helm-release> --namespace <release-namespace> 

Where,

<helm-release> is a name provided by the user to identify the helm deployment.

<release-namespace> is a name provided by the user to identify the namespace of Policy deployment.

For example:

helm uninstall occnp --namespace occnp

Helm keeps a record of its releases, so you can still reactivate the release after uninstalling it.

To completely remove a release from the cluster, add the --purge parameter to helm delete command:

helm delete --purge release_name

For example:

helm delete ---purge occnp

Note:

  • When you uninstall both Policy and cnDBtier network functions, it is recommended to delete PVC (PersistentVolumeClaims) volumes of cnDBTier that were created at the time of installing cnDBtier. For more information on how to delete PVC volumes, see Deleting PVC Volumes.
  • If you are uninstalling only Policy network function, do not delete PVC volumes.

7.2 Deleting Kubernetes Namespace

This section describes how to delete Kubernetes namespace where Policy is deployed.

To delete kubernetes namespace, run the following command:
kubectl delete namespace <release_namespace>
where, <release_namespace> is the deployment namespace used by the helm command.
For example:
kubectl delete namespace occnp

7.3 Removing Database Users

This section describes how to remove MySQL users.

To remove MySQL users while uninstalling Policy, run the following commands:

Remove Privileged User:

$ DROP USER IF EXISTS <Policy Privileged-User Name>;

For example:

 $ DROP USER IF EXISTS ''occnpadminusr'@'%';

Remove Application User:

$ DROP USER IF EXISTS <Policy Application User Name>;

For example:

$ DROP USER IF EXISTS 'occnpusr'@'%';

Caution:

Removal of users must be done on all the SQL nodes for all Policy sites.

7.4 Deleting PVC Volumes

This section describes how to delete a PVC volume.

Following is the procedure for to delete a PVC volume:

  1. Get a list of the PVC volumes for the required cnDBTier namespace by running the following command:
    kubectl get pvc -n <namespace>

    where, <namespace> is the namespace of Policy deployment.

    For example:

    kubectl get pvc -n occnp

    Sample Output

    NAME                              STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    pvc-backup-ndbmtd-ndbmtd-0        Bound    pvc-56420da4-f70c-46fd-8f0a-c33ff50ddd98   3Gi        RWO            standard       26d
    pvc-backup-ndbmtd-ndbmtd-1        Bound    pvc-d7e3ef21-4161-40cc-abc9-756dfd3c0674   3Gi        RWO            standard       26d
    pvc-ndbappmysqld-ndbappmysqld-0   Bound    pvc-d76f0cbd-c0e5-48f1-9a83-1353dbee6c41   2Gi        RWO            standard       26d
    pvc-ndbappmysqld-ndbappmysqld-1   Bound    pvc-c31749df-ae98-48c1-a8a7-449535d0f60a   2Gi        RWO            standard       26d
    pvc-ndbmgmd-ndbmgmd-0             Bound    pvc-765a9a4b-726d-43fe-af91-a3a6c85ab321   1Gi        RWO            standard       26d
    pvc-ndbmgmd-ndbmgmd-1             Bound    pvc-71b5877e-a753-4fac-b995-5fdf2d465af8   1Gi        RWO            standard       26d
    pvc-ndbmtd-ndbmtd-0               Bound    pvc-e0c5f263-d5d3-4f18-bb11-44ceaa6a2305   3Gi        RWO            standard       26d
    pvc-ndbmtd-ndbmtd-1               Bound    pvc-d03f799d-abe2-4b71-96c4-c98cacdbeaba   3Gi        RWO            standard       26d
    pvc-ndbmysqld-ndbmysqld-0         Bound    pvc-d80321a9-5239-4e34-9bcf-11053c9de5ef   2Gi        RWO            standard       26d
    pvc-ndbmysqld-ndbmysqld-1         Bound    pvc-545e0f35-ad20-4c24-927a-6f1e49b06cc9   2Gi        RWO            standard       26d
    
  2. Delete all the PVC volumes in the cnDBTier namespace by running the following command:
    kubectl -n <namespace> delete pvc <pvc_name>
    Example:
    kubectl -n p1 delete pvc pvc-backup-ndbmtd-ndbmtd-0       
    kubectl -n p1 delete pvc pvc-backup-ndbmtd-ndbmtd-1       
    kubectl -n p1 delete pvc pvc-ndbappmysqld-ndbappmysqld-0  
    kubectl -n p1 delete pvc pvc-ndbappmysqld-ndbappmysqld-1  
    kubectl -n p1 delete pvc pvc-ndbmgmd-ndbmgmd-0            
    kubectl -n p1 delete pvc pvc-ndbmgmd-ndbmgmd-1            
    kubectl -n p1 delete pvc pvc-ndbmtd-ndbmtd-0              
    kubectl -n p1 delete pvc pvc-ndbmtd-ndbmtd-1              
    kubectl -n p1 delete pvc pvc-ndbmysqld-ndbmysqld-0        
    kubectl -n p1 delete pvc pvc-ndbmysqld-ndbmysqld-1

7.5 Uninstalling Site in Georedundant Deployment

This chapter describes how to uninstall a site (except the last site) when Policy is deployed in georedundant setup.

Deleting entries of unique databases

For georedundant deployment, run the following command to delete entries of unique databases from the occnp_release database:

delete from ReleaseConfig where SiteId='7c4f7f05-ffdd-408f-ba78-b2c4dc83b1fd' AND CfgKey='public.hook.auditservice';
delete from ReleaseConfig where SiteId='7c4f7f05-ffdd-408f-ba78-b2c4dc83b1fd' AND CfgKey='public.hook.cmservice';
delete from ReleaseConfig where SiteId='7c4f7f05-ffdd-408f-ba78-b2c4dc83b1fd' AND CfgKey='public.hook.configserver';
Cleaning up NDB Replication Table
In addition, clean up the entries in "mysql.ndb_replication" table by running the following commands
  1. Select cast(db as char), cast(table_name as char), cast(conflict_fn as char) from mysql.ndb_replication:
    mysql> select cast(db as char), cast(table_name as char), cast(conflict_fn as char) from mysql.ndb_replication;

    Sample Output

    +------------------+--------------------------+----------------------------------------+
    | cast(db as char) | cast(table_name as char) | cast(conflict_fn as char)              |
    +------------------+--------------------------+----------------------------------------+
    | occnp_binding    | dependentcontextbinding  | NDB$MAX_DELETE_WIN(lastModifiedTime)   |
    | occnp_pcrf_core  | rxsession                | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_pcf_am     | AmPolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_pcf_sm     | AppSession               | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_pcrf_core  | sessioncorrelationreg    | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_pcrf_core  | gxsession                | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_binding    | contextbinding           | NDB$MAX_DELETE_WIN(lastModifiedTime)   |
    | occnp_policyds   | pdsprofile               | NDB$MAX_DELETE_WIN(last_modified_time) |
    | occnp_pcf_ue     | UePolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_policyds   | pdssubscriber            | NDB$MAX_DELETE_WIN(last_modified_time) |
    | occnp_pcf_sm     | SmPolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    +------------------+--------------------------+----------------------------------------+
    11 rows in set (0.01 sec)

    If the output for this command shows Policy databases as shown in the sample output, then perform Step 2.

  2. Delete from mysql.ndb_replication:
    delete from mysql.ndb_replication where cast(db as char)="<database_name>";

    Example

    delete from mysql.ndb_replication where cast(db as char)="occnp_pcf_am";

7.6 Uninstalling Last Site in Georedundant Deployment

This chapter describes how to uninstall the last site when Policy is deployed in georedundant setup. The same steps can be performed to uninstall Policy in standalone deployment.

7.6.1 Cleaning up NDB Replication Table

This chapter describes how to cleanup NDB replication table while uninstalling CNC Policy.

To clean up the entries in "mysql.ndb_replication" table, run the following commands:
  1. Select cast(db as char), cast(table_name as char), cast(conflict_fn as char) from mysql.ndb_replication:
    mysql> select cast(db as char), cast(table_name as char), cast(conflict_fn as char) from mysql.ndb_replication;

    Sample Output

    +------------------+--------------------------+----------------------------------------+
    | cast(db as char) | cast(table_name as char) | cast(conflict_fn as char)              |
    +------------------+--------------------------+----------------------------------------+
    | occnp_binding    | dependentcontextbinding  | NDB$MAX_DELETE_WIN(lastModifiedTime)   |
    | occnp_pcrf_core  | rxsession                | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_pcf_am     | AmPolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_pcf_sm     | AppSession               | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_pcrf_core  | sessioncorrelationreg    | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_pcrf_core  | gxsession                | NDB$MAX_DELETE_WIN(updated_timestamp)  |
    | occnp_binding    | contextbinding           | NDB$MAX_DELETE_WIN(lastModifiedTime)   |
    | occnp_policyds   | pdsprofile               | NDB$MAX_DELETE_WIN(last_modified_time) |
    | occnp_pcf_ue     | UePolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    | occnp_policyds   | pdssubscriber            | NDB$MAX_DELETE_WIN(last_modified_time) |
    | occnp_pcf_sm     | SmPolicyAssociation      | NDB$MAX_DELETE_WIN(UPDATED_TIMESTAMP)  |
    +------------------+--------------------------+----------------------------------------+
    11 rows in set (0.01 sec)

    If the output for this command shows CNC Policy databases as shown in the sample output, then perform Step 2.

  2. Delete from mysql.ndb_replication:
    delete from mysql.ndb_replication where cast(db as char)="<database_name>";

    Example

    delete from mysql.ndb_replication where cast(db as char)="occnp_pcf_am";

7.6.2 Cleaning up Databases

This chapter describes how to clean up databases when uninstalling CNC Policy.

Note:

For georedundant deployment, run the commands provided in this section only if the site being uninstalled is the last site in the complete georedundant group.
To clean up database for the different microservices, run the following command:
DROP DATABASE IF EXISTS occnp_audit_service;
DROP DATABASE IF EXISTS occnp_config_server;
DROP DATABASE IF EXISTS occnp_pcf_am;
DROP DATABASE IF EXISTS occnp_pcf_sm;
DROP DATABASE IF EXISTS occnp_commonconfig;
DROP DATABASE IF EXISTS occnp_pcrf_core;
DROP DATABASE IF EXISTS occnp_release;
DROP DATABASE IF EXISTS occnp_binding;
DROP DATABASE IF EXISTS occnp_policyds;
DROP DATABASE IF EXISTS occnp_pcf_ue;
DROP DATABASE IF EXISTS occnp_cmservice;
DROP DATABASE IF EXISTS occnp_nrf_client;
DROP DATABASE IF EXISTS occnp_leaderPodDb;
DROP DATABASE IF EXISTS occnp_overload;
DROP DATABASE IF EXISTS occnp_pcf_nwdaf_agent;