6 Rolling Back CNC Console

This section provides information about rolling back Cloud Native Configuration Console deployment to the previous release.

  • M-CNCC IAM
  • M-CNCC Core
  • A-CNCC Core

The following steps must be followed while performing the rollback:

  1. CNCC IAM DB Rollback/Restore
  2. A-CNCC Core DB Rollback or Restore
  3. CNCC Rollback

Caution:

It is recommended to verify the copy pasted content especially when the hyphens or any special characters are part of copied content.

User can rollback CNC Console from a source release to a target release using CDCS or CLI procedures as outlined in the following table:

Rollback Task References Applicable for CDCS Applicable for CLI
CNCC IAM DB Rollback/Restore CNCC IAM DB Rollback or Restore Yes Yes
A- CNCC CORE DB Rollback or Restore A-CNCC Core DB Rollback or Restore Yes Yes
CNCC Rollback CNCC Rollback See Oracle Communications CD Control Server Installation and Upgrade Guide Yes

6.1 Supported Rollback Paths

This section describes the supported upgrade paths for CNC Console

Table 6-1 CNC Console Rollback Sequence

Deployment Mode Source Version Target Version Rollback Sequence Comments
Single Cluster 23.4.x 23.3.x or 23.2.x
  • cnDbtier Rollback
  • NF Rollback

    Rollback Instances (NF or CNE/OSO Common Services)

  • Console Rollback

    Rollback CNC Console

  • CNC Console 23.2.0 onwards A-CNCC DB dependency has been taken out. Only CNC Console IAM and M-CNCC Core has DB dependency. Refer pre rollback tasks section for additional steps before perming rollback.
  • Helm rollback CNC Console using existing release name (cncc-iam or cncc). This will rollback M-CNCC IAM M-CNCC Core and A-CNCC Core if enabled.
Multi Cluster 23.4.x 23.3.x or 23.2.x
  • cnDbtier Rollback
  • NF Rollback

    Rollback Instances (NF or CNE/OSO Common Services)

  • Console Agent Rollback

    Rollback A-CNCC Core

  • Console Manager Rollback

    Rollback CNC Console

  • Manager Clusters :

    • CNC Console 23.2.0 onwards A-CNCC DB dependency has been taken out. Refer pre rollback tasks section for additional steps before perming rollback.
    • Helm rollback CNC Console using existing release name (cncc-iam or cncc). This will rollback M-CNCC IAM and uninstall M-CNCC Core and A-CNCC Core if enabled.
  • Agent Clusters:
    • CNC Console 23.2.0 onwards A-CNCC DB dependency has been taken out. Refer pre rollback tasks section for additional steps before perming rollback.
    • Helm rollback cncc-core using existing release name (cncc-core or cncc). This will rollback A-CNCC Core.

6.2 Pre-rollback Tasks

This section describes the tasks to be performed before a rollback.

6.2.1 CNCC IAM DB Rollback or Restore

This section provides details of CNCC IAM Rollback. In case of CNC Console IAM Upgrade failure, rollback CNC Console IAM DB to previous version by following the below steps.

Note:

  • The latest backup must be used for rollback.
  • This entire section of Pre Rollback tasks must be done in one go. If any operational delay or error is encountered after starting, the whole rollback process must be repeated from the start.
  • Ensure that all the necessary files mentioned in the section are ready before you begin the Pre Rollback tasks.
