From 32139707ca3ce9e6e59d1019ba973381208b8624 Mon Sep 17 00:00:00 2001 From: Timothy Stewart Date: Sat, 1 Aug 2026 23:49:25 -0500 Subject: [PATCH] fix(molecule): verify embedded flannel instead of a flannel DaemonSet - K3s 1.36 runs flannel embedded in the k3s agent rather than as a kube-flannel-ds DaemonSet, so the flannel verifier queried a workload that no longer exists and failed the verify step - For the flannel scenarios, assert every node is Ready and that neither the Calico nor the Cilium namespace exists - Drop the now-invalid kube-flannel-ds DaemonSet assertion --- .../tasks/test/verify-components.yml | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/molecule/resources/verify_from_outside/tasks/test/verify-components.yml b/molecule/resources/verify_from_outside/tasks/test/verify-components.yml index 769c43b..debc298 100644 --- a/molecule/resources/verify_from_outside/tasks/test/verify-components.yml +++ b/molecule/resources/verify_from_outside/tasks/test/verify-components.yml @@ -27,39 +27,43 @@ - name: Verify Flannel is the active CNI when: verify_cni == 'flannel' block: - - name: Get the Flannel DaemonSet - kubernetes.core.k8s_info: - kind: DaemonSet - name: kube-flannel-ds - namespace: kube-flannel - kubeconfig: "{{ kubecfg_path }}" - register: flannel_ds - - - name: Assert the Flannel DaemonSet is scheduled and Ready + - name: Assert every node reports Ready ansible.builtin.assert: - that: - - flannel_ds.resources | length == 1 - - flannel_ds.resources[0].status.desiredNumberScheduled > 0 - - flannel_ds.resources[0].status.numberReady == flannel_ds.resources[0].status.desiredNumberScheduled - success_msg: "Flannel DaemonSet is Ready" - fail_msg: "Flannel DaemonSet is not fully Ready" + that: item.status.conditions + | selectattr('type', 'equalto', 'Ready') + | map(attribute='status') | first | default('') == 'True' + success_msg: "{{ item.metadata.name }} is Ready" + fail_msg: "{{ item.metadata.name }} is not Ready" + loop: "{{ verify_nodes.resources }}" + loop_control: + label: "{{ item.metadata.name }} ready" - - name: Verify there is no incompatible CNI with Flannel - when: verify_cni == 'flannel' - block: - name: Get any Calico namespaces with Flannel enabled kubernetes.core.k8s_info: kind: Namespace name: calico-system kubeconfig: "{{ kubecfg_path }}" - register: calico_absent + register: flannel_calico_absent - name: Assert there is no Calico system namespace ansible.builtin.assert: - that: calico_absent.resources | length == 0 + that: flannel_calico_absent.resources | length == 0 success_msg: "No Calico present with Flannel" fail_msg: "A Calico namespace exists alongside Flannel" + - name: Get the Cilium namespace with Flannel enabled + kubernetes.core.k8s_info: + kind: Namespace + name: cilium + kubeconfig: "{{ kubecfg_path }}" + register: flannel_cilium + + - name: Assert the Cilium namespace is absent + ansible.builtin.assert: + that: flannel_cilium.resources | length == 0 + success_msg: "No Cilium present with Flannel" + fail_msg: "A Cilium namespace exists alongside Flannel" + - name: Verify Calico is the active CNI when: verify_cni == 'calico' block: