Skip to content

Commit 53981f3

Browse files
holserevallesp
authored andcommitted
[kustomize_deploy] Improve code clarity
- Rename _cifmw_kustomize_deploy_olm_osp_operator_sub to _cifmw_kustomize_deploy_olm_osp_operator_subscription for better readability and consistency. - Add dedicated cifmw_kustomize_deploy_retries_subscription parameter (default: 90) to allow independent configuration of Subscription vs InstallPlan retry timeouts. - Fix task name from 'Wait for InstallPlan to be created' to 'Wait for Subscription to be created' to correctly reflect what the task is actually waiting for. - Update role README.md to document the new retries_subscription parameter in the Timeouts section. This change improves maintainability by using more descriptive variable names and properly separating concerns between Subscription and InstallPlan wait operations. Resolves: https://issues.redhat.com/browse/OSPCIX-1100 Assisted-By: Claude Code/claude-sonnet-4.5 Signed-off-by: Sergii Golovatiuk <[email protected]>
1 parent 1104f25 commit 53981f3

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

roles/kustomize_deploy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ with a message.
101101
Some tasks uses timeouts when applying or waiting for resources. Those timeouts can be controlled by:
102102

103103
* `cifmw_kustomize_deploy_delay`: (Int) Ansible `delay` passed to tasks that waits for a resource to reach a target state (default `10`)
104+
* `cifmw_kustomize_deploy_retries_subscription`: (Int) Ansible `retries` passed to tasks that wait for the Subscription (default `90`)
104105
* `cifmw_kustomize_deploy_retries_install_plan`: (Int) Ansible `retries` passed to tasks that wait for the InstallPlan (default `60`)
105106

106107
### Task tagging

roles/kustomize_deploy/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ cifmw_kustomize_deploy_dp_dest_file: >-
222222
# timeouts and retry configuration
223223

224224
cifmw_kustomize_deploy_delay: 10
225+
cifmw_kustomize_deploy_retries_subscription: 90
225226
cifmw_kustomize_deploy_retries_install_plan: 60
226227

227228
# Default retry settings for k8s_info operations to handle transient auth failures

roles/kustomize_deploy/tasks/install_operators.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
src: "{{ cifmw_kustomize_deploy_olm_dest_file }}"
9292
register: _cifmw_kustomize_deploy_olm_apply_out
9393

94-
- name: Wait for the openstack operators InstallPlan to be created
94+
- name: Wait for the openstack operators Subscription to be created
9595
vars:
96-
_cifmw_kustomize_deploy_olm_osp_operator_sub: >-
96+
_cifmw_kustomize_deploy_olm_osp_operator_subscription: >-
9797
{{
9898
(
9999
_cifmw_kustomize_deploy_olm_apply_out.result.results |
@@ -108,18 +108,18 @@
108108
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
109109
api_key: "{{ cifmw_openshift_token | default(omit) }}"
110110
context: "{{ cifmw_openshift_context | default(omit) }}"
111-
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.apiVersion }}"
111+
api_version: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.apiVersion }}"
112112
kind: Subscription
113-
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.namespace }}"
114-
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_sub.metadata.name }}"
115-
register: _cifmw_kustomize_deploy_olm_osp_operator_sub_out
116-
retries: "{{ cifmw_kustomize_deploy_retries_install_plan }}"
113+
namespace: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.namespace }}"
114+
name: "{{ _cifmw_kustomize_deploy_olm_osp_operator_subscription.metadata.name }}"
115+
register: _cifmw_kustomize_deploy_olm_osp_operator_subscription_out
116+
retries: "{{ cifmw_kustomize_deploy_retries_subscription }}"
117117
delay: "{{ cifmw_kustomize_deploy_delay }}"
118118
until:
119-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.failed is false
120-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources is defined
121-
- _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1
122-
- (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined
119+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.failed is false
120+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources is defined
121+
- _cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | length == 1
122+
- (_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first)['status']['installPlanRef'] is defined
123123

124124
- name: Install plan
125125
ansible.builtin.include_tasks: install_plan.yml
@@ -131,7 +131,7 @@
131131
vars:
132132
_install_plan: >-
133133
{{
134-
(_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first).status.installPlanRef
134+
(_cifmw_kustomize_deploy_olm_osp_operator_subscription_out.resources | first).status.installPlanRef
135135
}}
136136
kubernetes.core.k8s_info:
137137
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"

0 commit comments

Comments
 (0)