Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Clean up remnants of manual upgrade support #1123

Merged
merged 1 commit into from
Dec 1, 2023
Merged
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
8 changes: 1 addition & 7 deletions ibm/mas_devops/roles/convert_to_olm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The instance ID of Maximo Application Suite. This will be used to lookup for app
- Environment Variable: `MAS_INSTANCE_ID`
- Default: None

### mas_catalog_source
### mas_catalog_source
Defines the catalog to be used to install MAS channel subscription.

- Optional
Expand Down Expand Up @@ -62,12 +62,6 @@ Username for entitled registry. This username will be used to create the image p
- Environment Variable: `MAS_ENTITLEMENT_KEY`
- Default: None

### mas_upgrade_strategy
The Upgrade strategy for MAS Operator.

- Optional
- Environment Variable: `MAS_UPGRADE_STRATEGY`
- Default: `Manual`

Example Playbook
----------------
Expand Down
1 change: 0 additions & 1 deletion ibm/mas_devops/roles/convert_to_olm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
mas_instance_id: "{{ lookup('ansible.builtin.env', 'MAS_INSTANCE_ID') }}"
mas_app_id: "{{ lookup('ansible.builtin.env', 'MAS_APP_ID') }}"

mas_upgrade_strategy: "{{ lookup('ansible.builtin.env', 'MAS_UPGRADE_STRATEGY') | default('Manual', true) }}"
mas_catalog_source: "{{ lookup('ansible.builtin.env', 'MAS_CATALOG_SOURCE') | default('ibm-operator-catalog', true) }}"

mas_app_namespace: "mas-{{ mas_instance_id }}-{{ mas_app_id }}"
Expand Down
52 changes: 1 addition & 51 deletions ibm/mas_devops/roles/convert_to_olm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
- "MAS Instance ID ........ '{{ mas_instance_id }}'"
- "MAS App ID ............. '{{ mas_app_id }}'"
- "MAS App Namespace ...... '{{ mas_app_namespace }}'"
- "MAS Upgrade Strategy ... '{{ mas_upgrade_strategy }}'"

# 2. Check App and Determine if OLM conversion is possible
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -360,56 +359,7 @@
operator_group: "{{ lookup('template', 'templates/operator-group.yml.j2') }}"
subscription: "{{ lookup('template', 'templates/subscription.yml.j2') }}"

# 3.5. Approve InstallPlan(s) when in Manual subscription
# -------------------------------------------------------------------------
- name: "Lookup and Approve Subscription: {{ supported_apps[mas_app_id]['name'] }}"
when: mas_upgrade_strategy == 'Manual'
block:
- name: Lookup Operator install plan
kubernetes.core.k8s_info:
api_version: operators.coreos.com/v1alpha1
kind: InstallPlan
namespace: "{{ mas_app_namespace }}"
label_selectors:
- "operators.coreos.com/{{ supported_apps[mas_app_id]['csv_name'] }}.{{ mas_app_namespace }}"
register: _mas_install_plan
retries: 40
delay: 30 # 40 x 30 seconds = 20 minutes
until: _mas_install_plan.resources | length > 0

- name: Approve the subscription install plan
when:
- _mas_install_plan is defined
- _mas_install_plan.resources is defined
- _mas_install_plan.resources | length > 0
- _mas_install_plan.resources[0].status is defined
- _mas_install_plan.resources[0].status.phase is defined
- _mas_install_plan.resources[0].status.phase != "Complete"
kubernetes.core.k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: InstallPlan
metadata:
name: "{{ _mas_install_plan.resources[0].metadata.name }}"
namespace: "{{ mas_app_namespace }}"
spec:
approved: true

# 3.6. Handle IBM Common Services Install plan approvals when
# upgrade strategy is set to Manual
# -------------------------------------------------------------------------
# ibm-common-services operators deployed by MAS will inherit the inherit
# MAS upgrade strategy when its set to Manual, we need to iterate those to
# ensure we do approve the first install plan otherwise MAS installation
# won't succeed.
- name: Handle IBM Common Services InstallPlan approvals
ansible.builtin.include_tasks: tasks/ibm-common-services.yml
when:
- mas_upgrade_strategy == 'Manual'
- mas_app_id == 'core'
loop: "{{ ibm_common_services_subscription_labels }}"

# 3.7. Verify the (main + TM) operator pods are running and ready
# 3.5. Verify the (main + TM) operator pods are running and ready
# -------------------------------------------------------------------------
- name: "Check if operator is ready: {{ supported_apps[mas_app_id]['op_name'] }}"
kubernetes.core.k8s_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
namespace: "{{ mas_app_namespace }}"
spec:
channel: "{{ app_channel }}"
installPlanApproval: "{{ mas_upgrade_strategy }}"
installPlanApproval: Automatic
name: "{{ supported_apps[mas_app_id]['csv_name'] }}"
source: "{{ mas_catalog_source }}"
sourceNamespace: openshift-marketplace
6 changes: 1 addition & 5 deletions ibm/mas_devops/roles/suite_install/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
suite_install
===============================================================================

