forked from openstack-k8s-operators/ci-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
b78ad95
commit 5c02344
Showing
22 changed files
with
702 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,90 @@ | ||
# 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_namespace`: (String) The namespace where OCP resources will be installed. Defaults to `openstack`. | ||
* `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_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 `[]`. | ||
* `cifmw_ci_multus_default_nad_ipam_type_ip_version``: (String) Default IP version to use in IPAM config. Defaults to `v4`. | ||
* `cifmw_ci_multus_dryrun`: (Bool) When enabled, tasks that require an OCP environment are skipped. Defaults to `false`. | ||
* `cifmw_ci_multus_allow_list`: (List) Adding network names to this list allows you to define what networks will be rendered into the NAD manifest. Defaults to `[]`. | ||
* `cifmw_ci_multus_deny_list`: (List) Adding network names to this list allows you to define what networks should be skipped from being rendered into the NAD manifest. Defaults to `[]`. | ||
|
||
By default the `ci_multus` role reads the `cifmw_networking_env_definition` variable to generate NetworkAttachmentDefinition manifests for networks who have the Multus tool defined. | ||
|
||
## NAD configuration layout | ||
The user can provide a list of NAD configuration as follow: | ||
In addition to that, you can also pass any number of "patch" variables using `cifmw_ci_multus_net_info_patch` that allow you to extend the config used to render the NetworkAttachmentDefinition manifests. | ||
For a working example, please see `cifmw_ci_multus_net_info_patch_1` in molecule/local/molecule.yml | ||
|
||
## cifmw_ci_multus_net_info_patch example | ||
|
||
```YAML | ||
cifmw_ci_multus_nad_list: | ||
- name: storage | ||
iface: enps6s0.21 | ||
type: macvlan | ||
ipam: | ||
type: whereabouts | ||
range: 172.18.0.0/24 | ||
range_start: 172.18.0.30 | ||
range_end: 172.18.0.70 | ||
- name: bgpnet1 | ||
iface: bgpiface | ||
type: interface | ||
ipam: | ||
type: whereabouts | ||
range: 100.65.4.0/30 | ||
range_start: 100.65.4.1 | ||
range_end: 100.65.4.2 | ||
cifmw_ci_multus_net_info_patch_1: | ||
patchnetwork: | ||
gw_v4: 192.168.122.1 | ||
network_name: patchnetwork | ||
network_v4: 192.168.122.0/24 | ||
interface_name: eth2 | ||
tools: | ||
multus: | ||
ipv4_ranges: | ||
- start: 192.168.122.30 | ||
end: 192.168.122.70 | ||
``` | ||
`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 - Default use case consuming cifmw_networking_env_definition | ||
|
||
```YAML | ||
- name: Configure additional networks using multus | ||
vars: | ||
cifmw_ci_multus_nad_list: | ||
- name: storage | ||
iface: enps6s0.21 | ||
type: macvlan | ||
ipam: | ||
type: whereabouts | ||
range: 172.18.0.0/24 | ||
range_start: 172.18.0.30 | ||
range_end: 172.18.0.70 | ||
ansible.builtin.include_role: | ||
name: "ci_multus" | ||
``` | ||
### 2 - Content from `cifmw_network_layout`: | ||
|
||
### 2 - Using patch: | ||
|
||
```YAML | ||
- name: Configure additional networks using multus | ||
vars: | ||
cifmw_network_layout: | ||
networks: | ||
default: | ||
iface: enps6s0 | ||
mtu: 1500 | ||
range: 192.168.122.0/24 | ||
cifmw_ci_multus_net_info_patch_1: | ||
patchnetwork: | ||
gw_v4: 192.168.122.1 | ||
network_name: patchnetwork | ||
network_v4: 192.168.122.0/24 | ||
interface_name: eth2 | ||
tools: | ||
multus: | ||
range: 192.168.122.30-192.168.122.70 | ||
ipv4_ranges: | ||
- start: 192.168.122.30 | ||
end: 192.168.122.70 | ||
ansible.builtin.include_role: | ||
name: "ci_multus" | ||
``` | ||
|
||
### 2 - Using allow and deny list: | ||
|
||
```YAML | ||
- name: Configure additional networks using multus | ||
vars: | ||
cifmw_ci_multus_allow_list: | ||
- default | ||
- awesomenet | ||
- maybenet | ||
cifmw_ci_multus_deny_list: | ||
- maybenet | ||
ansible.builtin.include_role: | ||
name: "ci_multus" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.