Skip to content

Commit e289512

Browse files
stuggiclaude
andcommitted
[update] Improve update of new operator version
Add validation to ensure the subscription's installedCSV matches currentCSV after the installplan is applied. This confirms the operator upgrade has completed successfully before proceeding with the rest of the update workflow. Uses label selector to find the subscription rather than hardcoding the name. Add missing wait for OpenStackControlPlane to reach ready state after operator updates in OLM mode. Include a 60-second delay before the wait to allow the control plane's ready condition to transition from its initial state, preventing premature completion while the control plane is still reconciling the operator changes. This step is important to validate that the current deployed control plane can successfully reach ready state with the new set of operators, but using the old service containers. Otherwise we start alreay updating to the new service images. Jira: OSPRH-23688 Co-Authored-By: Claude <[email protected]> Signed-off-by: Martin Schuppert <[email protected]>
1 parent 26c82f8 commit e289512

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

roles/update/tasks/main.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,32 @@
5050
- cifmw_ci_gen_kustomize_values_installplan_approval is defined
5151
- cifmw_ci_gen_kustomize_values_installplan_approval | lower == 'manual'
5252

53+
- name: Validate subscription CSV version after installplan
54+
when:
55+
- cifmw_ci_gen_kustomize_values_installplan_approval is defined
56+
- cifmw_ci_gen_kustomize_values_installplan_approval | lower == 'manual'
57+
block:
58+
- name: Wait for subscription installedCSV to match currentCSV
59+
kubernetes.core.k8s_info:
60+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
61+
api_key: "{{ cifmw_openshift_token | default(omit) }}"
62+
context: "{{ cifmw_openshift_context | default(omit) }}"
63+
api_version: operators.coreos.com/v1alpha1
64+
kind: Subscription
65+
namespace: openstack-operators
66+
label_selectors:
67+
- operators.coreos.com/openstack-operator.openstack-operators
68+
register: _cifmw_update_subscription_info
69+
until: >
70+
_cifmw_update_subscription_info.resources[0].status.installedCSV is defined
71+
and
72+
_cifmw_update_subscription_info.resources[0].status.currentCSV is defined
73+
and
74+
_cifmw_update_subscription_info.resources[0].status.installedCSV ==
75+
_cifmw_update_subscription_info.resources[0].status.currentCSV
76+
retries: 30
77+
delay: 10
78+
5379
- name: Handle OpenStack operator initialization
5480
when:
5581
- cifmw_ci_gen_kustomize_values_deployment_version is defined
@@ -145,6 +171,27 @@
145171
Got new version {{ cifmw_update_next_available_version }}
146172
({{ openstackversion_info.resources[0].status.deployedVersion }})
147173
174+
- name: Wait for OpenStackControlPlane to be ready after operator update
175+
when:
176+
- not (cifmw_update_run_dryrun | bool)
177+
- cifmw_ci_gen_kustomize_values_deployment_version is defined
178+
block:
179+
- name: Delay to allow OpenStackControlPlane ready condition to transition
180+
ansible.builtin.pause:
181+
seconds: 60
182+
183+
- name: Wait for OpenStackControlPlane ready condition
184+
environment:
185+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
186+
PATH: "{{ cifmw_path }}"
187+
ansible.builtin.command:
188+
cmd: >-
189+
oc wait OpenStackControlPlane
190+
--all
191+
--namespace={{ cifmw_update_namespace }}
192+
--for=condition=ready
193+
--timeout={{ cifmw_update_openstack_update_run_timeout }}
194+
148195
- name: Set openstack_update_run Makefile environment variables
149196
tags:
150197
- always

0 commit comments

Comments
 (0)