feat(ansible): Calico bits 37/43937/2
authorPeter Mikus <[email protected]>
Fri, 24 Oct 2025 06:17:29 +0000 (08:17 +0200)
committerPeter Mikus <[email protected]>
Fri, 24 Oct 2025 07:03:41 +0000 (07:03 +0000)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: Ie9360c055897ce59320bb4ced1c6575ce24b522e

fdio.infra.ansible/roles/calico/defaults/main.yaml
fdio.infra.ansible/roles/calico/tasks/main.yaml
fdio.infra.ansible/roles/calico/templates/calico-vpp.yaml.j2

index 270d928..4efbe63 100644 (file)
@@ -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
index f2bc633..ebbc2a0 100644 (file)
@@ -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:
     - 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
index a8c0ede..f5c7d78 100644 (file)
@@ -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