To perform a CNC Console IAM DB rollback or Restore:
  1. Log in to the deployment cluster, drop the existing database and create a new database. Restore the new database with the DB Schema file provided as part of package (<occncc_rollback_iam_schema_<version>.sql>):

    Run the following command to drop the Database and create a new Database:

    
    DROP DATABASE <CNCCDatabase>
    CREATE DATABASE IF NOT EXISTS <CNCC Database>;
    Example:
    
    To be run in the mysql pod:
    DROP DATABASE cnccdb;
    CREATE DATABASE IF NOT EXISTS cnccdb;
    
    

    Note:

    You must take the <occncc_rollback_iam_schema_<version>.sql> file from the CNC Console version from which you are performing the rollback. For example, if you are performing rollback from version N to version N-2 or N-1, you must use the <occncc_rollback_iam_schema_<version>.sql> file given in the CNC Console package of version N.
  2. Copy the DB Schema file provided as part of package into the MYSQl pod (occncc_rollback_iam_schema_<version>.sql).
    Before copying the file into MYSQL pod replace string "InnoDB" with "ndbcluster" using following command:
    sed -i 's/InnoDB/ndbcluster/g' occncc_rollback_iam_schema_<version>.sql
    For example:
    sed -i 's/InnoDB/ndbcluster/g' occncc_rollback_iam_schema_23.4.4.sql
    

    Run the following command to copy the DB Schema file:

    kubectl cp <occncc_rollback_iam_schema_<version>.sql> <namespace>/<pod-name>:<directory where you want your file placed>
    Example:
    kubectl cp occncc_rollback_iam_schema_23.4.4.sql cndbtier1/ndbappmysqld-0:/home/mysql
  3. Run the following command to connect to the SQL node of the NDB cluster or connect to the cnDbBTier:
    $ kubectl -n <cndbtier_namespace> exec -it <cndbtier_sql_pod_name> -c <cndbtier_sql_container_name> -- bash
    Example:
    $ kubectl -n cndbtier  exec -it ndbappmysqld-0 -c mysqlndbcluster -- bash
  4. Restore this new database with the DB Schema file provided as part of package (occncc_rollback_iam_schema_<version>.sql).
    Run the following command to Restore DB Schema:
    mysql -h 127.0.0.1 -u root -p <DB name> < <DB Schema file name>
    Example:
    mysql -h 127.0.0.1 -u root -p cnccdb <occncc_rollback_iam_schema_<version>.sql
  5. The DB Dump has to be rearranged sequentially not to get any foreign key constraints issue. For that, create the ENV variables and run it in a loop.
    1. Run the following command to convert the mysqldump file which was taken as a backup (sql.gz file) to a sql file to rearrange it:

      Unzipping the gz file:

      gunzip -d <<backup_filename>.sql.gz>
      Example:
      gunzip -d cnccdbBackup.sql.gz
    2. Rearrange the backup sql file in correct order by using following procedure:
      1. Run the following command to rearrange the Table Data :
        export KC_TABLES="ADMIN_EVENT_ENTITY RESOURCE_SERVER RESOURCE_SERVER_POLICY
                  ASSOCIATED_POLICY REALM CLIENT AUTHENTICATION_FLOW AUTHENTICATION_EXECUTION
                  AUTHENTICATOR_CONFIG AUTHENTICATOR_CONFIG_ENTRY BROKER_LINK CLIENT_ATTRIBUTES
                  CLIENT_AUTH_FLOW_BINDINGS KEYCLOAK_ROLE CLIENT_INITIAL_ACCESS CLIENT_NODE_REGISTRATIONS
                  CLIENT_SCOPE CLIENT_SCOPE_ATTRIBUTES CLIENT_SCOPE_CLIENT CLIENT_SCOPE_ROLE_MAPPING
                  USER_SESSION CLIENT_SESSION CLIENT_SESSION_AUTH_STATUS CLIENT_SESSION_NOTE
                  CLIENT_SESSION_PROT_MAPPER CLIENT_SESSION_ROLE CLIENT_USER_SESSION_NOTE COMPONENT
                  COMPONENT_CONFIG COMPOSITE_ROLE DATABASECHANGELOG USER_ENTITY CREDENTIAL
                  DATABASECHANGELOGLOCK DEFAULT_CLIENT_SCOPE EVENT_ENTITY FEDERATED_IDENTITY FEDERATED_USER
                  FED_USER_ATTRIBUTE FED_USER_CONSENT FED_USER_CONSENT_CL_SCOPE FED_USER_CREDENTIAL
                  FED_USER_GROUP_MEMBERSHIP FED_USER_REQUIRED_ACTION FED_USER_ROLE_MAPPING KEYCLOAK_GROUP
                  GROUP_ATTRIBUTE GROUP_ROLE_MAPPING IDENTITY_PROVIDER IDENTITY_PROVIDER_CONFIG
                  IDENTITY_PROVIDER_MAPPER IDP_MAPPER_CONFIG MIGRATION_MODEL OFFLINE_CLIENT_SESSION
                  OFFLINE_USER_SESSION POLICY_CONFIG PROTOCOL_MAPPER PROTOCOL_MAPPER_CONFIG REALM_ATTRIBUTE
                  REALM_DEFAULT_GROUPS REALM_LOCALIZATIONS REALM_ENABLED_EVENT_TYPES REALM_EVENTS_LISTENERS
                  REALM_REQUIRED_CREDENTIAL REALM_SMTP_CONFIG REALM_SUPPORTED_LOCALES REDIRECT_URIS
                  REQUIRED_ACTION_CONFIG REQUIRED_ACTION_PROVIDER RESOURCE_SERVER_RESOURCE
                  RESOURCE_ATTRIBUTE RESOURCE_POLICY RESOURCE_SERVER_SCOPE RESOURCE_SCOPE
                  RESOURCE_SERVER_PERM_TICKET RESOURCE_URIS ROLE_ATTRIBUTE SCOPE_MAPPING SCOPE_POLICY
                  USERNAME_LOGIN_FAILURE USER_ATTRIBUTE USER_CONSENT USER_CONSENT_CLIENT_SCOPE
                  USER_FEDERATION_PROVIDER USER_FEDERATION_CONFIG USER_FEDERATION_MAPPER
                  USER_FEDERATION_MAPPER_CONFIG USER_GROUP_MEMBERSHIP USER_REQUIRED_ACTION USER_ROLE_MAPPING
                  USER_SESSION_NOTE WEB_ORIGINS";
      2. Run the following command to create an ENV pointing to the sql file to be filtered:
        export KC_BACKUP="./<Backup SQL Dump File>";
        Example:
        export KC_BACKUP="./cnccdbBackup.sql";
      3. Run the following command to rearrange the dump file to make it in sequential insertion order:
      for i in $KC_TABLES; do grep "INSERT INTO \`$i\`"$KC_BACKUP; done > <file name> 
      Example:
      for i in $KC_TABLES; do grep "INSERT INTO \`$i\`"$KC_BACKUP; done > /tmp/restore.sql
  6. Run the following command to Copy file into the pod:
    kubectl cp <backup_file name>.sql <namespace>/<pod-name>:<directory where you want your file placed>
    Example:
    kubectl cp restore.sql cndbtier1/ndbappmysqld-0:/home/mysql
  7. Run the following command to connect to the SQL node of the NDB cluster or connect to the cnDBTier:
    $ kubectl -n <cndbtier_namespace> exec -it <cndbtier_sql_pod_name> -c <cndbtier_sql_container_name>-- bash
    Example:
    $ kubectl -n cndbtier  exec -it ndbappmysqld-0 -c mysqlndbcluster -- bash
  8. Populate the Database with data using the file that you have, after filtering the sqldump file.
  9. Run the following command to restore Database Data:
    mysql -h 127.0.0.1 -u root -p <DB name> < <backup_filename>
    Example:
    mysql -h 127.0.0.1 -u root -p cnccdb < restore.sql
  10. Login to the MySQL prompt and confirm that the databases are restored.
  11. Run the following command to Delete the sql files copied into the pod after the restore process is complete and successful (by logging into the SQL node):
    
    rm -rf <DB Schema file name>
    rm -rf <backup_filename>
    Example:
    
    rm -rf occncc_rollback_iam_schema_<version>.sql
    rm -rf restore.sql