This role install Maximo Application Suite. It internally resolve the namespace based on the `mas_instance_id` as `mas-{mas_instance_id}-core`. By default this role install MAS Operator using Manual Upgrade Strategy. Set `MAS_UPGRADE_STRATEGY` environment variable to Automatic to override it. In the `Manual` upgrade mode, IBM Common Services operators requested by MAS will inherit the upgrade strategy from MAS and their pending install plans approved.
This role install Maximo Application Suite. It internally resolve the namespace based on the `mas_instance_id` as `mas-{mas_instance_id}-core`.


Role Variables
Expand Down Expand Up @@ -42,9 +41,6 @@ Directory containing configuration files (`*.yaml` and `*.yml`) to be applied to
### certManager.namespace
The namespace containing the cert-manager to be used by MAS

### mas_upgrade_strategy
The Upgrade strategy for MAS Operator. Default is set to Automatic

### mas_annotations
Provide a list of comma-separated key=value pairs which will be applied as labels on all resources created. This variable takes a comma separated list of annotations. For example, to deploy your suite in non production mode, set this to `mas.ibm.com/operationalMode=nonproduction`
or set `MAS_ANNOTATIONS` environment variable as `export MAS_ANNOTATIONS=mas.ibm.com/operationalMode=nonproduction`
Expand Down
14 changes: 0 additions & 14 deletions ibm/mas_devops/roles/suite_install/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ mas_entitlement_key: "{{ lookup('env', 'MAS_ENTITLEMENT_KEY') | default(ibm_enti
mas_add_catalog: "{{ lookup('env', 'MAS_ADD_CATALOG') | default('ibm-operator-catalog', true) }}"
mas_add_channel: "{{ lookup('env', 'MAS_ADD_CHANNEL') }}"

# Manual upgrade support
# -----------------------------------------------------------------------------
# Following variables are used when MAS Operator upgrade is set to Manual.
# it contains the ibm-common-services namespace and the list of labels from
# the Subcriptions created by MAS installation.
mas_upgrade_strategy: "{{ lookup('env', 'MAS_UPGRADE_STRATEGY') | default('Automatic', true) }}"

ibm_common_services_namespace: ibm-common-services
ibm_common_services_subscription_labels:
- ibm-common-service-operator.ibm-common-services
- ibm-namespace-scope-operator.ibm-common-services
- ibm-odlm.ibm-common-services
- ibm-licensing-operator-app.ibm-common-services

# MAS Annotation block
# -----------------------------------------------------------------------------
mas_annotations: "{{ lookup('env', 'MAS_ANNOTATIONS') | default(None, true) }}"
Expand Down

This file was deleted.

39 changes: 0 additions & 39 deletions ibm/mas_devops/roles/suite_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
- "MAS ICR cp content ............ {{ mas_icr_cp }}"
- "MAS ICR cpopen content ........ {{ mas_icr_cpopen }}"
- "MAS Cluster Issuer ............ {{ mas_cluster_issuer }}"
- "MAS Subscription Upgrade ...... {{ mas_upgrade_strategy }}"
- "IPv6 Enabled .................. {{ enable_ipv6 }}"

# 6. Install the operator & create entitlement secret
Expand All @@ -175,35 +174,6 @@
operator_group: "{{ lookup('template', 'templates/operator-group.yml.j2') }}"
subscription: "{{ lookup('template', 'templates/subscription.yml.j2') }}"

- name: Lookup and Approve MAS Subscription
when: mas_upgrade_strategy == 'Manual'
block:
- name: Lookup Operator install plan
kubernetes.core.k8s_info:
api_version: operators.coreos.com/v1alpha1
kind: InstallPlan
namespace: "{{ mas_namespace }}"
label_selectors:
- "operators.coreos.com/ibm-mas.{{ mas_namespace }}"
register: mas_install_plan
retries: 20
delay: 60 # Retry for approx 20 minutes (60s * 20 attempts) before giving up
until: mas_install_plan.resources | length > 0

- name: Approve the subscription install plan
when:
- mas_install_plan.resources | length > 0
- mas_install_plan.resources[0].status.phase != "Complete"
kubernetes.core.k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: InstallPlan
metadata:
name: "{{ mas_install_plan.resources[0].metadata.name }}"
namespace: "{{ mas_namespace }}"
spec:
approved: true

# 7. Wait until the Suite CRD is available
# -----------------------------------------------------------------------------
- name: "Wait until the Suite CRD is available"
Expand Down Expand Up @@ -249,12 +219,3 @@
- name: debug suiteResult
debug:
msg: "{{ suiteResult }}"

# 10. Handle IBM Common Services Install plan approvals when upgrade strategy is set to Manual
# -----------------------------------------------------------------------------
# ibm-common-services operators deployed by MAS will inherit the inherit MAS upgrade strategy
# when its set to Manual, we need to iterate those to ensure we do approve the first install plan
# otherwise MAS installation wont succeed.
- include_tasks: tasks/ibm-common-services.yml
when: mas_upgrade_strategy == 'Manual'
loop: "{{ibm_common_services_subscription_labels}}"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
{% endif %}
spec:
channel: "{{ mas_channel }}"
installPlanApproval: "{{ mas_upgrade_strategy }}"
installPlanApproval: Automatic
name: ibm-mas
source: "{{ mas_catalog_source }}"
sourceNamespace: openshift-marketplace
Loading