|
22 | 22 |
|
23 | 23 | from jinja2 import Environment, FileSystemLoader |
24 | 24 |
|
25 | | -from .ocp import getConsoleURL, waitForCRD, waitForDeployment, crdExists |
| 25 | +from .ocp import getConsoleURL, waitForCRD, waitForDeployment, waitForPVC, patchPendingPVC, crdExists |
26 | 26 |
|
27 | 27 | logger = logging.getLogger(__name__) |
28 | 28 |
|
@@ -79,11 +79,27 @@ def installOpenShiftPipelines(dynClient: DynamicClient) -> bool: |
79 | 79 | foundReadyWebhook = waitForDeployment(dynClient, namespace="openshift-pipelines", deploymentName="tekton-pipelines-webhook") |
80 | 80 | if foundReadyWebhook: |
81 | 81 | logger.info("OpenShift Pipelines Webhook is installed and ready") |
82 | | - return True |
83 | 82 | else: |
84 | 83 | logger.error("OpenShift Pipelines Webhook is NOT installed and ready") |
85 | 84 | return False |
86 | 85 |
|
| 86 | + # Wait for the postgredb-tekton-results-postgres-0 PVC to be ready |
| 87 | + # this PVC doesn't come up when there's no default storage class is in the cluster, |
| 88 | + # this is causing the pvc to be in pending state and causing the tekton-results-postgres statefulSet in pending, |
| 89 | + # due to these resources not coming up, the MAS pre-install check in the pipeline times out checking the health of this statefulSet, |
| 90 | + # causing failure in pipeline. |
| 91 | + # Refer https://github.com/ibm-mas/cli/issues/1511 |
| 92 | + logger.debug("Waiting for postgredb-tekton-results-postgres-0 PVC to be ready") |
| 93 | + foundReadyPVC = waitForPVC(dynClient, namespace="openshift-pipelines", pvcName="postgredb-tekton-results-postgres-0") |
| 94 | + if foundReadyPVC: |
| 95 | + logger.info("OpenShift Pipelines postgres is installed and ready") |
| 96 | + else: |
| 97 | + patchedPVC = patchPVC(dynClient, namespace="openshift-pipelines", pvcName="postgredb-tekton-results-postgres-0") |
| 98 | + if patchPVC: |
| 99 | + logger.info("OpenShift Pipelines postgres is installed and ready") |
| 100 | + else: |
| 101 | + logger.error("OpenShift Pipelines postgres PVC is NOT ready") |
| 102 | + |
87 | 103 |
|
88 | 104 | def updateTektonDefinitions(namespace: str, yamlFile: str) -> None: |
89 | 105 | """ |
|
0 commit comments