route-override IPAM works as meta CNI plugin to override IP route given by previous CNI plugins. It is useful in a case with network-attachment-definition.
Currently route-override verified its feature with podman and crio(with Kubernetes).
Binaries (for 386/amd64) are in Releases.
Installing using the provided daemonset will copy the route-override binary to the /opt/cni/bin on each machine in your Kubernetes cluster.
git clone https://github.com/redhat-nfvpe/cni-route-override.git && cd cni-route-override/
kubectl create -f deployments/daemonset-install.yaml
{
"cniVersion": "0.3.0",
"name" : "mymacvlan",
"plugins": [
{
"type": "macvlan",
"master": "eth1",
"mode": "bridge",
"ipam": {
...
}
},
{
"type" : "route-override",
"flushroutes" : true,
"delroutes": [
{
"dst": "192.168.0.0/24"
}],
"addroutes": [
{
"dst": "192.168.0.0/24",
"gw": "10.1.254.254"
}]
}
]
}
addroutes can now express ECMP intent directly by providing a gws array:
{
"type": "route-override",
"addroutes": [
{
"dst": "10.200.0.0/24",
"gws": ["192.168.200.1", "192.168.200.2"]
}]
}
The same structure can be used inside delroutes to flush previously installed ECMP entries without adding new knobs.
type: (string, required): "routing-override"flushroutes: (bool, optional): true if you flush all routes.flushgateway: (bool, optional): true if you flush default route (gateway).delroutes: (object, optional): list of routes add to the container namespace. Each route is a dictionary with "dst", optional "gw", and optional "gws" (array) fields. Setgwsto target ECMP routes without introducing a new command. If bothgwandgwsare omitted, the interface gateway value will be used.addroutes: (object, optional): list of routes add to the container namespace. Each route is a dictionary with "dst", optional "gw", and optional "gws" (array) fields. Whengwsis provided the plugin programs an ECMP route that fans out to every gateway listed. Ifgwandgwsare omitted, the interface gateway value will be used.skipcheck: (bool, optional): true if you want to skip CNI's check command. Please set true if you will change routes after its launch
route-override will manipulate the routes as following sequences:
- flush routes if
flushroutesis enabled. - flush gateway if
flushgatewayis enabled. - delete routes in
delroutesifdelrouteshas route and the route is exists in routes. - add routes in
addroutesifaddrouteshas route.
The following args conventions are supported:
flushroutes: (bool, optional): true if you flush all routes (except interface routes and link-local).flushgateway: (bool, optional): true if you flush default route (gateway).delroutes: (object, optional): list of routes add to the container namespace. Each route is a dictionary with "dst", optional "gw", and optional "gws" (array) fields. Setgwsto describe ECMP routes that should be removed without relying on a separate command.addroutes: (object, optional): list of routes add to the container namespace. Each route is a dictionary with "dst", optional "gw", and optional "gws" (array) fields. Providinggwsmakesaddroutescapable of adding ECMP routes directly.