6.2.2 A-CNCC Core DB Rollback or Restore

This section provides details of A-CNCC Core Rollback. In case of CNC Console upgrade failure, roll back A-CNCC Core DB to previous version by following the below steps.

Note:

  • The latest backup must be used for rollback.
  • This step is applicable when rolling back to 23.1.x or older version as CNC Console 23.2.0 onwards A-CNCC DB dependency has been taken out. Only CNC Console IAM and M-CNCC Core has DB dependency.
To perform A-CNCC Core DB rollback or restore:
  1. Log in to the deployment cluster, and run the following command in the mysql pod to drop the existing database and create a new database.
    
    DROP DATABASE <CNCCDatabase>
    CREATE DATABASE IF NOT EXISTS <CNCC Database>;
    Example:
    
    DROP DATABASE acncccommonconfig;
    CREATE DATABASE IF NOT EXISTS acncccommonconfig;
  2. Convert the mysqldump file which was taken as a backup (sql.gz file) to a sql file.
    
    gunzip -d <<backup_filename>.sql.gz>
    Example:
    
    gunzip -d acncccommonconfigBackup.sql.gz
  3. Copy the existing file with the following command:
    kubectl cp <backup_file name>.sql <namespace>/<pod-name>:<directory where you want your file
          placed>
    Example:
    kubectl cp acncccommonconfigBackup.sql cndbtier1/ndbappmysqld-0:/home/mysql
  4. Run the following command to connect to the SQL node of the NDB cluster or connect to the cnDbBTier:
    $ kubectl -n <cndbtier_namespace> exec -it <cndbtier_sql_pod_name> -c <cndbtier_sql_container_name>
          -- bash
    Example:
    $ kubectl -n cndbtier  exec -it ndbappmysqld-0 -c mysqlndbcluster -- bash
  5. Populate the DB with data using the file which you have copied into the pod after filtering the sqldump file using the following command:
    mysql -h 127.0.0.1 -u root -p <DB name> < <backup_filename> 
    Example:
    mysql -h 127.0.0.1 -u root -p acncccommonconfig < acncccommonconfigBackup.sql
  6. Log in to the MySQL prompt and confirm that the databases are restored.
  7. Run the following command to delete the sql files copied into the pod after the restore process is complete and successful (by logging into the SQL node):
    rm -rf <backup_filename>
    Example:
    
    rm -rf acncccommonconfigBackup.sql

6.3 CNCC Rollback

This section describes the procedure to Rollback CNCC.

Note:

Existing release name must be used for rollback.
  1. Run the following command to check which revision you need to rollback :
    $ helm history <release_name> -n <namespace>
    Example:
    $ helm history cncc -n cncc
  2. Run the following command to rollback to the required revision :
    $ helm rollback <release_name> <revision_number> -n <namespace>
    
    Example:
    $ helm rollback cncc 1 -n cncc