Skip to content

Commit 9882532

Browse files
committed
Put these back actually
Signed-off-by: Benjamin Leggett <[email protected]>
1 parent 32eeb62 commit 9882532

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed

Diff for: SPEC.md

+125
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,131 @@ Plugins that consume any of these configuration keys should respect their intend
147147
**Other keys:**
148148
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.
149149

150+
#### Example configuration
151+
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:
152+
`/etc/cni/net.d/10-dbnet.conf`:
153+
```jsonc
154+
{
155+
"cniVersion": "1.1.0",
156+
"cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"],
157+
"name": "dbnet",
158+
"loadOnlyInlinedPlugins": false,
159+
}
160+
```
161+
162+
`/etc/cni/net.d/dbnet/5-bridge.conf`:
163+
```jsonc
164+
{
165+
"type": "bridge",
166+
// plugin specific parameters
167+
"bridge": "cni0",
168+
"keyA": ["some more", "plugin specific", "configuration"],
169+
170+
"ipam": {
171+
"type": "host-local",
172+
// ipam specific
173+
"subnet": "10.1.0.0/16",
174+
"gateway": "10.1.0.1",
175+
"routes": [
176+
{"dst": "0.0.0.0/0"}
177+
]
178+
},
179+
"dns": {
180+
"nameservers": [ "10.1.0.1" ]
181+
}
182+
}
183+
```
184+
185+
`/etc/cni/net.d/dbnet/10-tuning.conf`:
186+
```jsonc
187+
{
188+
"type": "tuning",
189+
"capabilities": {
190+
"mac": true
191+
},
192+
"sysctl": {
193+
"net.core.somaxconn": "500"
194+
}
195+
}
196+
```
197+
198+
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:
199+
`/etc/cni/net.d/10-dbnet.conf`:
200+
```jsonc
201+
{
202+
"cniVersion": "1.1.0",
203+
"cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"],
204+
"name": "dbnet",
205+
"loadOnlyInlinedPlugins": false,
206+
plugins: [
207+
{
208+
"type": "bridge",
209+
// plugin specific parameters
210+
"bridge": "cni0",
211+
"keyA": ["some more", "plugin specific", "configuration"],
212+
213+
"ipam": {
214+
"type": "host-local",
215+
// ipam specific
216+
"subnet": "10.1.0.0/16",
217+
"gateway": "10.1.0.1",
218+
"routes": [
219+
{"dst": "0.0.0.0/0"}
220+
]
221+
},
222+
"dns": {
223+
"nameservers": [ "10.1.0.1" ]
224+
}
225+
}
226+
]
227+
}
228+
```
229+
230+
`/etc/cni/net.d/dbnet/10-tuning.conf`:
231+
```jsonc
232+
{
233+
"type": "tuning",
234+
"capabilities": {
235+
"mac": true
236+
},
237+
"sysctl": {
238+
"net.core.somaxconn": "500"
239+
}
240+
}
241+
```
242+
243+
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
244+
`/etc/cni/net.d/10-dbnet.conf`:
245+
```jsonc
246+
{
247+
"cniVersion": "1.1.0",
248+
"cniVersions": ["0.3.1", "0.4.0", "1.0.0", "1.1.0"],
249+
"name": "dbnet",
250+
"loadOnlyInlinedPlugins": true,
251+
"plugins": [
252+
{
253+
"type": "bridge",
254+
// plugin specific parameters
255+
"bridge": "cni0",
256+
"keyA": ["some more", "plugin specific", "configuration"],
257+
258+
"ipam": {
259+
"type": "host-local",
260+
// ipam specific
261+
"subnet": "10.1.0.0/16",
262+
"gateway": "10.1.0.1",
263+
"routes": [
264+
{"dst": "0.0.0.0/0"}
265+
]
266+
},
267+
"dns": {
268+
"nameservers": [ "10.1.0.1" ]
269+
}
270+
}
271+
]
272+
}
273+
```
274+
150275
### Version considerations
151276

152277
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.

0 commit comments

Comments
 (0)