Skip to content

Commit

Permalink
Put these back actually
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Leggett <[email protected]>
  • Loading branch information
bleggett committed May 6, 2024
1 parent 32eeb62 commit 9882532
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9882532

Please sign in to comment.