Skip to content

Commit

Permalink
[ci_multus] Refactor role
Browse files Browse the repository at this point in the history
The ci_multus role was created but unused, this patch refreshes it as we
will begin to use it in the new job to test Ironic.
  • Loading branch information
lewisdenny committed Oct 23, 2024
1 parent 87f6807 commit 4e9e510
Show file tree
Hide file tree
Showing 8 changed files with 305 additions and 368 deletions.
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MD013: false
6 changes: 6 additions & 0 deletions playbooks/02-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
ansible.builtin.include_role:
name: ci_nmstate

- name: Configure multus networks
when:
- cifmw_config_multus | default(false) | bool
ansible.builtin.include_role:
name: ci_multus

- name: Deploy Sushy Emulator and configure controller as hypervisor
when:
- cifmw_enable_virtual_baremetal_support | default(false) | bool
Expand Down
37 changes: 13 additions & 24 deletions roles/ci_multus/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# ci_multus
Creates additional networks in a OCP cluster using NetworkAttachmentDefinition (NAD) resources.

Creates additional networks in a OCP cluster using NetworkAttachmentDefinition
(NAD) resources.

## Parameters

* `cifmw_ci_multus_basedir`: (String) Base directory. Defaults to `cifmw_basedir` which defaults to `~/ci-framework-data`.
* `cifmw_ci_multus_manifests_dir`: (String) Directory in where OCP manifests will be placed. Defaults to `"{{ cifmw_manifests | default(cifmw_ci_multus_basedir ~ '/artifacts/manifests') }}"`.
* `cifmw_ci_multus_namespace`: (String) The namespace where OCP resources will be installed. Defaults to `ci-multus`.
* `cifmw_ci_multus_ocp_hostname`: (String) The OCP inventory hostname. Used to gather network information specific to those nodes, mostly the interfaces. Defaults to `crc`.
* `cifmw_ci_multus_cniversion`: (String) The CNI specification version used when creating the resource. Defaults to `0.3.1`.
* `cifmw_ci_multus_default_nad_type`: (String) Default NAD type used when not specified by the network configuration. Defaults to `macvlan`.
* `cifmw_ci_multus_default_nad_ipam_type`: (String) Default NAD IPAM type to be used when not specified by the network configuration. Defaults to `whereabouts`.
`cifmw_ci_multus_default_nad_ipam_type`: (String) Default NAD IPAM type to be used when not specified by the network configuration. Defaults to `whereabouts`.
* `cifmw_ci_multus_nad_list`: (List) List of NAD configuration to be created in destination OCP cluster. When not provided, `ci_multus` will build a list based on known cifmw variables (`cifmw_network_layout`, `crc_ci_bootstrap_networks_out`).Defaults to `[]`.
* `cifmw_ci_multus_nad_extra_list`: (List) Additional list of NAD configuration to be created in destination OCP cluster. Defaults to `[]`.

In case the Multus NetworkAttachmentDefinition generated from the `cifmw_networking_env_definition` varible is not enough for the given purpose it is possible
to directly pass the configuration to be applied to each instance (OCP and/or unmanaged) by placing it in the `cifmw_ci_multus_nad_list` dict like this:

## NAD configuration layout

The user can provide a list of NAD configuration as follow:

```YAML
Expand All @@ -34,20 +41,17 @@ cifmw_ci_multus_nad_list:
range_start: 100.65.4.1
range_end: 100.65.4.2
```
`cifmw_ci_multus_nad_list` can be passed directly, but if not given it will default, by that order, to the following:
1. The content of the `cifmw_network_layout` variable.
2. The content of the `crc_ci_bootstrap_networks_out` variable.
3. The content of the `crc_ci_bootstrap_networks_out` variable loaded from `/etc/ci/env`.

If an additional NAD configuration needs to be configured, in addition to the content build from cifmw variables, the `cifmw_ci_multus_nad_extra_list` can be specified.
## Limitations
* Not all NetworkAttachmentDefinition types and parameters are supported by this role.
* Not all IPAM configurations are supported by this role.
* When consuming network info from CI variables, the user must provide the OCP host, using `cifmw_ci_multus_ocp_hostname` parameter, since the role doesn't perform a Node discovery on the OCP node.

## Examples
### 1 - Use of `cifmw_ci_multus_nad_list`:

### 1 - Use of `cifmw_ci_multus_nad_list`

```YAML
- name: Configure additional networks using multus
vars:
Expand All @@ -63,18 +67,3 @@ If an additional NAD configuration needs to be configured, in addition to the co
ansible.builtin.include_role:
name: "ci_multus"
```
### 2 - Content from `cifmw_network_layout`:
```YAML
- name: Configure additional networks using multus
vars:
cifmw_network_layout:
networks:
default:
iface: enps6s0
mtu: 1500
range: 192.168.122.0/24
multus:
range: 192.168.122.30-192.168.122.70
ansible.builtin.include_role:
name: "ci_multus"
```
Loading

0 comments on commit 4e9e510

Please sign in to comment.