How to set environment variables at the AMQ Broker Operator level ?

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container (RHOCP) 4
  • Red Hat AMQ Broker (AMQ Streams) 1.6
  • Operator Lifecycle Manager (OLM)

Issue

  • How to set environment variable at the operator level ?
  • How can environment variables of Operators that are managed by Operator Lifecycle Manager (OLM) be overwritten?
  • Can environment variables of Operator Pods be changed?

Resolution

Environment variables of Operator Pods can be overwritten by specifying the variables in the .spec.config.env field of the Operators Subscription object:

  • In the OpenShift Web Console:
    From OpenShift Web Console, click on Operators menu; Installed Operators; Red Hat Integration - AMQ Streams 1.6 - Subscription (Action - Edit subscription)

  • Using the Openshift Client oc:

      oc edit subscription amq-streams -n openshift-operators
    

    Add the following at spec.config.env. For instance:

      spec:
        name: amq-streams
        channel: stable
        config:
          env:
            - name: HTTP_PROXY
              value: '-v=10'
            - name: NO_PROXY
              value: '-v=10'
    

By applying the new environments variables, the Deployment and StatefulSet will be updated with the new values and all the Pods will be restarted.

Root Cause

The Subscription object allows control over the Operator environment variables and other configuration fields. This is also valid for Operators like AMQ, DataGrid, and EAP, where the user uses the Subscription for customization of the Operator pod itself.
However, it is not the case for MTA or GitOps Operator for example, where the user handles the CSV directly not the Subscription resource.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.