Skip to content

Commit 28b007c

Browse files
dureraSanjay Prabhakaranilprajapatiibmparveenkumaribm
authored
[minor] Support for May catalog update (#71)
Co-authored-by: Sanjay Prabhakar <[email protected]> Co-authored-by: Anil Prajapati <[email protected]> Co-authored-by: Parveen Kumar <[email protected]> Co-authored-by: Anil Prajapati <[email protected]>
1 parent dde1504 commit 28b007c

File tree

6 files changed

+239
-7
lines changed

6 files changed

+239
-7
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
# Case bundle configuration for IBM Maximo Operator Catalog 250501
3+
# -----------------------------------------------------------------------------
4+
# In the future this won't be necessary as we'll be able to mirror from the
5+
# catalog itself, but not everything in the catalog supports this yet (including MAS)
6+
# so we need to use the CASE bundle mirror process still.
7+
8+
catalog_digest: sha256:5121d783b8f59d35d32d6bf6cdbfe63f79b81f7f330016d07d5b58609171ccab
9+
10+
# Dependencies
11+
# -----------------------------------------------------------------------------
12+
ibm_licensing_version: 4.2.12 # Operator version 4.2.11 (https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-licensing)
13+
common_svcs_version: 4.10.0 # check once why we have 4.3.0 in all previous versions since so long it's 4.3.0 # Operator version 4.3.1 (https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-cp-common-services)
14+
15+
cp4d_platform_version: 5.1.0 #+20240716.101015 # Operator version 5.0.0 (https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-cp-datacore/4.0.0%2B20231213.115030)
16+
17+
ibm_zen_version: 6.1.0+20241120.004836.207 # For CPD5 ibm-zen has to be explicitily mirrored
18+
19+
db2u_version: 6.0.1+20240704.142950.9960 # Operator version 110509.0.2 to find the version 6.0.1, search CASE_VERSION in db2u, catalog.yaml into ibm-maximo-operator-catalog (https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-db2uoperator)
20+
events_version: 5.0.1 # Operator version 5.0.1 (https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-events-operator)
21+
uds_version: 2.0.12 # Operator version 2.0.12 # sticking to 2.0.12 version # Please do Not Change
22+
sls_version: 3.11.1 # tbc # Operator version 3.10.0 (https://github.ibm.com/maximoappsuite/ibm-sls/releases)
23+
tsm_version: 1.6.2 # tbc # Operator version 1.5.4 (https://github.ibm.com/maximoappsuite/ibm-truststore-mgr/releases)
24+
dd_version: 1.1.18 # tbc # Operator version 1.1.14 (https://github.ibm.com/maximoappsuite/ibm-data-dictionary/releases)
25+
appconnect_version: 6.2.0 # Operator version 6.2.0 # sticking to 6.2.0 version # Please do Not Change
26+
wsl_version: 10.0.0
27+
wml_version: 10.0.0
28+
# ccs_build: +20240528.144404.460 # ibm-ccs from version 9.0.0 requires the build version
29+
# datarefinery_build: +20240517.202103.146
30+
spark_version: 10.0.0 # Operator version 5.0.0
31+
cognos_version: 27.0.0 # Operator version 25.0.0
32+
couchdb_version: 1.0.13 # Operator version 2.2.1 (This is required for Assist 9.0, https://github.com/IBM/cloud-pak/blob/master/repo/case/ibm-couchdb/index.yaml)
33+
elasticsearch_version: 1.1.2570 # Operator version 1.1.2470
34+
35+
36+
# Maximo Application Suite
37+
# -----------------------------------------------------------------------------
38+
mas_core_version:
39+
9.1.x-feature: 9.1.0-pre.stable_9718 # No Update
40+
9.0.x: 9.0.11 # tbc
41+
8.10.x: 8.10.25 # tbc
42+
8.11.x: 8.11.22 # tbc
43+
mas_assist_version:
44+
9.0.x: 9.0.5 # No Update
45+
8.10.x: 8.7.8 # No Update
46+
8.11.x: 8.8.7 # No Update
47+
mas_hputilities_version:
48+
9.0.x: "" # Not Supported
49+
8.10.x: 8.6.7 # tbc
50+
8.11.x: "" # Not Supported
51+
mas_iot_version:
52+
9.0.x: 9.0.8 # tbc
53+
8.10.x: 8.7.22 # tbc
54+
8.11.x: 8.8.18 # tbc
55+
mas_manage_version:
56+
9.1.x-feature: 9.1.0-pre.stable_10993 # No Update
57+
9.0.x: 9.0.13 # tbc
58+
8.10.x: 8.6.26 # tbc
59+
8.11.x: 8.7.20 # tbc
60+
mas_monitor_version:
61+
9.0.x: 9.0.9 # tbc
62+
8.10.x: 8.10.19 # tbc
63+
8.11.x: 8.11.17 # tbc
64+
mas_optimizer_version:
65+
9.1.x-feature: 9.1.0-pre.stable_1943 # No Update
66+
9.0.x: 9.0.10 # tbc
67+
8.10.x: 8.4.17 # tbc
68+
8.11.x: 8.5.16 # tbc
69+
mas_predict_version:
70+
9.0.x: 9.0.7 # tbc
71+
8.10.x: 8.8.8 # tbc
72+
8.11.x: 8.9.10 # tbc
73+
mas_visualinspection_version:
74+
9.1.x-feature: 9.1.0-pre.stable_2405 # No Update
75+
9.0.x: 9.0.9 # tbc
76+
8.10.x: 8.8.4 # No Update
77+
8.11.x: 8.9.12 # tbc
78+
79+
# Extra Images for UDS
80+
# ------------------------------------------------------------------------------
81+
uds_extras_version: 1.5.0
82+
83+
# Extra Images for Mongo
84+
# ------------------------------------------------------------------------------
85+
mongo_extras_version_default: 7.0.12
86+
87+
# Variables used to mirror additional mongo image versions
88+
mongo_extras_version_4: 4.4.21
89+
mongo_extras_version_5: 5.0.23
90+
mongo_extras_version_6: 6.0.12
91+
mongo_extras_version_7: 7.0.12
92+
93+
# Extra Images for Db2u
94+
# ------------------------------------------------------------------------------
95+
db2u_extras_version: 1.0.6 # No Update
96+
db2u_filter: db2
97+
98+
# Extra Images for IBM Watson Discovery
99+
# ------------------------------------------------------------------------------
100+
#wd_extras_version: 1.0.4
101+
102+
# Extra Images for Amlen
103+
# ------------------------------------------------------------------------------
104+
amlen_extras_version: 1.1.2
105+
106+
# Default Cloud Pak for Data version
107+
# ------------------------------------------------------------------------------
108+
cpd_product_version_default: 5.1.0
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# Case bundle configuration for IBM Maximo Operator Catalog 250501
3+
# -----------------------------------------------------------------------------
4+
# In the future this won't be necessary as we'll be able to mirror from the
5+
# catalog itself, but not everything in the catalog supports this yet (including MAS)
6+
# so we need to use the CASE bundle mirror process still.
7+
8+
catalog_digest: sha256:101f126494d4840f7cda7aa87b30d49aafd9abf736d455bf65597f0b35b1c070
9+
10+
uds_version: 2.0.12 # Operator version 2.0.12 # sticking to 2.0.12 version # Please do Not Change
11+
sls_version: 3.11.1 # tbc # Operator version 3.10.0 (https://github.ibm.com/maximoappsuite/ibm-sls/releases)
12+
tsm_version: 1.6.2 # No Update # Operator version 1.5.4 (https://github.ibm.com/maximoappsuite/ibm-truststore-mgr/releases)
13+
14+
15+
# Maximo Application Suite
16+
# -----------------------------------------------------------------------------
17+
mas_core_version:
18+
9.1.x-feature: 9.1.0-pre.stable_9718 # tbc
19+
9.0.x: 9.0.11 # tbc
20+
8.10.x: "" # Not Supported
21+
8.11.x: "" # Not Supported
22+
mas_manage_version:
23+
9.1.x-feature: 9.1.0-pre.stable_10993 # tbc
24+
9.0.x: 9.0.13 # tbc
25+
8.10.x: "" # Not Supported
26+
8.11.x: "" # Not Supported
27+
28+
# Extra Images for UDS
29+
# ------------------------------------------------------------------------------
30+
uds_extras_version: 1.5.0
31+
32+
# Extra Images for Mongo
33+
# ------------------------------------------------------------------------------
34+
mongo_extras_version_default: 7.0.12
35+
36+
# Variables used to mirror additional mongo image versions
37+
mongo_extras_version_4: 4.4.21
38+
mongo_extras_version_5: 5.0.23
39+
mongo_extras_version_6: 6.0.12
40+
mongo_extras_version_7: 7.0.12

src/mas/devops/mas.py

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import re
1313
import yaml
1414
from os import path
15+
from time import sleep
1516
from types import SimpleNamespace
1617
from kubernetes.dynamic.resource import ResourceInstance
1718
from openshift.dynamic import DynamicClient
@@ -159,8 +160,8 @@ def verifyMasInstance(dynClient: DynamicClient, instanceId: str) -> bool:
159160
except ResourceNotFoundError:
160161
# The MAS Suite CRD has not even been installed in the cluster
161162
return False
162-
except UnauthorizedError:
163-
logger.error("Error: Unable to verify MAS instance due to failed authorization: {e}")
163+
except UnauthorizedError as e:
164+
logger.error(f"Error: Unable to verify MAS instance due to failed authorization: {e}")
164165
return False
165166

166167

@@ -243,3 +244,64 @@ def updateIBMEntitlementKey(dynClient: DynamicClient, namespace: str, icrUsernam
243244

244245
secret = secretsAPI.apply(body=secret, namespace=namespace)
245246
return secret
247+
248+
249+
def waitForPVC(dynClient: DynamicClient, namespace: str, pvcName: str) -> bool:
250+
pvcAPI = dynClient.resources.get(api_version="v1", kind="PersistentVolumeClaim")
251+
maxRetries = 60
252+
foundReadyPVC = False
253+
retries = 0
254+
while not foundReadyPVC and retries < maxRetries:
255+
retries += 1
256+
try:
257+
pvc = pvcAPI.get(name=pvcName, namespace=namespace)
258+
if pvc.status.phase == "Bound":
259+
foundReadyPVC = True
260+
else:
261+
logger.debug(f"Waiting 5s for PVC {pvcName} to be ready before checking again ...")
262+
sleep(5)
263+
except NotFoundError:
264+
logger.debug(f"Waiting 5s for PVC {pvcName} to be created before checking again ...")
265+
sleep(5)
266+
267+
return foundReadyPVC
268+
269+
270+
def patchPendingPVC(dynClient: DynamicClient, namespace: str, pvcName: str, storageClassName: str = None) -> bool:
271+
pvcAPI = dynClient.resources.get(api_version="v1", kind="PersistentVolumeClaim")
272+
try:
273+
pvc = pvcAPI.get(name=pvcName, namespace=namespace)
274+
if pvc.status.phase == "Pending" and pvc.spec.storageClassName is None:
275+
if storageClassName is not None and storageClassName(dynClient, name=storageClassName) is not None:
276+
pvc.spec.storageClassName = storageClassName
277+
else:
278+
defaultStorageClasses = getDefaultStorageClasses(dynClient)
279+
if defaultStorageClasses.provider is not None:
280+
pvc.spec.storageClassName = defaultStorageClasses.rwo
281+
else:
282+
logger.error(f"Unable to set storageClassName in PVC {pvcName}.")
283+
return False
284+
285+
pvcAPI.patch(body=pvc, namespace=namespace)
286+
287+
maxRetries = 60
288+
foundReadyPVC = False
289+
retries = 0
290+
while not foundReadyPVC and retries < maxRetries:
291+
retries += 1
292+
try:
293+
patchedPVC = pvcAPI.get(name=pvcName, namespace=namespace)
294+
if patchedPVC.status.phase == "Bound":
295+
foundReadyPVC = True
296+
else:
297+
logger.debug(f"Waiting 5s for PVC {pvcName} to be bound before checking again ...")
298+
sleep(5)
299+
except NotFoundError:
300+
logger.error(f"The patched PVC {pvcName} does not exist.")
301+
return False
302+
303+
return foundReadyPVC
304+
305+
except NotFoundError:
306+
logger.error(f"PVC {pvcName} does not exist")
307+
return False

src/mas/devops/ocp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def waitForDeployment(dynClient: DynamicClient, namespace: str, deploymentName:
150150
# NoneType and int comparison TypeError
151151
foundReadyDeployment = True
152152
else:
153-
logger.debug("Waiting 5s for deployment {deploymentName} to be ready before checking again ...")
153+
logger.debug(f"Waiting 5s for deployment {deploymentName} to be ready before checking again ...")
154154
sleep(5)
155155
except NotFoundError:
156-
logger.debug("Waiting 5s for deployment {deploymentName} to be created before checking again ...")
156+
logger.debug(f"Waiting 5s for deployment {deploymentName} to be created before checking again ...")
157157
sleep(5)
158158
return foundReadyDeployment
159159

src/mas/devops/tekton.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
from jinja2 import Environment, FileSystemLoader
2424

2525
from .ocp import getConsoleURL, waitForCRD, waitForDeployment, crdExists
26+
from .mas import waitForPVC, patchPendingPVC
2627

2728
logger = logging.getLogger(__name__)
2829

2930

30-
def installOpenShiftPipelines(dynClient: DynamicClient) -> bool:
31+
# customStorageClassName is used when no default Storageclass is available on cluster,
32+
# openshift-pipelines creates PVC which looks for default. customStorageClassName is patched into PVC when default is unavailable.
33+
def installOpenShiftPipelines(dynClient: DynamicClient, customStorageClassName: str = None) -> bool:
3134
"""
3235
Install the OpenShift Pipelines Operator and wait for it to be ready to use
3336
"""
@@ -79,11 +82,30 @@ def installOpenShiftPipelines(dynClient: DynamicClient) -> bool:
7982
foundReadyWebhook = waitForDeployment(dynClient, namespace="openshift-pipelines", deploymentName="tekton-pipelines-webhook")
8083
if foundReadyWebhook:
8184
logger.info("OpenShift Pipelines Webhook is installed and ready")
82-
return True
8385
else:
8486
logger.error("OpenShift Pipelines Webhook is NOT installed and ready")
8587
return False
8688

89+
# Wait for the postgredb-tekton-results-postgres-0 PVC to be ready
90+
# this PVC doesn't come up when there's no default storage class is in the cluster,
91+
# this is causing the pvc to be in pending state and causing the tekton-results-postgres statefulSet in pending,
92+
# due to these resources not coming up, the MAS pre-install check in the pipeline times out checking the health of this statefulSet,
93+
# causing failure in pipeline.
94+
# Refer https://github.com/ibm-mas/cli/issues/1511
95+
logger.debug("Waiting for postgredb-tekton-results-postgres-0 PVC to be ready")
96+
foundReadyPVC = waitForPVC(dynClient, namespace="openshift-pipelines", pvcName="postgredb-tekton-results-postgres-0")
97+
if foundReadyPVC:
98+
logger.info("OpenShift Pipelines postgres is installed and ready")
99+
return True
100+
else:
101+
patchedPVC = patchPendingPVC(dynClient, namespace="openshift-pipelines", pvcName="postgredb-tekton-results-postgres-0", storageClassName=customStorageClassName)
102+
if patchedPVC:
103+
logger.info("OpenShift Pipelines postgres is installed and ready")
104+
return True
105+
else:
106+
logger.error("OpenShift Pipelines postgres PVC is NOT ready")
107+
return False
108+
87109

88110
def updateTektonDefinitions(namespace: str, yamlFile: str) -> None:
89111
"""

test/src/test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_list_catalogs():
2626
def test_get_newest_catalog_tag():
2727
catalogTag = getNewestCatalogTag("amd64")
2828
# Reminder: update this test when adding a new catalog each month!
29-
assert catalogTag == "v9-250403-amd64"
29+
assert catalogTag == "v9-250501-amd64"
3030

3131

3232
def test_get_newest_catalog_tag_fail():

0 commit comments

Comments
 (0)