Skip to content

Commit 4e68de4

Browse files
committed
refactor(tekton): remove mcpi install pipeline code
1 parent 180cce1 commit 4e68de4

5 files changed

Lines changed: 0 additions & 495 deletions

File tree

‎src/mas/devops/tekton.py‎

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -843,83 +843,6 @@ def prepareAiServicePipelinesNamespace(
843843
logger.info(f"Storage class {storageClass} uses volumeBindingMode={volumeBindingMode}, skipping PVC bind wait")
844844

845845

846-
def prepareMcpiPipelinesNamespace(
847-
dynClient: DynamicClient,
848-
instanceId: str = None,
849-
storageClass: str = None,
850-
accessMode: str = None,
851-
waitForBind: bool = True,
852-
configureRBAC: bool = True,
853-
):
854-
"""
855-
Prepare a namespace for MCPI pipelines by creating RBAC and PVC resources.
856-
857-
Creates MCPI-specific pipeline namespace with necessary role bindings
858-
and persistent volume claims.
859-
860-
Args:
861-
dynClient (DynamicClient): OpenShift Dynamic Client
862-
instanceId (str, optional): MCPI instance ID. Defaults to None.
863-
storageClass (str, optional): Storage class for the PVC. Defaults to None.
864-
accessMode (str, optional): Access mode for the PVC. Defaults to None.
865-
waitForBind (bool, optional): Whether to wait for PVC to bind. Defaults to True.
866-
configureRBAC (bool, optional): Whether to configure RBAC. Defaults to True.
867-
868-
Raises:
869-
NotFoundError: If resources cannot be created
870-
"""
871-
templateDir = path.join(path.abspath(path.dirname(__file__)), "templates")
872-
env = Environment(loader=FileSystemLoader(searchpath=templateDir))
873-
namespace = f"mcpi-{instanceId}-pipelines"
874-
template = env.get_template("mcpi-pipelines-rbac.yml.j2")
875-
876-
if configureRBAC:
877-
renderedTemplate = template.render(mcpi_instance_id=instanceId)
878-
logger.debug(renderedTemplate)
879-
crb = yaml.safe_load(renderedTemplate)
880-
applyResource(
881-
dynClient=dynClient,
882-
apiVersion="rbac.authorization.k8s.io/v1",
883-
kind="ClusterRoleBinding",
884-
body=crb,
885-
namespace=namespace,
886-
)
887-
888-
template = env.get_template("mcpi-pipelines-pvc.yml.j2")
889-
renderedTemplate = template.render(
890-
mcpi_instance_id=instanceId,
891-
pipeline_storage_class=storageClass,
892-
pipeline_storage_accessmode=accessMode,
893-
)
894-
logger.debug(renderedTemplate)
895-
pvc = yaml.safe_load(renderedTemplate)
896-
pvcAPI = dynClient.resources.get(api_version="v1", kind="PersistentVolumeClaim")
897-
applyResource(
898-
dynClient=dynClient,
899-
apiVersion="v1",
900-
kind="PersistentVolumeClaim",
901-
body=pvc,
902-
namespace=namespace,
903-
)
904-
905-
volumeBindingMode = getStorageClassVolumeBindingMode(dynClient, storageClass)
906-
waitForBind = volumeBindingMode == "Immediate"
907-
908-
if waitForBind:
909-
logger.info(f"Storage class {storageClass} uses volumeBindingMode={volumeBindingMode}, waiting for PVC to bind")
910-
pvcIsBound = False
911-
while not pvcIsBound:
912-
configPVC = pvcAPI.get(name="config-pvc", namespace=namespace)
913-
if configPVC.status.phase == "Bound":
914-
pvcIsBound = True
915-
else:
916-
logger.debug("Waiting 15s before checking status of PVC again")
917-
logger.debug(configPVC)
918-
sleep(15)
919-
else:
920-
logger.info(f"Storage class {storageClass} uses volumeBindingMode={volumeBindingMode}, skipping PVC bind wait")
921-
922-
923846
def prepareRestoreSecrets(
924847
dynClient: DynamicClient,
925848
namespace: str,
@@ -1607,26 +1530,6 @@ def launchInstallPipeline(dynClient: DynamicClient, params: dict) -> str:
16071530
return pipelineURL
16081531

16091532

1610-
def launchMcpiInstallPipeline(dynClient: DynamicClient, params: dict) -> str:
1611-
"""
1612-
Create a PipelineRun to install an MCPI instance.
1613-
1614-
Args:
1615-
dynClient (DynamicClient): OpenShift Dynamic Client
1616-
params (dict): Installation parameters including mas_instance_id and mcpi_channel
1617-
1618-
Returns:
1619-
str: URL to the PipelineRun in the OpenShift console
1620-
1621-
Raises:
1622-
NotFoundError: If resources cannot be created
1623-
"""
1624-
instanceId = params["mas_instance_id"]
1625-
namespace = f"mcpi-{instanceId}-pipelines"
1626-
timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-mcpi-install", params)
1627-
return f"{getConsoleURL(dynClient)}/k8s/ns/mcpi-{instanceId}-pipelines/tekton.dev~v1beta1~PipelineRun/{instanceId}-install-{timestamp}"
1628-
1629-
16301533
def launchUpdatePipeline(dynClient: DynamicClient, params: dict) -> str:
16311534
"""
16321535
Create a PipelineRun to update the Maximo Operator Catalog.

‎src/mas/devops/templates/mcpi-pipelines-pvc.yml.j2‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎src/mas/devops/templates/mcpi-pipelines-rbac.yml.j2‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/mas/devops/templates/pipelinerun-mcpi-install.yml.j2‎

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)