Installing License Service Reporter from online repository with the CLI

Learn how to install the latest version of License Service Reporter by using the CLI.

Complete the following tasks to install the latest version of License Service Reporter by using the CLI.

  1. Creating the CatalogSource for License Service Reporter
  2. Installing the License Service Reporter operator with the CLI
  3. Creating the License Service Reporter instance with the CLI

Creating the CatalogSource for License Service Reporter with the CLI

Complete the following steps to create the catalog sources that you need for License Service Reporter:

  1. Log in to the cluster by using the oc login command.

  2. Create the License Service Reporter catalog source:

    1. Create a YAML file named license-service-reporter-catalog.yaml with the following definition:

      apiVersion: operators.coreos.com/v1alpha1
      kind: CatalogSource
      metadata:
        name: ibm-license-service-reporter-operator-catalog
        namespace: openshift-marketplace
      spec:
        displayName: IBM License Service Reporter Catalog
        publisher: IBM
        sourceType: grpc
        image: icr.io/cpopen/ibm-license-service-reporter-operator-catalog
        updateStrategy:
         registryPoll:
          interval: 45m
      
    2. Apply the YAML file to create the License Service Reporter catalog source.

      oc apply -f license-service-reporter-catalog.yaml
      
  3. Verify that the catalog source is created.

    oc -n openshift-marketplace get catalogsource ibm-license-service-reporter-operator-catalog -o jsonpath="{.status.connectionState.lastObservedState}"
    

    Following is the expected output:

    READY
    

Installing the License Service Reporter operator with the CLI

  1. Log in to the cluster.
  2. Define the installation namespace with the following command.

    export LSR_NAMESPACE=<YOUR_NAMESPACE>
    

    where is the namespace where you want to install License Service Reporter.

  3. Create a license-reporter-operator.yaml file with the following definition:

     apiVersion: v1
     kind: Namespace
     metadata:
       name: ${LSR_NAMESPACE}
     ---
     apiVersion: operators.coreos.com/v1alpha2
     kind: OperatorGroup
     metadata:
       name: operatorgroup
       namespace: ${LSR_NAMESPACE}
     spec:
       targetNamespaces:
       - ${LSR_NAMESPACE}
     ---
     apiVersion: operators.coreos.com/v1alpha1
     kind: Subscription
     metadata:
       name: ibm-license-service-reporter-operator
       namespace: ${LSR_NAMESPACE}
     spec:
       channel: v4.2
       installPlanApproval: Automatic
       name: ibm-license-service-reporter-operator
       source: ibm-license-service-reporter-operator-catalog
       sourceNamespace: openshift-marketplace
    
  4. Run the following command to create the resources that are defined in the license-reporter-operator.yaml.yaml file.

     envsubst < license-reporter-operator.yaml | oc apply -f -
    

    Following is a sample output:

     namespace/<LSR_NAMESPACE> created
     operatorgroup.operators.coreos.com/operatorgroup created
     subscription.operators.coreos.com/ibm-license-service-reporter-operator-catalog created
    
  5. Verify the status of the operator by running the following command:

    oc -n ${LSR_NAMESPACE} get csv
    

    Following is a sample output:

    NAME                                           DISPLAY                        VERSION   REPLACES   PHASE
    ibm-license-service-reporter-operator.v4.2.4   IBM License Service Reporter   4.2.4                Succeeded
    

Creating the License Service Reporter instance with the CLI

  1. Create the license-reporter.yaml file with the following definition:

    apiVersion: operator.ibm.com/v1alpha1
    kind: IBMLicenseServiceReporter
    metadata:
      name: ibm-lsr-instance
      namespace: ${LSR_NAMESPACE}
      labels:
        app.kubernetes.io/created-by: ibm-license-service-reporter-operator
        app.kubernetes.io/instance: ibmlicenseservicereporter-instance
        app.kubernetes.io/name: ibmlicenseservicereporter
        app.kubernetes.io/part-of: ibm-license-service-reporter-operator
    spec:
      license:
        accept: true
      authentication:
        useradmin:
          enabled: true
    

    Note: License Service Reporter uses the default storage class. To use a different storage class, add and define the 'storageClass' parameter in the spec section of the license-reporter.yaml. For example:

    spec:
      storageClass: storage-class-internal
    
  2. Run the following command to apply the license-reporter.yaml on the cluster:

    envsubst < license-reporter.yaml | oc apply -f -