5 Uninstalling OCNRF

This section explains uninstallation procedure of OCNRF and its details in MySQL.

Deleting the OCNRF deployment

This procedure explains how to delete the OCNRF deployment:

Execute the following command to completely delete or remove the OCNRF deployment:
  1. For helm2:
    $ helm del --purge <helm-release>
    Example:
    $ helm del --purge ocnrf
  2. For helm3:
    helm3 uninstall <helm-release> -n <namespace>

    Example:

    helm3 uninstall ocnrf -n ocnrf

Note:

In case helm purge do not clean the deployment and kubernetes objects completely then follow Cleaning OCNRF deployment section.

To check if helm purge has not deleted all of the kubernetes objects, execute the following command:

$ kubectl get all -n <release-namespace>

This will give a detailed overview of the current objects of <release-namespace> which were not cleaned during helm purge.

Caution:

rbac and service account details may have been created by user itself prior to helm install in same namespace and not using helm install. In case same service account and rbac resource are needed, then don't delete them.

Cleaning OCNRF deployment

This procedure explains how to cleanup the OCNRF deployment.

  1. Remove failed helm release:
    Run command to get all of the helm release.
    $ helm ls --all
    If OCNRF helm release is in a failed state, please purge the namespace using the command:
    1. For helm 2:
      $ helm delete --purge <release-namespace>
    2. For helm 3:
      helm3 uninstall <release-name> -n <release-namespace>

    Note:

    If this is taking more time as it will run the delete hook jobs. In this case, run below script parallel in another session to clear all the delete jobs.
    Cleanup hook-jobs
    $ while true; do kubectl delete jobs --all -n <release-namespace>; sleep 5;done

    Monitor the "helm delete --purge <release-namespace>" command. Once that is succeeded, press "ctrl+c" to stop the above command execution.

  2. Cleanup all of the kubernetes objects.
    $ kubectl get all -n <release-namespace>
    This will give a detailed overview of the current objects of <release-namespace>. Delete all those objects.
    

    Caution:

    Be sure before executing the following commands as it deletes all objects of kubernetes in the specified namespace. In case user has created rbac and service account details prior to helm install in same namespace and is required, then do not delete them. In case, custom service account was not provided by the user and safe to remove it, then execute below commands to delete the resources or objects which are not required:
    Deleting all the kubernetes objects: "kubectl delete all --all -n <release-namespace>"
    Deleting all the current configmaps: "kubectl delete cm --all -n <release-namespace>"
  3. Cleanup of pending resources in namespace:
    Sometimes it is seen that some resources are not deleted while purging the deployment. This step explains how to check the pending resources and clean them.
    $ kubectl get all -n <release-namespace>
    This will give a detailed overview of the current objects of <release-namespace>.

    Delete pending resources in the namespace:

    $ kubectl delete <resource-type> <resource-name> -n <release-namespace>
  4. Execute the following command to delete kubernetes namespace:

    Caution:

    Be sure before removing the namespace. It will delete all resources or objects created in the namespace.
    $ kubectl delete namespace <ocnrf kubernetes namespace>
    Example:
    $ kubectl delete namespace ocnrf

Deleting the OCNRF MySQL details

Procedure for Geo-Redundant OCNRF sites

This procedure explains how to delete the OCNRF MySQL database after deletion of OCNRF deployment.

Note:

Procedure can be different for Geo-Redundant OCNRF sites and standalone OCNRF site.
  1. Login to the machine which has permission to access the SQL nodes of NDB cluster.
  2. Connect to the SQL node of NDB cluster successively. MySQL commands must be run on all the SQL nodes.
  3. Login to the MySQL prompt using root permission or user, which has permission to delete the table records. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for mysql binary, root user and root password. After executing this command, user need to enter the password specific to the user mentioned in the command.
  4. Execute the following command to delete data specific to purged site:
    $ DELETE FROM NfScreening WHERE nrfInstanceId = '<OCNRF’s NF Instance ID of Site under deletion>';
    $ DELETE FROM NrfSystemOptions WHERE nrfInstanceId = '<OCNRF’s NF Instance ID of Site under deletion>';
    $ DELETE FROM NfInstances WHERE nrfInstanceId = '<OCNRF’s NF Instance ID of Site under deletion>';
    $ DELETE FROM NfStatusMonitor WHERE nrfInstanceId = '<OCNRF’s NF Instance ID of Site under deletion>';
    $ DELETE FROM NfSubscriptions WHERE nrfInstanceId = '<OCNRF’s NF Instance ID of Site under deletion>';
    $ DELETE FROM NrfEventTransactions WHERE currentOwner = '<OCNRF’s NF Instance ID of Site under deletion>';

    Caution:

    Since these tables are shared by each geo-redundant site, tables shall not be deleted.
  5. Exit from MySQL prompt and SQL nodes:

    Note:

    Execute the commands on any one SQL node on one geo-redundant site. Other Geo-redundant sites will get the data records removed automatically.

Procedure for standalone OCNRF site

  1. Login to the machine which has permission to access the SQL nodes of NDB cluster
  2. Connect to the SQL node of NDB cluster successively. MySQL commands must be run on all the SQL nodes.
  3. Login to the MySQL prompt using root permission or user, which has permission to drop the tables. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for mysql binary, root user and root password. After executing this command, user need to enter the password specific to the user mentioned in the command.
  4. Execute the following commands to drop the tables:
    $ DROP TABLE IF EXISTS 'NfInstances';
    $ DROP TABLE IF EXISTS 'NfStatusMonitor';
    $ DROP TABLE IF EXISTS 'NfSubscriptions';
    $ DROP TABLE IF EXISTS 'NfScreening';
    $ DROP TABLE IF EXISTS 'NrfSystemOptions';
    $ DROP TABLE IF EXISTS 'NrfEventTransactions';
  5. Exit from MySQL prompt and SQL node

    Note:

    Execute the commands on any SQL node of standalone site.

Procedure for complete removal of MySql database and username

This procedure explains the steps to complete removal of MySql database and username in below cases:

  1. OCNRF is not going to be install on that cluster.
  2. Change the MySql database name or MySql user name.

Procedure

  1. Login to the machine which has permission to access the SQL nodes of NDB cluster.
  2. Connect to the SQL node of NDB cluster successively. MySQL commands must be run on all the SQL nodes.
  3. Login to the MySQL prompt using root permission or user, which has permission to drop the tables. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for mysql binary, root user and root password. After executing this command, user need to enter the password specific to the user mentioned in the command.
  4. Execute the following command to remove OCNRF database:

    Caution:

    Removal of database from any one of the SQL node from any one of the cluster will remove the database from all Geo-redundant site.

    Remove OCNRF application database

    $ DROP DATABASE if exists <OCNRF application database>;
     

    Example

    $ DROP DATABASE if exists nrfApplicationDB;
    
    Remove OCNRF network scoped database:
    $ DROP DATABASE if exists <OCNRF network scoped database>;

    Example

    $ DROP DATABASE if exists nrfNetworkDB;
  5. Execute the following command to remove the OCNRF MySql Users:

    Remove OCNRF privileged user:

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

    Example

     $ DROP USER IF EXISTS nrfPrivilegedUsr;
    Remove OCNRF application user:
    $ DROP USER IF EXISTS <OCNRF Application User Name>;
    Example
    $ DROP USER IF EXISTS nrfApplicationUsr;

    Caution:

    Removal of Mysql Users must be done on all the SQL nodes from all the OCNRF sites.
  6. Exit from MySQL prompt and SQL node.