Skip to content

Commit

Permalink
Merge pull request #498 from redhatci/remove-testpmd-lb-operator
Browse files Browse the repository at this point in the history
example-cnf | Remove references to load balancer
  • Loading branch information
ramperher authored Dec 4, 2024
2 parents 9fc2931 + 82dc873 commit 0ced9cc
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 161 deletions.
25 changes: 8 additions & 17 deletions roles/example_cnf_deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,16 @@ Also, exported `kubeconfig` file is required to run the Ansible tasks on the tar
| ecd_oc_path | /usr/local/bin/oc | no | File path to find the oc binary |
| ecd_opm_path | /usr/local/bin/opm | no | File path to find the opm binary |
| ecd_job_logs_path | /tmp | no | File path to find the logs folder |
| ecd_enable_lb | true | no | Enable LoadBalancer, to deploy TestPMD LoadBalancer |
| ecd_enable_mac_fetch | true | no | Enable MAC fetch, which implies the creation of the CNFAppMac CR |
| ecd_enable_testpmd | true | no | Enable TestPMD, also known as CNFApp |
| ecd_enable_trex | true | no | Enable TRex server, to send traffic to TestPMD |
| ecd_enable_trex_app | true | no | Enable TRex application, to manage the creation of TRex jobs and profiles |
| ecd_testpmd_channel | alpha | no | TestPMD operators channel |
| ecd_trex_channel | alpha | no | TRex operator channel |
| ecd_trex_mac_list | ["20:04:0f:f1:89:01","20:04:0f:f1:89:02"] | no | Static MAC addresses used by TRex |
| ecd_lb_gen_port_mac_list | ["40:04:0f:f1:89:01","40:04:0f:f1:89:02"] | no | Static MAC addresses used by the LoadBalancer in its connection with TRex |
| ecd_lb_cnf_port_mac_list | ["60:04:0f:f1:89:01","60:04:0f:f1:89:02"] | no | Static MAC addresses used by the LoadBalancer in its connection with CNFApp |
| ecd_testpmd_app_mac_list | ["80:04:0f:f1:89:01","80:04:0f:f1:89:02"] | no | Static MAC addresses used by CNFApp |
| ecd_cnf_app_networks | [] | yes | Connection between LB-CNF in LB mode (or TRex-CNF in direct mode) |
| ecd_packet_generator_networks | [] | yes | Connection between TRex-LB in LB mode (not used in direct mode). Required in LB mode |
| ecd_networks_testpmd_app | [] | no | Networks for the CNF, including the hardcoded MAC addresses for direct mode case |
| ecd_sriov_networks | [] | yes | SRIOV networks used in the connection between TRex and CNF Application, together with the number of interfaces to be used per network. See example above
| ecd_networks_testpmd_app | [] | no | Networks for the CNF, including the hardcoded MAC addresses |
| ecd_termination_grace_period_seconds | 30 | no | Termination grace period for TestPMD |
| ecd_trex_test_config | [] | no | TRex test configuration. See an example below |
| ecd_trex_cr_name | trexconfig | no | Name of the TRex CR |
Expand All @@ -54,8 +50,8 @@ Also, exported `kubeconfig` file is required to run the Ansible tasks on the tar
| ecd_trex_job_failed | false | no | Track if TRex job has failed or not |
| ecd_trex_tests_skip_failures | false | no | If set to true, even if TRex job fails, the job will progress |
| ecd_try_running_migration_tests | true | no | The idea is always to try to run the migration test, unless TRex job failed before |
| ecd_numa_aware_topology | None | no | If defined, allows to provide the NUMA aware topology for LoadBalancer, TestPMD and TRexServer CRs |
| ecd_high_perf_runtime | None | no | If defined, allows to provide the RuntimeClass name for LoadBalancer, TestPMD, TRexApp and TRexServer CRs |
| ecd_numa_aware_topology | None | no | If defined, allows to provide the NUMA aware topology for TestPMD and TRexServer CRs |
| ecd_high_perf_runtime | None | no | If defined, allows to provide the RuntimeClass name for TestPMD, TRexApp and TRexServer CRs |
| ecd_trex_app_version | None | yes | TRexApp version, required in deploy_extra_trex action |

## SR-IOV configuration
Expand Down Expand Up @@ -114,7 +110,7 @@ Each action allows you to do different operations with the example-cnf workload:
- deploy: allows you to deploy the example-cnf operators and workloads.
- validate: performs validations to the example-cnf workloads to address specific scenarios, e.g. validations after cluster upgrade.
- deploy_extra_trex: gives you the chance to create a new TRex job, in an already deployed example-cnf instance.
- draining: while a TRex job is running, runs a node cordoning-draining, selecting the node where TestPMD is running, then it measures the downtime in the TRex job and the packet loss. Only used in direct mode.
- draining: while a TRex job is running, runs a node cordoning-draining, selecting the node where TestPMD is running, then it measures the downtime in the TRex job and the packet loss.

### Examples

