Changing the plan size of the Cognos Analytics service instance

Change the plan size of the Cognos® Analytics service instance after you already provisioned an instance of Cognos Analytics.

About this task

For example, if you provisioned an instance of Cognos Analytics and you later decide that you want to increase or decrease the size of the instance due to resource requirements, you can change the size without having to provision a new instance.

Procedure

  1. Create a new file called scale_instance.sh with the following contents:
    #!/usr/bin/env bash
    #
    # -----------------------------------------------------------------------------
    #         Licensed Materials - Property of IBM
    #
    #         IBM Cognos Products: ca
    #
    #         (C) Copyright IBM Corp. 2022
    #
    #         US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
    # -----------------------------------------------------------------------------
    #
    #
    
    #set -e
    #set -x
    
    check_status=""
    
    function isValidPlan {
        if [[ "$1" != "" ]] && [[ "$1" != "fixedminimum" ]] && [[ "$1" != "small" ]] && [[ "$1" != "medium" ]] && [[ "$1" != "large" ]]; then
            echo "Invalid plan specified: $1."
            echo "Expected one of: fixedminimum, small, medium or large"
            exit 1
        fi
    }
    
    function usage {
        echo $0: usage: $0 [-h] -t tethered namespace -p plan-size
    }
    
    function help {
        usage
        echo "-h                    prints help to the console"
        echo "-t tethered namespace namespace to scale (required)"
        echo "-p plan size          plan size, one of fixedminimum, small, medium or large (required)"
        echo ""
        exit 0
    }
    
    while getopts ":ht:p:" opt; do
         case ${opt} in
         h)
            help
            ;;
         t)
            namespace=$OPTARG
            ;;
         p)
            plan_size=$OPTARG
            ;;
         \?)
            usage
            exit 0
            ;;
         esac
    done
    
    if [ -z $namespace ]; then
        echo "A tethered namespace must be provided"
        help
    fi
    
    if [ -z $plan_size ]; then
        echo "A plan size must be provided"
        help
    fi
    
    isValidPlan $plan_size
    
    cr_name=$(oc -n ${namespace} get caserviceinstance --no-headers -o custom-columns=NAME:.metadata.name)
    
    if [ -z $cr_name ]; then
        echo "Unable to find CAServiceInstance CR for namespace: ${namespace}"
        help
    fi
    
    echo "Scaling plan: ${cr_name} ..."
    oc patch caserviceinstance ${cr_name} --type merge -p "{\"spec\":{\"plan_size\":\"${plan_size}\"}}" -n ${namespace}
    check_status="Completed"
    
    sleep 10
    
    # Checking status of ca shutdown action
    for i in {1..240};do
        caStatus=$(oc get caserviceinstance ${cr_name} -o jsonpath="{.status.caStatus}" -n ${namespace})
    
        if [[ ${caStatus} == ${check_status} ]];then
            echo "ca ${check_status} Successfully"
            break
        elif [[ ${caStatus} == "Failed" ]];then
            echo "ca ${caStatus}!"
            exit 1
        fi
        echo "ca Status: ${caStatus}"
        sleep 30
    done
  2. Use the scale_instance.sh script that you created to change the size of the Cognos Analytics service instance.
    scale_instance.sh [-h] -t tethered_namespace -p fixedminimum | small | medium | large

    where

    • -t specifies the namespace or project in which you will scale the instance.
    • -p specifies the new size of the Cognos Analytics service instance.

    For example, to increase the size of your Cognos Analytics service instance to large, run the following command:

    ./scale_instance.sh -t NAMESPACE -p large