Configuring the connection to License Service Reporter by using the CLI

You can configure the connection to License Service Reporter by using the CLI. To configure the connection, perform the following steps.

Procedure

Note: If IBM products are installed in multiple namespaces, you need to update the configuration CR in each namespace.
  1. Log in to the OpenShift console of the cluster where License Service Reporter is installed.
  2. Export the following environment variables. Ensure that they contain information that is in line with your environment.
    export UMS_NAMESPACE=<Name of the product namespace>
    export LSR_NAMESPACE=<Name of the License Service Reporter namespace>
    export CONFIGMAP_NAME=<Name of the upload ConfigMap>
    export SECRET_NAME=<Name of the upload secret>
    
    Where:
    • Name of the product namespace is the namespace of the product for which you want to configure automatic upload of the audit snapshot.
    • Name of the License Service Reporter namespace is the name of the namespace in which License Service Reporter is installed.
    • Name of the upload ConfigMap is the name of your choice for the ConfigMap of Usage Metering Service.
    • Name of the upload secret is the name of your choice for the secret of Usage Metering Service.
  3. Export the following variables.
    export LSR_URL=$(oc get route ibm-license-service-reporter -n $LSR_NAMESPACE -o jsonpath='{.spec.host}')
    export LSR_TLS_CRT=$(oc get secret ibm-license-service-reporter-cert -n $LSR_NAMESPACE -o jsonpath='{.data.tls\.crt}' | base64 -d | sed 's/^/    /')
    export LSR_TOKEN=$(oc get secret ibm-license-service-reporter-token -n $LSR_NAMESPACE -o jsonpath='{.data.token}')
    
  4. Log in to the OpenShift console of the cluster where the product for which you want to display the data is deployed.
  5. To create a ConfigMap that is used to configure the connection to License Service Reporter, run the following command.
    envsubst <<EOF | oc apply -f -
    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: \${CONFIGMAP_NAME}
      namespace: \${UMS_NAMESPACE}
    data:
      url: https://\${LSR_URL}
      tls.crt: |
    \${LSR_TLS_CRT}
    EOF
    
  6. To create the secret that is used to configure the connection to the License Service Reporter, run the following command.
    envsubst <<EOF | oc apply -f -
    kind: Secret
    apiVersion: v1
    type: Opaque
    metadata:
      name: \${SECRET_NAME}
      namespace: \${UMS_NAMESPACE}
    data:
      token: \${LSR_TOKEN}
    EOF
    
  7. To update the configuration CR, run the following command.
    oc patch IBMUsageMetering ibm-usage-metering-instance -n $UMS_NAMESPACE --type=merge -p "{
      \"spec\": {
        \"sender\": {
          \"reporter\": {
            \"configMapName\": \"${CONFIGMAP_NAME}\",
            \"secretName\": \"${SECRET_NAME}\"
          }
        }
      }
    }"