Chapter 4. Upgrading AMQ Broker on OpenShift Container Platform
The procedures in this section show how to upgrade Operator- and templates-based broker deployments on OpenShift Container Platform.
To upgrade an existing AMQ Broker deployment on OpenShift Container Platform 3.11 to run on OpenShift Container Platform 4.1, you must first upgrade your OpenShift Container Platform installation, before performing a clean installation of AMQ Broker that matches your existing deployment. To perform a clean AMQ Broker installation, use one of these methods:
4.1. Upgrading an Operator-based broker deployment
The following procedures show you how to upgrade:
- The broker container image for an Operator-based broker deployment
- The AMQ Broker Operator version in your OpenShift project
4.1.1. Upgrading the broker container image
The following procedure shows how to upgrade the broker container image for a broker deployment based on the AMQ Broker Operator.
The procedure assumes that you used version 0.9.0 or greater of the AMQ Broker Operator to create your broker deployment. The name of the main broker Custom Resource (CR) instance included with these versions of the Operator is broker_v2alpha1_activemqartemis_cr.yaml
. You can also use instructions similar to those below to upgrade the broker container image for a deployment based on version 0.6.3 or earlier of the Operator. For those Operator versions, the name of the included main broker CR instance is broker_v1alpha1_activemqartemis_cr.yaml
.
Prerequisites
- You have used the AMQ Broker Operator to create a broker deployment. For more information, see Deploying AMQ Broker on OpenShift Container Platform using an Operator.
Procedure
-
In the
deploy/crs
directory of the Operator archive that you downloaded and extracted during your initial installation, open thebroker_v2alpha1_activemqartemis_cr.yaml
Custom Resource (CR). Edit the
image
element to specify the latest AMQ Broker 7.5 container image, as shown below.image: registry.redhat.io/amq7/amq-broker:7.5
Apply the CR change.
$ oc apply -f deploy/crs/broker_v2alpha1_activemqartemis_cr.yaml
When you apply the CR change, each broker Pod in your deployment shuts down and then restarts using the new broker container image. If you have multiple brokers in your deployment, only one broker Pod shuts down and restarts at a time.
4.1.2. Upgrading the Operator
The following procedure shows how to upgrade the AMQ Broker Operator version in your OpenShift project.
You cannot directly upgrade an Operator installation based on version 0.6.3 or earlier to use version 0.9.0 or greater because the Custom Resource Definitions (CRDs) used by versions 0.6.3 or earlier are not compatible with versions 0.9.0 or later. In this case, you must perform a new installation of the Operator before using it to recreate your broker deployments. For more information, see Installing the Broker Operator.
Prerequisites
- You have previously installed and deployed an AMQ Broker Operator based on version 0.9.0 or greater. For more information, see Installing the AMQ Broker Operator.
Procedure
Log in to OpenShift Container Platform as a cluster administrator.
$ oc login -u system:admin
Log in to the project in which you want to upgrade the Operator.
$ oc project <project_name>
-
In the
deploy
directory of the Operator archive that you downloaded and extracted during your original installation, open theoperator.yaml
file. Update the
spec.containers.image
attribute to specify the full path to the latest Operator image for AMQ Broker 7.5 in the Red Hat Container Registry.spec: template: spec: containers: image: registry.redhat.io/amq7/amq-broker-rhel7-operator:0.9
When you have updated the
spec.containers.image
attribute, apply the changes.$ oc apply -f deploy/operator.yaml
OpenShift updates your project to use the latest Operator version. The upgrade has no effect on your running broker Pods.
4.2. Upgrading templates-based broker deployments
The following procedures show how to upgrade an existing broker deployment that is based on application templates.
4.2.1. Upgrading non-persistent broker deployments
This procedure shows you how to upgrade a non-persistent broker deployment. The non-persistent broker templates in the OpenShift Container Platform service catalog have labels that resemble the following:
- Red Hat AMQ Broker 7.x (Ephemeral, no SSL)
- Red Hat AMQ Broker 7.x (Ephemeral, with SSL)
- Red Hat AMQ Broker 7.x (Custom Config, Ephemeral, no SSL)
Prerequisites
- Starting in AMQ Broker 7.3, you use a new version of the Red Hat Container Registry to access container images. This new version of the registry requires you to become an authenticated user before you can access images and pull them into an OpenShift project. Before following the procedure in this section, you must first complete the steps described in Red Hat Container Registry Authentication.
Procedure
- Navigate to the OpenShift Container Platform web console and log in.
- Click the project in which you want to upgrade a non-persistent broker deployment.
Select the Deployment Config (DC) corresponding to your broker deployment.
-
In OpenShift Container Platform 4.1, click
. -
In OpenShift Container Platform 3.11, click
. Within your broker deployment, click the Configuration tab.
-
In OpenShift Container Platform 4.1, click
From the Actions menu, click Edit Deployment Config (OpenShift Container Platform 4.1) or Edit YAML (OpenShift Container Platform 3.11).
The YAML tab of the Deployment Config opens, with the
.yaml
file in an editable mode.-
Edit the
image
attribute to specify the latest AMQ Broker 7.5 container image,registry.redhat.io/amq7/amq-broker:7.5
. Add the
imagePullSecrets
attribute to specify the image pull secret associated with the account used for authentication in the Red Hat Container Registry.Changes based on the previous two steps are shown in the example below:
... spec: containers: image: 'registry.redhat.io/amq7/amq-broker:7.5' .. imagePullSecrets: - name: {PULL-SECRET-NAME}
NoteIn AMQ Broker, container image tags increment by
1
for each new version of the container image added to the Red Hat image registry, for example, 7.5-1, 7.5-2, and so on. If you specify a tag name without a final digit (7.5
, for example), this tag is known as a floating tag. When you specify a floating tag, OpenShift Container Platform automatically identifies the most recent available image (that is, the image tag with the highest final number) and uses this image to upgrade your broker deployment.Click Save.
If a newer broker image than the one currently installed is available in the Red Hat Container Registry, OpenShift Container Platform upgrades your broker deployment. To do this, OpenShift Container Platform stops the existing broker Pod and then starts a new Pod that uses the new image.
4.2.2. Upgrading persistent broker deployments
This procedure shows you how to upgrade a persistent broker deployment. The persistent broker templates in the OpenShift Container Platform service catalog have labels that resemble the following:
- Red Hat AMQ Broker 7.x (Persistence, clustered, no SSL)
- Red Hat AMQ Broker 7.x (Persistence, clustered, with SSL)
- Red Hat AMQ Broker 7.x (Persistence, with SSL)
Prerequisites
- Starting in AMQ Broker 7.3, you use a new version of the Red Hat Container Registry to access container images. This new version of the registry requires you to become an authenticated user before you can access images and pull them into an OpenShift project. Before following the procedure in this section, you must first complete the steps described in Red Hat Container Registry Authentication.
Procedure
- Navigate to the OpenShift Container Platform web console and log in.
- Click the project in which you want to upgrade a persistent broker deployment.
Select the StatefulSet (SS) corresponding to your broker deployment.
-
In OpenShift Container Platform 4.1, click
. -
In OpenShift Container Platform 3.11, click
.
-
In OpenShift Container Platform 4.1, click
From the Actions menu, click Edit Stateful Set (OpenShift Container Platform 4.1) or Edit YAML (OpenShift Container Platform 3.11).
The YAML tab of the StatefulSet opens, with the
.yaml
file in an editable mode.To prepare your broker deployment for upgrade, scale the deployment down to zero brokers.
-
If the
replicas
attribute is currently set to1
or greater, set it to0
. - Click Save.
-
If the
-
When all broker Pods have shut down, edit the Stateful Set
.yaml
file again. Edit theimage
attribute to specify the latest AMQ Broker 7.5 container image,registry.redhat.io/amq7/amq-broker:7.5
. Add the
imagePullSecrets
attribute to specify the image pull secret associated with the account used for authentication in the Red Hat Container Registry.Changes based on the previous two steps are shown in the example below:
... spec: containers: image: 'registry.redhat.io/amq7/amq-broker:7.5' .. imagePullSecrets: - name: {PULL-SECRET-NAME}
-
Set the
replicas
attribute back to the original value. Click Save.
If a newer broker image than the one currently installed is available in the Red Hat Container Registry, OpenShift Container Platform upgrades your broker deployment. To do this, OpenShift Container Platform restarts the broker Pod.