Skip to content

Commit 5a7981a

Browse files
authored
Merge pull request #90561 from kquinn1204/OCPBUGS-51308
OCPBUGS-51308 Missing route-override
2 parents 0e28b57 + b0220dc commit 5a7981a

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

modules/nw-route-override-cni.adoc

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/multiple_networks/secondary_networks/creating-secondary-nwt-other-cni.adoc
4+
// * networking/multiple_networks/configuring-additional-network.adoc
5+
6+
:_mod-docs-content-type: REFERENCE
7+
[id="nw-route-override-cni_{context}"]
8+
= Configuring routes using the route-override plugin on an additional network
9+
10+
The following object describes the configuration parameters for the `route-override` CNI plugin:
11+
12+
.Route override CNI plugin JSON configuration object
13+
[cols=".^2,.^2,.^6",options="header"]
14+
|====
15+
|Field|Type|Description
16+
17+
|`type`
18+
|`string`
19+
|The name of the CNI plugin to configure: `route-override`.
20+
21+
|`flushroutes`
22+
|`boolean`
23+
|Optional: Set to `true` to flush any existing routes.
24+
25+
|`flushgateway`
26+
|`boolean`
27+
|Optional: Set to `true` to flush the default route namely the gateway route.
28+
29+
|`delroutes`
30+
|`object`
31+
|Optional: Specify the list of routes to delete from the container namespace.
32+
33+
|`addroutes`
34+
|`object`
35+
|Optional: Specify the list of routes to add to the container namespace. Each route is a dictionary with `dst` and optional `gw` fields. If `gw` is omitted, the plugin uses the default gateway value.
36+
37+
|`skipcheck`
38+
|`boolean`
39+
|Optional: Set this to `true` to skip the check command. By default, CNI plugins verify the network setup during the container lifecycle. When modifying routes dynamically with `route-override`, skipping this check ensures the final configuration reflects the updated routes.
40+
|====
41+
42+
[id="nw-route-override-config-example_{context}"]
43+
== Route-override plugin configuration example
44+
45+
The `route-override` CNI is a type of CNI that it is designed to be used when chained with a parent CNI. It does not operate independently, but relies on the parent CNI to first create the network interface and assign IP addresses before it can modify the routing rules.
46+
47+
The following example configures an additional network named `mymacvlan`. The parent CNI creates a network interface attached to `eth1` and assigns an IP address in the `192.168.1.0/24` range using `host-local` IPAM. The `route-override` CNI is then chained to the parent CNI and modifies the routing rules by flushing existing routes, deleting the route to `192.168.0.0/24`, and adding a new route for `192.168.0.0/24` with a custom gateway.
48+
49+
[source,json]
50+
----
51+
{
52+
"cniVersion": "0.3.0",
53+
"name": "mymacvlan",
54+
"plugins": [
55+
{
56+
"type": "macvlan", <1>
57+
"master": "eth1",
58+
"mode": "bridge",
59+
"ipam": {
60+
"type": "host-local",
61+
"subnet": "192.168.1.0/24"
62+
}
63+
},
64+
{
65+
"type": "route-override", <2>
66+
"flushroutes": true,
67+
"delroutes": [
68+
{
69+
"dst": "192.168.0.0/24"
70+
}
71+
],
72+
"addroutes": [
73+
{
74+
"dst": "192.168.0.0/24",
75+
"gw": "10.1.254.254"
76+
}
77+
]
78+
}
79+
]
80+
}
81+
----
82+
83+
<1> The parent CNI creates a network interface attached to `eth1`.
84+
<2> The chained `route-override` CNI modifies the routing rules.

networking/multiple_networks/configuring-additional-network.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ As a cluster administrator, you can configure an additional network for your clu
1515
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#nw-multus-macvlan-object_configuring-additional-network[MACVLAN]
1616
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#nw-multus-tap-object_configuring-additional-network[TAP]
1717
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuration-ovnk-additional-networks_configuring-additional-network[OVN-Kubernetes]
18+
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#nw-route-override-cni_configuring-additional-network[Route-override]
1819
1920
[id="approaches-managing-additional-network_{context}"]
2021
== Approaches to managing an additional network
@@ -177,6 +178,9 @@ include::modules/nw-multus-macvlan-object.adoc[leveloffset=+2]
177178
// Configuration for a TAP additional network
178179
include::modules/nw-multus-tap-object.adoc[leveloffset=+2]
179180

181+
// Configuration for route-override additional network
182+
include::modules/nw-route-override-cni.adoc[leveloffset=+2]
183+
180184
[role="_additional-resources"]
181185
.Additional resources
182186

networking/multiple_networks/secondary_networks/creating-secondary-nwt-other-cni.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ include::modules/nw-multus-macvlan-object.adoc[leveloffset=+1]
2626
// Configuration for a TAP additional network
2727
include::modules/nw-multus-tap-object.adoc[leveloffset=+1]
2828

29+
// Configuration for a route-override additional network
30+
include::modules/nw-route-override-cni.adoc[leveloffset=+1]
31+
2932
[role="_additional-resources"]
3033
.Additional resources
3134

networking/multiple_networks/understanding-multiple-networks.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ networks in your cluster:
6969

7070
* *SR-IOV*: xref:../../networking/hardware_networks/about-sriov.adoc#about-sriov[Configure an SR-IOV based additional network] to allow pods to attach to a virtual function (VF) interface on SR-IOV capable hardware on the host system.
7171

72+
* *route-override*: xref:../../networking/multiple_networks/secondary_networks/creating-secondary-nwt-other-cni.adoc#nw-route-override-cni_configuring-additional-network-cni[Configure a `route-override` based additional network] to allow pods to override and set routes.
73+
7274
include::modules/nw-udn-support-matrix-primary-secondary.adoc[leveloffset=+1]
7375

7476
.Additional resources

0 commit comments

Comments
 (0)