From 9882532ebfa002fcbdba84be8ea28d9ba6ba1a15 Mon Sep 17 00:00:00 2001 From: Benjamin Leggett Date: Mon, 6 May 2024 10:58:25 -0400 Subject: [PATCH] Put these back actually Signed-off-by: Benjamin Leggett --- SPEC.md | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/SPEC.md b/SPEC.md index 80a4f160..45729d21 100644 --- a/SPEC.md +++ b/SPEC.md @@ -147,6 +147,131 @@ Plugins that consume any of these configuration keys should respect their intend **Other keys:** Plugins may define additional fields that they accept and may generate an error if called with unknown fields. Runtimes must preserve unknown fields in plugin configuration objects when transforming for execution. +#### Example configuration +The following is an example file-based JSON representation of a network configuration `dbnet` with no inlined plugin configurations, and two external aggregated plugin configurations (`bridge` and `tuning`) in JSON format: +`/etc/cni/net.d/10-dbnet.conf`: +```jsonc +{ + "cniVersion": "1.1.0", + "cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"], + "name": "dbnet", + "loadOnlyInlinedPlugins": false, +} +``` + +`/etc/cni/net.d/dbnet/5-bridge.conf`: +```jsonc +{ + "type": "bridge", + // plugin specific parameters + "bridge": "cni0", + "keyA": ["some more", "plugin specific", "configuration"], + + "ipam": { + "type": "host-local", + // ipam specific + "subnet": "10.1.0.0/16", + "gateway": "10.1.0.1", + "routes": [ + {"dst": "0.0.0.0/0"} + ] + }, + "dns": { + "nameservers": [ "10.1.0.1" ] + } +} +``` + +`/etc/cni/net.d/dbnet/10-tuning.conf`: +```jsonc +{ + "type": "tuning", + "capabilities": { + "mac": true + }, + "sysctl": { + "net.core.somaxconn": "500" + } +} +``` + +The following is an example file-based JSON representation of a network configuration `dbnet` with one inlined plugin configuration (`bridge`), and one external aggregated plugin configuration `tuning` in JSON format: +`/etc/cni/net.d/10-dbnet.conf`: +```jsonc +{ + "cniVersion": "1.1.0", + "cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"], + "name": "dbnet", + "loadOnlyInlinedPlugins": false, + plugins: [ + { + "type": "bridge", + // plugin specific parameters + "bridge": "cni0", + "keyA": ["some more", "plugin specific", "configuration"], + + "ipam": { + "type": "host-local", + // ipam specific + "subnet": "10.1.0.0/16", + "gateway": "10.1.0.1", + "routes": [ + {"dst": "0.0.0.0/0"} + ] + }, + "dns": { + "nameservers": [ "10.1.0.1" ] + } + } + ] +} +``` + +`/etc/cni/net.d/dbnet/10-tuning.conf`: +```jsonc +{ + "type": "tuning", + "capabilities": { + "mac": true + }, + "sysctl": { + "net.core.somaxconn": "500" + } +} +``` + +The following is an example file-based JSON representation of a network configuration `dbnet` with one inlined plugin configuration (`bridge`), and no external aggregated plugin configs +`/etc/cni/net.d/10-dbnet.conf`: +```jsonc +{ + "cniVersion": "1.1.0", + "cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"], + "name": "dbnet", + "loadOnlyInlinedPlugins": true, + "plugins": [ + { + "type": "bridge", + // plugin specific parameters + "bridge": "cni0", + "keyA": ["some more", "plugin specific", "configuration"], + + "ipam": { + "type": "host-local", + // ipam specific + "subnet": "10.1.0.0/16", + "gateway": "10.1.0.1", + "routes": [ + {"dst": "0.0.0.0/0"} + ] + }, + "dns": { + "nameservers": [ "10.1.0.1" ] + } + } + ] +} +``` + ### Version considerations CNI runtimes, plugins, and network configurations may support multiple CNI specification versions independently. Plugins indicate their set of supported versions through the VERSION command, while network configurations indicate their set of supported versions through the `cniVersion` and `cniVersions` fields.