Skip to content

Commit 3499057

Browse files
Merge pull request #47 from ibm-messaging/9.3.3
Updates for 9.3.3 and sample for K8s upgrade PDB
2 parents cc8b1e9 + 7b1f0dd commit 3499057

File tree

8 files changed

+152
-17
lines changed

8 files changed

+152
-17
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# IBM MQ Sample Helm Chart
2-
This repository provides a helm chart to deploy an IBM® MQ container built from the [IBM MQ Container GitHub repository](https://github.com/ibm-messaging/mq-container), and has been verified against the [9.3.2 branch](https://github.com/ibm-messaging/mq-container/tree/9.3.2).
2+
This repository provides a helm chart to deploy an IBM® MQ container built from the [IBM MQ Container GitHub repository](https://github.com/ibm-messaging/mq-container), and has been verified against the [9.3.3 branch](https://github.com/ibm-messaging/mq-container/tree/9.3.3).
33

44
## Pre-reqs
55
Prior to using the Helm chart you will need to install two dependencies:

charts/ibm-mq/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
apiVersion: v2
1515
name: ibm-mq
1616
description: IBM MQ queue manager
17-
version: 6.0.0
17+
version: 7.0.0
1818
type: application
19-
appVersion: 9.3.2.0
19+
appVersion: 9.3.3.0
2020
kubeVersion: ">=1.18.0-0"
2121
keywords:
2222
- IBM MQ

charts/ibm-mq/README.md

+28-11
Large diffs are not rendered by default.

charts/ibm-mq/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ image:
1919
# repository is the container repository to use
2020
repository: icr.io/ibm-messaging/mq
2121
# tag is the tag to use for the container repository
22-
tag: 9.3.2.0-r1
22+
tag: 9.3.3.0-r1
2323
# pullSecret is the secret to use when pulling the image from a private registry
2424
pullSecret:
2525
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)

samples/OpenShiftIBMPower/deploy/ibmpower.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
license: accept
1515
image:
1616
repository: cp.icr.io/cp/ibm-mqadvanced-server
17-
tag: 9.3.2.0-r1-ppc64le
17+
tag: 9.3.3.0-r1-ppc64le
1818
pullSecret: ibm-entitlement-key
1919
queueManager:
2020
mqscConfigMaps:

samples/OpenShiftNativeHAMQAdvancedContainer/deploy/secureapp_nativeha.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
image:
1515
repository: cp.icr.io/cp/ibm-mqadvanced-server
16-
tag: 9.3.2.0-r1-amd64
16+
tag: 9.3.3.0-r1-amd64
1717
pullSecret: ibm-entitlement-key
1818
license: accept
1919
queueManager:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash
2+
# © Copyright IBM Corporation 2023
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
NAMESPACE=${1:-"default"}
17+
DEBUG=true
18+
19+
function line_separator () {
20+
echo "####################### $1 #######################"
21+
}
22+
23+
function checkForUnschedulableNodes() {
24+
line_separator "Checking for unschedulable nodes"
25+
UNSCHEDULED_NODE_STRING=$(kubectl get nodes -o=jsonpath='{.items[?(@.spec.unschedulable==true)].metadata.name}')
26+
if [ -z "$UNSCHEDULED_NODE_STRING" ]
27+
then
28+
$DEBUG && echo "[DEBUG] No nodes found"
29+
NODE_ARRAY=''
30+
return
31+
else
32+
$DEBUG && echo "[DEBUG] Found these nodes '$UNSCHEDULED_NODE_STRING'"
33+
NODE_ARRAY=("$UNSCHEDULED_NODE_STRING")
34+
fi
35+
}
36+
37+
function findMQPodsOnNode(){
38+
TARGET_NODE=$1
39+
line_separator "Finding MQ Pods on $TARGET_NODE"
40+
MQ_PODS=$(kubectl get pods --field-selector spec.nodeName="$TARGET_NODE" -n "$NAMESPACE" -l app.kubernetes.io/name=ibm-mq -o jsonpath='{.items[*].metadata.name}')
41+
if [ -z "$MQ_PODS" ]
42+
then
43+
$DEBUG && echo "[DEBUG] No MQ pods found"
44+
return
45+
else
46+
$DEBUG && echo "[DEBUG] Found these pods '$MQ_PODS'"
47+
DELETE_POD=false
48+
MQ_PODS_ARRAY=("$MQ_PODS")
49+
for i in "${MQ_PODS_ARRAY[@]}"
50+
do
51+
$DEBUG && echo "[DEBUG] Checking if '$i' has quorum"
52+
QMGR_STATUS=$(kubectl exec "$i" -n "$NAMESPACE" -- dspmq -o nativeha)
53+
QUORUM_STATUS=${QMGR_STATUS#*QUORUM(}
54+
RUNNING_CONTAINERS=${QUORUM_STATUS%%/*}
55+
$DEBUG && echo "[DEBUG] '$i' has a quorum status of '$RUNNING_CONTAINERS'"
56+
QMGR_CONNECTIONS=$(kubectl exec "$i" -n "$NAMESPACE" -- dspmq -o nativeha -x | grep -c "CONNACTV(yes)" )
57+
$DEBUG && echo "[DEBUG] '$i' has active connections to '$QMGR_CONNECTIONS' instances"
58+
if [ "$RUNNING_CONTAINERS" -eq 3 ] && [ "$QMGR_CONNECTIONS" -eq 3 ]
59+
then
60+
$DEBUG && echo "[DEBUG] Queue Manager has $RUNNING_CONTAINERS containers so safe to delete one instance"
61+
DELETE_RESPONSE=$(kubectl delete pod "$i" -n "$NAMESPACE")
62+
$DEBUG && echo "[DEBUG] Pod delete response: $DELETE_RESPONSE"
63+
DELETE_POD=true
64+
else
65+
$DEBUG && echo "[DEBUG] Unsafe to delete Pod - doing nothing and will auto-retry during the next loop"
66+
fi
67+
done
68+
fi
69+
70+
if [ $DELETE_POD = "true" ]
71+
then
72+
$DEBUG && echo "[DEBUG] Deleted pods on worker node so sleeping for 10 seconds for quorum status to correct"
73+
sleep 10
74+
else
75+
$DEBUG && echo "[DEBUG] No pods deleted"
76+
fi
77+
}
78+
79+
while true
80+
do
81+
echo ""
82+
line_separator "Starting check"
83+
84+
checkForUnschedulableNodes
85+
if [ -n "$NODE_ARRAY" ]
86+
then
87+
for node_item in "${NODE_ARRAY[@]}"
88+
do
89+
$DEBUG && echo "[DEBUG] Processing node '$node_item'"
90+
findMQPodsOnNode "$node_item"
91+
done
92+
fi
93+
echo ""
94+
sleep 30
95+
done
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# © Copyright IBM Corporation 2023
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
apiVersion: policy/v1
15+
kind: PodDisruptionBudget
16+
metadata:
17+
name: mqnativeha-pdb
18+
spec:
19+
maxUnavailable: 1
20+
selector:
21+
matchLabels:
22+
app.kubernetes.io/instance: secureapphelm
23+
app.kubernetes.io/name: ibm-mq

0 commit comments

Comments
 (0)