Files
nexus/knowledgebase/csd-wiki/ICSD/Pre-upgrade-task-of-AC-when-upgrade-from-24.2-to-24.3_688996364.md

5.5 KiB

Pre-upgrade-task-of-AC-when-upgrade-from-24.2-to-24.3_688996364

Introduction:

The exeuction of sql scripts is required when AC is enbaled for a Tenant on the ESM tenant in ESM 24.2 release, before upgrade of ESM chart to 24.3

It updates the existing 'Owner' of schema tables created in 24.2 to the tenant schema owner.

1. Pre-condition:

Download the below DB scripts onto the Bastion Node.

https://github.houston.softwaregrp.net/oo-rnd/itom-saas-tools/blob/master/configure-ac-tenant/ds_change_table_ownership.sql

https://github.houston.softwaregrp.net/oo-rnd/itom-saas-tools/blob/master/configure-ac-tenant/vps_change_table_ownership.sql

2. Run the sql scripts:

We need to connect to a bastion node having access to the RDS of SMAX setup.

2.1. Data Sync service:

1. Check the Tenant schema details before running the sql sciprts:

1. Connect to the acdatasyncdb.

2.Check the schema details

acdatasyncdb=# \dn

3. Pre-SQL scripts execution validation (check the 'Owner' of the schema table)

    acdatasyncdb=# \dt syncservice_<tenantId>.*

2. Run the Sql script from the Bastion host.

Usage: Script iterates over the schemas of the DataSync DB named LIKE 'syncservice_%', get the schema owner and set it as owner of the tables.

To get password of user acdatasyncdbuser:
→ Get the secret key for db password
kubectl get cm itom-ac-database-configmap -n -o yaml

The result is like:
DB_PASSWORD_KEY: itom_itsma_db_password_secret_key
You may find the DB_PASSWORD_KEY value from the itom-ac-database-configmap

→ Get the acdatasyncdbuser db password.
kubectl get pod -n | grep "itom-ac-data-sync" | head -1 | awk '{print $1}'
kubectl exec -n -c itom-ac-data-sync -- get_secret

For example:
kubectl exec $(kubectl get pod -n itsma-eks | grep "itom-ac-data-sync" | head -1 | awk '{print $1}') -n itsma-eks -c itom-ac-data-sync -- get_secret itom_itsma_db_password_secret_key

Command: PGPASSWORD='' psql -h < postgres_hostname> -p 5432 -d acdatasyncdb -U acdatasyncdbuser -a -f ds_change_table_ownership.sql

* PGPASSWORD - acdatasyncdbuser database user password

3. Post SQL scripts execution validation (Here 'Owner' of the tables is changed post the sql script execution):

acdatasyncdb=# \dt syncservice_<tenantId>.*

2.2. Vulnerability & Patching service:

1. Check the Tenant schema details before running the sql sciprts:

1. Connect to the acpatchdb

2. Check the schema details

acpatchdb=# \dn

3. Pre-SQL script execution validation: (check 'Owner' of the schema tables)

      acpatchdb=# \dt vps_schema_<tenantId>.*

2. Run the Sql script from the Bastion host.

Uasage: Script iterates over the schemas of the VPS DB named LIKE 'vps_schema_%', get the schema owner and sets it as owner of the tables.

To get password of user acpatchdbuser:
→ Get the secret key for db password
kubectl get cm itom-ac-database-configmap -n -o yaml

The result is like:
DB_PASSWORD_KEY: itom_itsma_db_password_secret_key
You may find the DB_PASSWORD_KEY value from the itom-ac-database-configmap

→ Get the acpatchdbuser db password.
kubectl get pod -n | grep "itom-ac-data-sync" | head -1 | awk '{print $1}'
kubectl exec -n -c itom-ac-data-sync -- get_secret

For example:
kubectl exec $(kubectl get pod -n itsma-eks | grep "itom-ac-data-sync" | head -1 | awk '{print $1}') -n itsma-eks -c itom-ac-data-sync -- get_secret itom_itsma_db_password_secret_key

Command: PGPASSWORD='' psql -h <postgres_hostname> -p 5432 -d acpatchdb -U acpatchdbuser -a -f vps_change_table_ownership.sql

* PGPASSWORD - acpatchdbuser database user password

3. Post SQL scripts execution (Here 'Owner' of the table is changed post the sql script execution):

  acpatchdb=# \dt vps_schema_<tenantId>.*

Related pages