Supplying updated passwords to the Watson OpenScale service

As a regular part of your system administration procedures you must change essential passwords, such as the admin password for your cluster or the Db2 password. Because these passwords are essential to the proper functioning of the service, when you change them, you must supply the updated password to Watson™ OpenScale.

Supplying the updated admin password to the Watson OpenScale service

Whenever you change the password for the admin password that was used to install IBM Cloud Pak® for Data, you must supply the new credentials to Watson OpenScale through the use of a Kubernetes k8s secret. This procedure is required if you install IBM Cloud Pak for Data, subsequently change the admin password, and then try to install the Watson OpenScale service. It is typically not required if you install Watson OpenScale before making any change to the original admin password.

If the default admin credentials for CP4D has been updated prior to OpenScale installation, then the updated credentials need to passed to OpenScale via a kubernetes secrets. This can be skip if the user is not planning to use WML on the same cluster.

  1. Obtain the following pieces of information:
    • namespace: the namespace where the Watson OpenScale service is installed
    • username: the IBM Cloud Pak for Data admin user name
    • password: the IBM Cloud Pak for Data admin password
  2. Insert the preceding variables into the following script and run it:
    oc -n namespace create secret generic ibm-aios-icp4d-credentials --from-literal=username=username --from-literal=password='password'
    

Supplying the updated Db2 password to the Watson OpenScale service

Whenever you change the password for your Db2 instance, you must supply the updated password to Watson OpenScale. From the UI:
  1. Open the Database tab on the System setup page.
  2. Click the Edit icon in the details panel.
  3. Enter the new database password and save the changes.

To supply the updated password to Watson OpenScale using the Python SDK, you must install the ibm-watson-openscale Python library. When you fill in the information in the script, you change only the password. The API requires that the rest of the credentials and schema name be present, however, the other fields must be the same as the existing datamart database. This procedure does not change the password. It retrieves the password and supplies it to the Watson OpenScale service so that it can connect to the database.

  1. Acquire the following Db2 credentials for the Db2 database and schema that are used for Watson OpenScale:
    • hostname:
    • password:
    • port_number:
    • username:
    • your_schema:

    Acquire the following credentials for Watson OpenScale (public cloud):

    • instance_guid:
    • apikey:

    Acquire the following credentials for Watson OpenScale for IBM Cloud Pak for Data:

    • URL:
    • username:
    • password:
  2. Create a notebook and then add and run the following cells:
    1. Add the required ibm-watson-openscale Python library to the notebook:
      !pip install --upgrade ibm-watson-openscale --no-cache | tail -n 1
    2. Update the variables in the following script and then run it inside the notebook:
      from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
      from ibm_watson_openscale import APIClient
      
      service_credentials = { 
                          "url": "<CP4d_URL>",
                          "username": "*******",
                          "password": "*******" #Pass either password or apikey but not both
                          "apikey": "*******",
                          disable_ssl_verification=True
                       }
      authenticator = CloudPakForDataAuthenticator(
          url=service_credentials['url'],
          username=service_credentials['username'],
          password=service_credentials['password'],
          apikey=service_credentials['apikey'],
          disable_ssl_verification=True
      )
      
      client = APIClient(
          service_url=service_credentials['url'],
          service_instance_id=<SERVICE_INSTANCE_ID>,
          authenticator=authenticator
          #,bedrock_url = bedrock_url # Provide this url if iam_integration is enabled on your cluster
      )
      
      db_credentials = {
      	'database_type': 'db2',
      	'credentials': {
      		'hostname': 'hostname',
      		'password': 'password',
      		'port': port_number,
      		'username': 'username'
      	}
      }
      schema = 'your_schema'
      
    3. Run the update:
      client.data_marts.patch(
                  data_mart_id=<SERVICE_INSTANCE_ID>,
                  json_patch_operation=[JsonPatchOperation(
                      op=OperationTypes.REPLACE,
                      path='/database_configuration/credentials',
                      value=db_credentials
                  ),
                  JsonPatchOperation(
                      op=OperationTypes.REPLACE,
                      path='/database_configuration/schema_name',
                      value=schema
                  )]
              )
      
      
  3. Save the notebook so that you can supply the new credentials to Watson OpenScale any time the Db2 password changes.