|
| 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. |
0 commit comments