Skip to content

Commit

Permalink
Added checks for HCO webhook components and improve status handling
Browse files Browse the repository at this point in the history
- Introduced retries and checks for the hyperconverged-cluster-webhook pod to ensure it is running before proceeding.
- Added check for the hco-webhook-service to confirm its existence and to avoid webook related errors.
- Improved handling of HyperConverged status by adding checks for resource presence and defined status field.

Signed-off-by: Geetika Kapoor <[email protected]>
  • Loading branch information
geetikakay committed Dec 2, 2024
1 parent 2e3d145 commit 6b3a5bc
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@
msg: "Install Plan is not Complete after the specified wait period."
when: __sap_hypervisor_node_preconfigure_register_wait_for_installplan.resources[0].status.phase != "Complete"

- name: Wait and check for pod with label name hyperconverged-cluster-webhook under "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}" namespace
kubernetes.core.k8s_info:
kind: Pod
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
label_selectors:
- name=hyperconverged-cluster-webhook
register: hco_webhook_pod
retries: 5
delay: 60
until: hco_webhook_pod.resources | selectattr('status.phase', 'equalto', 'Running')

- name: Wait and check if hco-webhook-service exists in "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}" namespace
kubernetes.core.k8s_info:
kind: Service
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
name: hco-webhook-service
register: webhook_service
retries: 2
delay: 60
until: webhook_service.resources

- name: Create CNV HyperConverged
kubernetes.core.k8s:
state: present
Expand All @@ -91,12 +112,12 @@
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
register: hyperconverged_status
until: >
{{
(hyperconverged_status.resources[0].status.conditions |
(hyperconverged_status.resources | length > 0 and
hyperconverged_status.resources[0].status is defined and
hyperconverged_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list | length > 0) | bool
}}
retries: 60
delay: 10

Expand All @@ -114,3 +135,4 @@
ansible.builtin.fail:
msg: "HyperConverged is not Available after the specified wait period."
when: not hyperconverged_available

0 comments on commit 6b3a5bc

Please sign in to comment.