Skip to content

Commit

Permalink
Ensuring check the actual new pod got migrated
Browse files Browse the repository at this point in the history
In order to test the pod migration when the current node is cordoned, we
get the list of running pods and cordon the node for the first pod in
the list.

Once the pod is migrated, we get the new list and verify the node for
the first pod has changed.

The problem is the first pod in the new list is not necessarily the new
pod and, even more, it may be more than one pod were running on the
cordoned node which may lead us to think the node was not migrated.

With this change, we ensure we check the node for the new (migrated) pod
in the replica set.
  • Loading branch information
nsilla committed Jan 8, 2024
1 parent db64124 commit ea41fd9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion roles/example-cnf-validate/tasks/pod-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
cnf_existing_node: "{{ cnf_pod.resources[0].spec.nodeName }}"
cnf_existing_pod_name: "{{ cnf_pod.resources[0].metadata.name }}"
cnf_app_count: "{{ cnf_pod.resources|length }}"
cnf_app_list: "{{ cnf_pod | json_query('resources[*].metadata.name') }}"
- name: show current node of testpmd
debug:
msg: "CNF App is running on node {{ cnf_existing_node }}"
Expand Down Expand Up @@ -49,7 +50,11 @@

- name: set new testpmd node name
set_fact:
testpmd_new_node: "{{ cnf_new_pods.resources[0].spec.nodeName }}"
testpmd_new_node: "{{ pod.spec.nodeName }}"
loop: "{{ cnf_new_pods.resources }}"
loop_control:
loop_var: pod
when: "pod.metadata.name not in cnf_app_list"

- name: uncordon the node
shell: |
Expand Down

0 comments on commit ea41fd9

Please sign in to comment.