Use an Red Hat® OpenShift® Container Platform Pipeline to create a new
IBM® MQ container image, with MQSC and INI files you want
to be applied to queue managers using this image. This task should be completed by a project
administrator
Procedure
-
Create an
ImageStream
An image stream and its associated tags provide an abstraction for referencing container images from within Red Hat OpenShift Container Platform.
The image stream and its tags allow you to see what images are available and ensure that you are using the specific image you need even if the image in the repository changes.
oc create imagestream mymq
-
Create a
BuildConfig
for your new image
A BuildConfig
will allow builds for your new image, which will be based off the IBM official images, but will add any MQSC or INI files you want to be run on container start-up.
-
Create a YAML file defining the
BuildConfig
resource
For example, create a file called "mq-build-config.yaml" with the following contents:
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: mymq
spec:
source:
dockerfile: |-
FROM cp.icr.io/cp/ibm-mqadvanced-server-integration:9.2.5.0-r3
RUN printf "DEFINE QLOCAL(foo) REPLACE\n" > /etc/mqm/my.mqsc \
&& printf "Channels:\n\tMQIBindType=FASTPATH\n" > /etc/mqm/my.ini
LABEL summary "My custom MQ image"
strategy:
type: Docker
dockerStrategy:
from:
kind: "DockerImage"
name: "cp.icr.io/cp/ibm-mqadvanced-server-integration:9.2.5.0-r3"
pullSecret:
name: ibm-entitlement-key
output:
to:
kind: ImageStreamTag
name: 'mymq:latest-amd64'
You
will need to replace the two places where the base
IBM MQ is mentioned, to point at the correct base image for the version and fix you want to use (see
Release history for IBM MQ Operator for details). As fixes are applied, you will need to repeat
these steps to re-build your image.
This example creates a new image based on the IBM official image, and adds files called "my.mqsc"
and "my.ini" into the /etc/mqm directory. Any MQSC or INI files found in this
directory will be applied by the container at start-up. INI files are applied using the
crtmqm -ii option, and merged with the existing INI files. MQSC files are applied
in alphabetical order.
It is important that your MQSC commands are repeatable, as they will be run every time the
queue manager starts up. This typically means adding the REPLACE
parameter on any
DEFINE
commands, and adding the IGNSTATE(YES)
parameter to any
START
or STOP
commands.
-
Apply the
BuildConfig
to the server.
oc apply -f mq-build-config.yaml
-
Run a build to create your image
-
Start the build
You should see output similar to the following:
build.build.openshift.io/mymq-1 started
-
Check the status of the build
For example, you can run the following command, using the build identifier returned in the previous step:
oc describe build mymq-1
-
Deploy a queue manager, using your new image
You could add the following snippet of YAML into your normal
QueueManager
YAML, where
my-namespace is the
Red Hat OpenShift project/namespace you are using, and
image is the name of the image you created earlier (for example,
"mymq:latest-amd64"):
spec:
queueManager:
image: image-registry.openshift-image-registry.svc:5000/my-namespace/my-image