From: Peter Mikus Date: Fri, 24 Oct 2025 06:17:29 +0000 (+0200) Subject: feat(ansible): Calico bits X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F43937%2F2;p=csit.git feat(ansible): Calico bits Signed-off-by: Peter Mikus Change-Id: Ie9360c055897ce59320bb4ced1c6575ce24b522e --- diff --git a/fdio.infra.ansible/roles/calico/defaults/main.yaml b/fdio.infra.ansible/roles/calico/defaults/main.yaml index 270d92899c..4efbe63f7f 100644 --- a/fdio.infra.ansible/roles/calico/defaults/main.yaml +++ b/fdio.infra.ansible/roles/calico/defaults/main.yaml @@ -18,7 +18,11 @@ calico_uplink_interfaces: vppDriver: "avf" rx: 8 rxMode: "polling" + pci: "0000:38:00.0" + ip_addr: "192.168.1.2/24" - interfaceName: "enp58s0np0" vppDriver: "avf" rx: 8 - rxMode: "polling" \ No newline at end of file + rxMode: "polling" + pci: "0000:3a:00.0" + ip_addr: "192.168.2.2/24" \ No newline at end of file diff --git a/fdio.infra.ansible/roles/calico/tasks/main.yaml b/fdio.infra.ansible/roles/calico/tasks/main.yaml index f2bc633bda..ebbc2a069a 100644 --- a/fdio.infra.ansible/roles/calico/tasks/main.yaml +++ b/fdio.infra.ansible/roles/calico/tasks/main.yaml @@ -1,6 +1,18 @@ --- # file: tasks/main.yaml +- name: pre-setup network interface + ansible.builtin.shell: | + ip l set dev {{ item.interfaceName }} up + ip a add {{ item.ip_addr }} dev {{ item.interfaceName }} + loop: "{{ calico_uplink_interfaces }}" + ignore_errors: True + when: + - calico_sut is defined + - calico_vpp_state == "present" + tags: + - kubernetes-reset + - name: download calico manifest to the cluster ansible.builtin.get_url: url: "{{ item.value }}" @@ -10,7 +22,7 @@ when: - calico_sut is defined tags: - - kubernetes-calico-install + - kubernetes-calico - name: apply calico manifest to the cluster kubernetes.core.k8s: @@ -20,7 +32,7 @@ when: - calico_sut is defined tags: - - kubernetes-calico-install + - kubernetes-calico - name: upload calico vpp manifest to the cluster ansible.builtin.template: @@ -31,7 +43,7 @@ when: - calico_sut is defined tags: - - kubernetes-calico-install + - kubernetes-calico - name: apply calico vpp manifest to the cluster kubernetes.core.k8s: @@ -42,7 +54,7 @@ when: - calico_sut is defined tags: - - kubernetes-calico-install + - kubernetes-calico - name: get a list of all pods from any namespace kubernetes.core.k8s_info: @@ -89,4 +101,15 @@ - calico_sut is defined - calico_vpp_state == "present" tags: - - kubernetes-info \ No newline at end of file + - kubernetes-info + +- name: reset network interface + ansible.builtin.shell: | + python3 /opt/dpdk/usertools/dpdk-devbind.py -b none {{ item.pci }} --force + python3 /opt/dpdk/usertools/dpdk-devbind.py -b ice {{ item.pci }} + loop: "{{ calico_uplink_interfaces }}" + when: + - calico_sut is defined + - calico_vpp_state == "absent" + tags: + - kubernetes-reset \ No newline at end of file diff --git a/fdio.infra.ansible/roles/calico/templates/calico-vpp.yaml.j2 b/fdio.infra.ansible/roles/calico/templates/calico-vpp.yaml.j2 index a8c0ededee..f5c7d7857f 100644 --- a/fdio.infra.ansible/roles/calico/templates/calico-vpp.yaml.j2 +++ b/fdio.infra.ansible/roles/calico/templates/calico-vpp.yaml.j2 @@ -178,7 +178,16 @@ data: "vppHostTapSpec": { "rx": 1, "tx":1, "rxqsz": 1024, "txqsz": 1024, "isl3": false }, - "uplinkInterfaces": {{ calico_uplink_interfaces | to_nice_json(indent=2) }} + "uplinkInterfaces": [ +{% for interface in calico_uplink_interfaces %} + { + "interfaceName": "{{ interface.interfaceName }}", + "vppDriver": "{{ interface.vppDriver }}", + "rx": {{ interface.rx }}, + "rxMode": "{{ interface.rxMode }}" + }{{ "," if not loop.last }} +{% endfor %} + ] } SERVICE_PREFIX: 10.96.0.0/12 kind: ConfigMap