Expand All @@ -137,15 +133,10 @@ Each action allows you to do different operations with the example-cnf workload:
- name: Deploy the Example CNF applications
vars:
ecd_action: "deploy"
ecd_cnf_app_networks:
- name: intel-numa0-net1
ecd_sriov_networks:
- name: example-cnf-net1
count: 1
- name: intel-numa0-net2
count: 1
ecd_packet_generator_networks:
- name: intel-numa0-net3
count: 1
- name: intel-numa0-net4
- name: example-cnf-net2
count: 1
ecd_operator_version: "latest"
ecd_high_perf_runtime: "performance-blueprint"
Expand Down
16 changes: 3 additions & 13 deletions roles/example_cnf_deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ecd_opm_path: /usr/local/bin/opm
ecd_job_logs_path: /tmp

# Operators/apps to enable
ecd_enable_lb: true
ecd_enable_mac_fetch: true
ecd_enable_testpmd: true
ecd_enable_trex: true
Expand All @@ -33,23 +32,14 @@ ecd_trex_channel: alpha
ecd_trex_mac_list:
- "20:04:0f:f1:89:01"
- "20:04:0f:f1:89:02"
ecd_lb_gen_port_mac_list:
- "40:04:0f:f1:89:01"
- "40:04:0f:f1:89:02"
ecd_lb_cnf_port_mac_list:
- "60:04:0f:f1:89:01"
- "60:04:0f:f1:89:02"
## These ones are only used in the direct mode case
ecd_testpmd_app_mac_list:
- "80:04:0f:f1:89:01"
- "80:04:0f:f1:89:02"

# Variables for gathering the network info from the scenario
## Connection between LB-CNF in LB mode (or TRex-CNF in direct mode)
ecd_cnf_app_networks: []
## Connection between TRex-LB in LB mode (not used in direct mode)
ecd_packet_generator_networks: []
## Networks for the CNF, including the hardcoded MAC addresses for direct mode case
## SRIOV networks used in the connection between TRex and CNF Application, together with the number of interfaces to be used per network
ecd_sriov_networks: []
## Networks for the CNF, including the hardcoded MAC addresses
ecd_networks_testpmd_app: []

# RuntimeClass that should be used for running DPDK application,
Expand Down
2 changes: 1 addition & 1 deletion roles/example_cnf_deploy/scripts/get-example-cnf-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ done

echo
echo "--- CR status ---"
CRS="cnfappmac loadbalancer testpmd trexconfig trexapp"
CRS="cnfappmac testpmd trexconfig trexapp"
for CR in $CRS; do
echo "> Status of $CR"
$OC_BINARY get "$CR" -n "$APP_NAMESPACE"
Expand Down
6 changes: 0 additions & 6 deletions roles/example_cnf_deploy/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
when: '"trex-container-server@" in item'
loop: "{{ _ecd_catalog_data_cmd.stdout_lines }}"

- name: "Set testpmd-lb version from the catalog"
ansible.builtin.set_fact:
ecd_testpmd_app_version: "{{ item }}"
when: '"testpmd-container-app-testpmd@" in item'
loop: "{{ _ecd_catalog_data_cmd.stdout_lines }}"

- name: "Installation of example-cnf operators"
ansible.builtin.include_tasks: deploy/sub.yml

Expand Down
50 changes: 5 additions & 45 deletions roles/example_cnf_deploy/tasks/deploy/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,59 +32,19 @@
msg: "Minimum 2 worker nodes are required to run example-cnf applications"
when: "_ecd_nodes.resources|length < 2"

- name: "Fail when packet generator network is not available"
- name: "Fail when SRIOV networks info is not available"
ansible.builtin.fail:
msg: "'ecd_packet_generator_networks' is required when deployed with LB"
msg: "'ecd_sriov_networks' is required"
when:
- "ecd_enable_lb|bool"
- "ecd_packet_generator_networks|length == 0"

- name: "Fail when cnf app networks is not available"
ansible.builtin.fail:
msg: "'ecd_cnf_app_networks' is required"
when:
- "ecd_cnf_app_networks|length == 0"

- name: "Set facts of modifying networks"
ansible.builtin.set_fact:
ecd_pack_nw: []
ecd_cnf_nw: []
when: ecd_enable_lb|bool

- name: "Create packet gen network list for lb with hardcoded macs"
ansible.builtin.set_fact:
ecd_pack_nw: "{{ ecd_pack_nw + [ item | combine({'mac': ecd_lb_gen_port_mac_list[idx:idx+item.count]})] }}"
loop: "{{ ecd_packet_generator_networks }}"
loop_control:
index_var: idx
when: ecd_enable_lb|bool

- name: "Create cnf app network list for lb with hardcoded macs"
ansible.builtin.set_fact:
ecd_cnf_nw: "{{ ecd_cnf_nw + [ item | combine({'mac': ecd_lb_cnf_port_mac_list[idx:idx+item.count]})] }}"
loop: "{{ ecd_cnf_app_networks }}"
loop_control:
index_var: idx
when: ecd_enable_lb|bool

- name: "Include lb tasks"
ansible.builtin.include_tasks: deploy/lb-app.yml
when: ecd_enable_lb|bool

