Enabling external MQ service

If you have enabled the GDS service, you need to enable external IBM MQ service.

Before you begin

  • You need to enable GDS service through the productmaster_instance CR file. For more information, see Enabling additional features.
  • You must install MQ in the same namespace where you have installed the Product Master.
  • You can either use your own external MQ supportive service or use the IBM MQ service.

Procedure

  1. Add the following value in the IBM MQ service manifest file by using the following command.
    namespace
    The namespace where you have installed the Product Master.
    cat <<EOF| oc apply -f -
    apiVersion: v1
    kind: Service
    metadata:
      name: productmaster-mq-service
      namespace: ${PROJECT_CPD_INST_OPERANDS}
      labels:
        app: productmaster-mq
    spec:
      type: ClusterIP
      ports:
        - name: http
          port: 1414
          protocol: TCP
          name: http
          targetPort: 1414
        - name: https
          port: 9443
          protocol: TCP
          name: https
          targetPort: 9443
      selector:
        app: productmaster-mq
    EOF
  2. Add the following values in the IBM MQ StatefulSet manifest file.
    storageClassName
    The name of the storage class.
    image
    icr.io/ibm-messaging/mq:9.3.2.0-r2
    registryname
    The name of the registry.
    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: productmaster-mq
      namespace: <namespace>
    spec:
      selector:
        matchLabels:
          app: productmaster-mq
      serviceName: productmaster-mq-service
      template:
        metadata:
          labels:
            app: productmaster-mq
          name: productmaster-mq
        spec:
          containers:
          - env:
            - name: MQ_APP_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: mq_app_pass
                  name: app-secret
            - name: MQ_ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: mq_ui_pass
                  name: app-secret
            envFrom:
            - configMapRef:
                name: productmaster-mq-configmap
            image: : icr.io/ibm-messaging/mq:9.3.2.0-r2
            imagePullPolicy: Always
            livenessProbe:
              failureThreshold: 3
              initialDelaySeconds: 60
              periodSeconds: 70
              successThreshold: 1
              tcpSocket:
                port: http
              timeoutSeconds: 1
            name: productmaster-mq
            ports:
            - containerPort: 1414
              name: http
              protocol: TCP
            - containerPort: 9443
              name: https
              protocol: TCP
            readinessProbe:
              failureThreshold: 3
              initialDelaySeconds: 30
              periodSeconds: 60
              successThreshold: 1
              tcpSocket:
                port: http
              timeoutSeconds: 1
            resources:
              limits:
                cpu: 150m
                ephemeral-storage: 900Mi
                memory: 500Mi
              requests:
                cpu: 120m
                ephemeral-storage: 900Mi
                memory: 500Mi
            securityContext:
              allowPrivilegeEscalation: false
              capabilities:
                drop:
                - ALL
              privileged: false
              readOnlyRootFilesystem: false
              runAsNonRoot: true
            startupProbe:
              failureThreshold: 60
              periodSeconds: 10
              successThreshold: 1
              tcpSocket:
                port: 1414
              timeoutSeconds: 1
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /mnt/mqm
              name: pvc-data
          dnsPolicy: ClusterFirst
          imagePullSecrets:
          - name: <registryname>
          restartPolicy: Always
          serviceAccount: ibm-cpd-productmaster-sa
          serviceAccountName: ibm-cpd-productmaster-sa
          terminationGracePeriodSeconds: 30
      updateStrategy:
        rollingUpdate:
          partition: 0
        type: RollingUpdate
      volumeClaimTemplates:
      - apiVersion: v1
        kind: PersistentVolumeClaim
        metadata:
          name: pvc-data
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 15Gi
          storageClassName: <storageclassname>
          volumeMode: <storageclass-type>
  3. Add the following value in the IBM MQ service ConfigMap file.
    namespace
    The namespace where you have installed the Product Master.
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: productmaster-mq-configmap
      namespace: ${PROJECT_CPD_INST_OPERANDS}
      labels:
        app: productmaster-mq
    data:
      LICENSE: accept
      MQ_QMGR_NAME: QM1
    
  4. To create route through which you can access the external MQ service, add the following value in the IBM MQ service route file.
    namespace
    The namespace where you have installed the Product Master.
    kind: Route
    apiVersion: route.openshift.io/v1
    metadata:
      name: productmaster-mq-route
      namespace: ${PROJECT_CPD_INST_OPERANDS}
      labels:
        app: productmaster-mq
    spec:
      to:
        kind: Service
        name: productmaster-mq-service
        weight: 100
      port:
        targetPort: https
      tls:
        termination: passthrough
        insecureEdgeTerminationPolicy: Redirect
      wildcardPolicy: None
    
  5. To connect to external MQ service, add the following entries to the app-secret file. You need to do this is needed if you have enabled GDS service.
    
    mq_host: "<MQ IP or hostname>"  
    mq_port: "<MQ service port>"  
    mq_app_user: "<MQ service  app username>"  
    mq_app_pass: "<MQ service app password>" 

    Optional - You can also add these entries through the Red Hat® OpenShift® web console.

    1. Log in to your Red Hat OpenShift instance as an administrator.
    2. Click Administration > Workloads > Secrets from on the left panel.
    3. Select app-secret.
    4. Click Actions in the right corner and select Edit Secret.
    5. Add the following key-value pair for the key.
      Key :- mq_host   |  value :- mq-service-name
      Key :- mq_port   |  value :- 1414
      Key :- mq_app_user  |  value :- app
      Key :- mq_app_pass   |  value :- admin