From 0cc0e74bf55be6dd67bf3689a4fe63efbc0913a3 Mon Sep 17 00:00:00 2001 From: Prajesh Jain Date: Wed, 22 Jul 2026 11:43:46 +0530 Subject: [PATCH 1/4] [minor] add cp4d_uninstall role to uninstall pipeline --- python/src/mas/cli/uninstall/app.py | 11 +++++ python/src/mas/cli/uninstall/argParser.py | 19 ++++++++ tekton/generate-tekton-tasks.yml | 1 + tekton/src/pipelines/mas-uninstall.yml.j2 | 39 ++++++++++++++- .../tasks/dependencies/cp4d-uninstall.yml.j2 | 48 +++++++++++++++++++ 5 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 tekton/src/tasks/dependencies/cp4d-uninstall.yml.j2 diff --git a/python/src/mas/cli/uninstall/app.py b/python/src/mas/cli/uninstall/app.py index 0ac1e15c7df..80192f38b0f 100644 --- a/python/src/mas/cli/uninstall/app.py +++ b/python/src/mas/cli/uninstall/app.py @@ -42,6 +42,9 @@ def uninstall(self, argv): if args.image_pull_policy and args.image_pull_policy != "": self.setParam("image_pull_policy", args.image_pull_policy) + cpdOperatorsNamespace = args.cpd_operators_namespace + cpdInstanceNamespace = args.cpd_instance_namespace + if args.uninstall_all_deps: uninstallGrafana = True uninstallIBMCatalog = True @@ -49,6 +52,7 @@ def uninstall(self, argv): uninstallDRO = True uninstallMongoDb = True uninstallSLS = True + uninstallCp4d = True else: uninstallGrafana = args.uninstall_grafana uninstallIBMCatalog = args.uninstall_ibm_catalog @@ -56,6 +60,7 @@ def uninstall(self, argv): uninstallDRO = args.uninstall_dro uninstallMongoDb = args.uninstall_mongodb uninstallSLS = args.uninstall_sls + uninstallCp4d = args.uninstall_cp4d if instanceId is None: self.printH1("Set Target OpenShift Cluster") @@ -106,6 +111,7 @@ def uninstall(self, argv): uninstallDRO = True uninstallMongoDb = True uninstallSLS = True + uninstallCp4d = True else: self.printDescription(["If you choose to uninstall MongoDb, IBM Suite License Service will be automatically set to uninstall as well"]) uninstallMongoDb = self.yesOrNo("Uninstall MongoDb") @@ -116,6 +122,7 @@ def uninstall(self, argv): uninstallSLS = self.yesOrNo("Uninstall IBM Suite Licensing Service") uninstallGrafana = self.yesOrNo("Uninstall Grafana") + uninstallCp4d = self.yesOrNo("Uninstall Cloud Pak for Data") self.printDescription( [ "If you choose to uninstall the IBM Operator Catalog, IBM Common Services, IBM User Data Services, & IBM Suite License Service will be automatically set to uninstall as well" @@ -158,6 +165,7 @@ def uninstall(self, argv): self.printSummary("Uninstall DRO", uninstallDRO) self.printSummary("Uninstall MongoDb", uninstallMongoDb) self.printSummary("Uninstall SLS", uninstallSLS) + self.printSummary("Uninstall CP4D", uninstallCp4d) if not self.noConfirm: print() @@ -195,6 +203,9 @@ def uninstall(self, argv): uninstallMongoDb=uninstallMongoDb, uninstallSLS=uninstallSLS, droNamespace=droNamespace, + uninstallCp4d=uninstallCp4d, + cpdOperatorsNamespace=cpdOperatorsNamespace, + cpdInstanceNamespace=cpdInstanceNamespace, ) if pipelineURL is not None: h.stop_and_persist(symbol=self.successIcon, text=f"PipelineRun for {instanceId} uninstall submitted") diff --git a/python/src/mas/cli/uninstall/argParser.py b/python/src/mas/cli/uninstall/argParser.py index aac29259a2d..cf2149c4079 100644 --- a/python/src/mas/cli/uninstall/argParser.py +++ b/python/src/mas/cli/uninstall/argParser.py @@ -87,6 +87,25 @@ default=False, help="Uninstall IBM User Data Services from the target cluster", ) +depsArgGroup.add_argument( + "--uninstall-cp4d", + required=False, + action="store_true", + default=False, + help="Uninstall Cloud Pak for Data from the target cluster", +) +depsArgGroup.add_argument( + "--cpd-operators-namespace", + required=False, + default="", + help="CP4D operators namespace (default: ibm-cpd-operators)", +) +depsArgGroup.add_argument( + "--cpd-instance-namespace", + required=False, + default="", + help="CP4D instance namespace (default: ibm-cpd)", +) otherArgGroup = uninstallArgParser.add_argument_group("More") otherArgGroup.add_argument( diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index b7811124616..04acc9b882c 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -29,6 +29,7 @@ - cp4d-service - cp4d-service-update - cp4d + - cp4d-uninstall - db2 - dro - eck diff --git a/tekton/src/pipelines/mas-uninstall.yml.j2 b/tekton/src/pipelines/mas-uninstall.yml.j2 index 24f743a8c49..efd81f2c01b 100644 --- a/tekton/src/pipelines/mas-uninstall.yml.j2 +++ b/tekton/src/pipelines/mas-uninstall.yml.j2 @@ -54,6 +54,18 @@ spec: - name: dro_namespace default: "redhat-marketplace" type: string + - name: cp4d_action + type: string + description: Optional. Used to uninstall CP4D + default: "none" + - name: cpd_operators_namespace + type: string + description: Optional. CP4D operators namespace + default: "" + - name: cpd_instance_namespace + type: string + description: Optional. CP4D instance namespace + default: "" tasks: # Content @@ -274,7 +286,30 @@ spec: value: suite-uninstall - # 4. Uninstall IBM Suite Licensing Service + # 4. Uninstall Cloud Pak for Data + # ------------------------------------------------------------------------- + - name: uninstall-cp4d + timeout: "0" + params: + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/common/cli-params.yml.j2') | indent(8) }} + - name: cpd_operators_namespace + value: $(params.cpd_operators_namespace) + - name: cpd_instance_namespace + value: $(params.cpd_instance_namespace) + - name: devops_suite_name + value: dependencies-cp4d-uninstall + taskRef: + kind: Task + name: mas-devops-cp4d-uninstall + when: + - input: "$(params.cp4d_action)" + operator: in + values: ["uninstall"] + runAfter: + - uninstall-suite + + + # 5. Uninstall IBM Suite Licensing Service # ------------------------------------------------------------------------- - name: uninstall-sls timeout: "0" @@ -292,7 +327,7 @@ spec: operator: in values: ["uninstall"] runAfter: - - uninstall-suite + - uninstall-cp4d # 5. Uninstall MongoDB diff --git a/tekton/src/tasks/dependencies/cp4d-uninstall.yml.j2 b/tekton/src/tasks/dependencies/cp4d-uninstall.yml.j2 new file mode 100644 index 00000000000..dd062e38fb0 --- /dev/null +++ b/tekton/src/tasks/dependencies/cp4d-uninstall.yml.j2 @@ -0,0 +1,48 @@ +--- +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: mas-devops-cp4d-uninstall +spec: + params: + {{ lookup('template', task_src_dir ~ '/common/cli-params.yml.j2') | indent(4) }} + + # CP4D Namespace configuration (Optional, defaults built into Ansible role) + - name: cpd_operators_namespace + type: string + default: "" + - name: cpd_instance_namespace + type: string + default: "" + + # Uninstall options (Optional, defaults built into Ansible role) + - name: cpd_uninstall_delete_pvcs + type: string + default: "" + - name: cpd_uninstall_delete_namespaces + type: string + default: "" + + stepTemplate: + env: + {{ lookup('template', task_src_dir ~ '/common/cli-env.yml.j2') | indent(6) }} + + # Namespace configuration + - name: CPD_OPERATORS_NAMESPACE + value: $(params.cpd_operators_namespace) + - name: CPD_INSTANCE_NAMESPACE + value: $(params.cpd_instance_namespace) + + # Uninstall options + - name: CPD_UNINSTALL_DELETE_PVCS + value: $(params.cpd_uninstall_delete_pvcs) + - name: CPD_UNINSTALL_DELETE_NAMESPACES + value: $(params.cpd_uninstall_delete_namespaces) + + steps: + - name: cp4d-uninstall + command: + - /opt/app-root/src/run-role.sh + - cp4d_uninstall + image: "quay.io/ibmmas/cli:latest" + imagePullPolicy: $(params.image_pull_policy) From cc8dd1a4825927b2a468dd1ab8414503d224c946 Mon Sep 17 00:00:00 2001 From: Prajesh Jain Date: Tue, 28 Jul 2026 19:00:33 +0530 Subject: [PATCH 2/4] [patch] empty commit to trigger cli build From 097f447808efa565dca1642b23fe555149cbe55b Mon Sep 17 00:00:00 2001 From: Prajesh Jain Date: Tue, 28 Jul 2026 19:58:20 +0530 Subject: [PATCH 3/4] [patch] enabled cp4d to run in parallel with uninstall suite --- tekton/src/pipelines/mas-uninstall.yml.j2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tekton/src/pipelines/mas-uninstall.yml.j2 b/tekton/src/pipelines/mas-uninstall.yml.j2 index efd81f2c01b..d00c1f84e24 100644 --- a/tekton/src/pipelines/mas-uninstall.yml.j2 +++ b/tekton/src/pipelines/mas-uninstall.yml.j2 @@ -288,6 +288,9 @@ spec: # 4. Uninstall Cloud Pak for Data # ------------------------------------------------------------------------- + # CP4D is a cluster-level dependency, independent of any MAS instance. + # Runs in parallel with app-uninstall tasks immediately after approval. + # The cp4d_uninstall role safely exits if CP4D is not installed. - name: uninstall-cp4d timeout: "0" params: @@ -306,7 +309,7 @@ spec: operator: in values: ["uninstall"] runAfter: - - uninstall-suite + - waitfor-approval # 5. Uninstall IBM Suite Licensing Service @@ -327,7 +330,7 @@ spec: operator: in values: ["uninstall"] runAfter: - - uninstall-cp4d + - uninstall-suite # 5. Uninstall MongoDB From c774642c87c4a1339b2e7e5451f9c4754fbf48a5 Mon Sep 17 00:00:00 2001 From: Prajesh Jain Date: Thu, 30 Jul 2026 13:34:33 +0530 Subject: [PATCH 4/4] [patch] trigger cli build