# In this case, do not include hardcoded MAC addresses
- name: "(LB mode) Set local fact for cnf-app pod networks"
ansible.builtin.set_fact:
ecd_networks_testpmd_app: "{{ ecd_cnf_app_networks }}"
when: ecd_enable_lb|bool
- "ecd_sriov_networks|length == 0"

# In this case, include hardcoded MAC addresses
- name: "(Direct mode) Create network list for cnfapp with hardcoded macs"
- name: "Create network list for cnfapp with hardcoded macs"
ansible.builtin.set_fact:
ecd_networks_testpmd_app: "{{ ecd_networks_testpmd_app + [item | combine({'mac': ecd_testpmd_app_mac_list[idx:idx+item.count]})] }}"
loop: "{{ ecd_cnf_app_networks }}"
loop: "{{ ecd_sriov_networks }}"
loop_control:
index_var: idx
when: not ecd_enable_lb|bool

- name: "Create cr for cnf application"
community.kubernetes.k8s:
Expand Down
29 changes: 0 additions & 29 deletions roles/example_cnf_deploy/tasks/deploy/lb-app.yml

This file was deleted.

5 changes: 0 additions & 5 deletions roles/example_cnf_deploy/tasks/deploy/sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
channel: "{{ ecd_testpmd_channel }}"
source: "{{ ecd_catalog_name }}"
enable: "{{ ecd_enable_mac_fetch | bool}}"
- name: testpmd-lb-operator
namespace: "{{ ecd_cnf_namespace }}"
channel: "{{ ecd_testpmd_channel }}"
source: "{{ ecd_catalog_name }}"
enable: "{{ ecd_enable_lb | bool}}"
- name: testpmd-operator
namespace: "{{ ecd_cnf_namespace }}"
channel: "{{ ecd_testpmd_channel }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/example_cnf_deploy/tasks/trex/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: Set local fact for trex pod networks
ansible.builtin.set_fact:
ecd_networks_trex: []
ecd_packet_gen_net: "{{ ecd_packet_generator_networks if ecd_enable_lb | bool else ecd_cnf_app_networks }}"
ecd_packet_gen_net: "{{ ecd_sriov_networks }}"

- name: Create network list for trex with hardcoded macs
ansible.builtin.set_fact:
Expand Down
28 changes: 0 additions & 28 deletions roles/example_cnf_deploy/templates/lb-cr.yaml.j2

This file was deleted.

5 changes: 0 additions & 5 deletions roles/example_cnf_deploy/templates/testpmd-cr.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ metadata:
spec:
privileged: false
imagePullPolicy: {{ ecd_image_pull_policy }}
{% if ecd_enable_lb|bool %}
ethpeerMaclist: {{ ecd_lb_cnf_port_mac_list }}
size: {{ ecd_testpmd_app_size|default(2) }}
{% else %}
ethpeerMaclist: {{ ecd_trex_mac_list }}
size: 1
{% endif %}
networks: {{ ecd_networks_testpmd_app }}
terminationGracePeriodSeconds: {{ ecd_termination_grace_period_seconds }}
{% if ecd_high_perf_runtime is defined and ecd_high_perf_runtime|length %}
Expand Down
4 changes: 0 additions & 4 deletions roles/example_cnf_deploy/templates/trex-app-cr.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ spec:
org: {{ ecd_repo_name }}
version: {{ ecd_trex_app_version }}
imagePullPolicy: {{ ecd_image_pull_policy }}
enableLb: {{ ecd_enable_lb }}
{% if ecd_high_perf_runtime is defined and ecd_high_perf_runtime|length %}
runtime_class_name: "{{ ecd_high_perf_runtime }}"
{% endif %}
{% if ecd_enable_lb|bool %}
lbMacs: {{ ecd_lb_gen_port_mac_list }}
{% endif %}
trexProfileConfigMap: {{ ecd_trex_profile_cm_name|default('') }}
trexProfileName: {{ ecd_trex_profile_name|default('') }}
trexApp: false
4 changes: 1 addition & 3 deletions roles/example_cnf_deploy/templates/trex-app-job.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ spec:
{% endif %}
env:
- name: MODE
value: "{{ 'lb' if ecd_enable_lb else 'direct' }}"
- name: LB_MACS
value: "{{ ecd_lb_gen_port_mac_list|join(',') }}"
value: "direct"
- name: CR_NAME
value: "{{ ecd_trex_app_job_name }}"
- name: NODE_NAME
Expand Down
4 changes: 0 additions & 4 deletions roles/example_cnf_deploy/templates/trex-server-cr.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ spec:
version: {{ ecd_trex_server_version }}
imagePullPolicy: {{ ecd_image_pull_policy }}
networks: {{ ecd_networks_trex }}
enableLb: {{ ecd_enable_lb }}
{% if ecd_enable_lb|bool %}
lbMacs: {{ ecd_lb_gen_port_mac_list }}
{% endif %}
cpu: 6
{% if ecd_trex_config_skip|default(false)|bool %}
trex_config_skip: true
Expand Down

0 comments on commit 0ced9cc

Please sign in to comment.