Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions python/src/mas/cli/uninstall/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,25 @@ 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
uninstallCertManager = True
uninstallDRO = True
uninstallMongoDb = True
uninstallSLS = True
uninstallCp4d = True
else:
uninstallGrafana = args.uninstall_grafana
uninstallIBMCatalog = args.uninstall_ibm_catalog
uninstallCertManager = args.uninstall_cert_manager
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")
Expand Down Expand Up @@ -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")
Expand All @@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down
19 changes: 19 additions & 0 deletions python/src/mas/cli/uninstall/argParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions tekton/generate-tekton-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- cp4d-service
- cp4d-service-update
- cp4d
- cp4d-uninstall
- db2
- dro
- eck
Expand Down
40 changes: 39 additions & 1 deletion tekton/src/pipelines/mas-uninstall.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -274,7 +286,33 @@ spec:
value: suite-uninstall


# 4. Uninstall IBM Suite Licensing Service
# 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:
{{ 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:
- waitfor-approval


# 5. Uninstall IBM Suite Licensing Service
# -------------------------------------------------------------------------
- name: uninstall-sls
timeout: "0"
Expand Down
48 changes: 48 additions & 0 deletions tekton/src/tasks/dependencies/cp4d-uninstall.yml.j2
Original file line number Diff line number Diff line change
@@ -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)
Loading