From 981d73792efbbae4e0e8ef09aac4b3b51d5f3d16 Mon Sep 17 00:00:00 2001 From: Daniel Lawton Date: Wed, 10 Jun 2026 18:30:27 +0100 Subject: [PATCH] Fix lb_tests for OCP 4.22 external cloud provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update change_cloud_cm.yml to target the correct ConfigMap and namespace for clusters using external cloud provider architecture. Changes: - ConfigMap: cloud-provider-config → cloud-conf - Namespace: openshift-config → openshift-cloud-controller-manager - Data key: config → cloud.conf - Wait logic: Replace node unschedulable polling with deployment rollout restart Change-Id: I456b95934564d3f1a92aeff996195db760e470be --- .../roles/lb_tests/tasks/change_cloud_cm.yml | 57 +++++++------------ .../templates/cloud-provider-config.yaml.j2 | 2 +- 2 files changed, 20 insertions(+), 39 deletions(-) diff --git a/collection/stages/roles/lb_tests/tasks/change_cloud_cm.yml b/collection/stages/roles/lb_tests/tasks/change_cloud_cm.yml index ee97b25e..cbb405ab 100644 --- a/collection/stages/roles/lb_tests/tasks/change_cloud_cm.yml +++ b/collection/stages/roles/lb_tests/tasks/change_cloud_cm.yml @@ -23,24 +23,24 @@ - name: Save the cloud provider ConfigMap in a file ansible.builtin.shell: | - oc get cm cloud-provider-config -n openshift-config -o yaml > "{{ config_orig_path }}" + oc get cm cloud-conf -n openshift-cloud-controller-manager -o yaml > "{{ config_orig_path }}" changed_when: false environment: KUBECONFIG: "{{ kubeconfig }}" -- name: Read original cloud-provider-config +- name: Read original cloud-conf ConfigMap ansible.builtin.shell: | cat "{{ config_orig_path }}" register: result changed_when: false -- name: Set variable from cloud-provider-config to manipulate it +- name: Set variable from cloud-conf ConfigMap to manipulate it ansible.builtin.set_fact: original_cm_yaml: "{{ result.stdout | from_yaml }}" -- name: Save the config.ini in a file for modifications +- name: Save the cloud.conf in a file for modifications ansible.builtin.copy: - content: "{{ original_cm_yaml.data.config }}" + content: "{{ original_cm_yaml.data['cloud.conf'] }}" dest: "{{ config_ini_path }}" mode: u=rwx,g=rw,o=r @@ -159,45 +159,26 @@ - name: Save the resulting cloud provider ConfigMap after application in a file ansible.builtin.shell: | - oc get configmap/cloud-provider-config -n openshift-config -o yaml > "{{ config_applied_path }}" + oc get configmap/cloud-conf -n openshift-cloud-controller-manager -o yaml > "{{ config_applied_path }}" changed_when: false environment: KUBECONFIG: "{{ kubeconfig }}" -- name: Wait until the configuration is succesfully applied in the cluster +- name: Restart cloud-controller-manager deployment to apply configuration block: - - name: Wait until some node is unschedulable (oc get nodes --field-selector spec.unschedulable=true) - kubernetes.core.k8s_info: - kubeconfig: "{{ kubeconfig }}" - api_version: v1 - kind: Node - field_selectors: - - spec.unschedulable=true - register: unschedulable_nodes - until: - - unschedulable_nodes.resources is defined - - unschedulable_nodes.resources|length != 0 - retries: 30 - delay: 10 - - - name: Wait until there are no unschedulable nodes - this means the config has been applied - ansible.builtin.include_role: - name: tools_cluster_checks - tasks_from: wait_until_no_unschedulable_nodes.yml - vars: - wait_retries: 30 - wait_delay: 120 - loop: "{{ range(3) | list }}" - loop_control: - pause: 120 + - name: Trigger rollout restart of openstack-cloud-controller-manager + ansible.builtin.shell: | + oc rollout restart deployment/openstack-cloud-controller-manager -n openshift-cloud-controller-manager + changed_when: true + environment: + KUBECONFIG: "{{ kubeconfig }}" - - name: Check that there are no unschedulable nodes and cluster is healthy - ansible.builtin.include_role: - name: tools_cluster_checks - tasks_from: wait_until_no_unschedulable_nodes.yml - vars: - wait_retries: 1 - wait_delay: 0 + - name: Wait for openstack-cloud-controller-manager rollout to complete + ansible.builtin.shell: | + oc rollout status deployment/openstack-cloud-controller-manager -n openshift-cloud-controller-manager --timeout=5m + changed_when: false + environment: + KUBECONFIG: "{{ kubeconfig }}" rescue: - name: Get cluster debug information diff --git a/collection/stages/roles/lb_tests/templates/cloud-provider-config.yaml.j2 b/collection/stages/roles/lb_tests/templates/cloud-provider-config.yaml.j2 index ba6e44ef..6c5caf5e 100644 --- a/collection/stages/roles/lb_tests/templates/cloud-provider-config.yaml.j2 +++ b/collection/stages/roles/lb_tests/templates/cloud-provider-config.yaml.j2 @@ -6,5 +6,5 @@ metadata: data: ca-bundle.pem: | {{original_cm_yaml.data['ca-bundle.pem']|trim|indent(width=4)}} - config: | + cloud.conf: | {{ini_config|indent(width=4)}}