Skip to content

Commit 11db36c

Browse files
authored
Merge pull request #768 from asears/md-doc-lint-updates-3
Fix linting issues in docs, add headers to json example, update errors into table
2 parents 0016c95 + 9ec274a commit 11db36c

File tree

4 files changed

+78
-48
lines changed

4 files changed

+78
-48
lines changed

CODE-OF-CONDUCT.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
## Community Code of Conduct
1+
# Community Code of Conduct
22

33
CNI follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
4-

CONTRIBUTING.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ it easier to get your contribution accepted.
77

88
We gratefully welcome improvements to documentation as well as to code.
99

10-
# Certificate of Origin
10+
## Certificate of Origin
1111

1212
By contributing to this project you agree to the Developer Certificate of
1313
Origin (DCO). This document was created by the Linux Kernel community and is a
1414
simple statement that you, as a contributor, have the legal right to make the
1515
contribution. See the [DCO](DCO) file for details.
1616

17-
# Email and Chat
17+
## Email and Chat
1818

1919
The project uses the cni-dev email list, IRC chat, and Slack:
2020
- Email: [cni-dev](https://groups.google.com/forum/#!forum/cni-dev)
@@ -39,14 +39,15 @@ This is a rough outline of how to prepare a contribution:
3939
- Make sure your commit messages are in the proper format (see below).
4040
- Push your changes to a topic branch in your fork of the repository.
4141
- If you changed code:
42-
- add automated tests to cover your changes, using the [Ginkgo](https://onsi.github.io/ginkgo/) & [Gomega](https://onsi.github.io/gomega/) style
43-
- if the package did not previously have any test coverage, add it to the list
42+
- add automated tests to cover your changes, using the [Ginkgo](https://onsi.github.io/ginkgo/) & [Gomega](https://onsi.github.io/gomega/) style
43+
- if the package did not previously have any test coverage, add it to the list
4444
of `TESTABLE` packages in the `test.sh` script.
45-
- run the full test script and ensure it passes
45+
- run the full test script and ensure it passes
4646
- Make sure any new code files have a license header (this is now enforced by automated tests)
4747
- Submit a pull request to the original repository.
4848

4949
## How to run the test suite
50+
5051
We generally require test coverage of any new features or bug fixes.
5152

5253
Here's how you can run the test suite on any system (even Mac or Windows) using
@@ -67,15 +68,15 @@ cd libcni
6768
go test
6869
```
6970

70-
# Acceptance policy
71+
## Acceptance policy
7172

7273
These things will make a PR more likely to be accepted:
7374

74-
* a well-described requirement
75-
* tests for new code
76-
* tests for old code!
77-
* new code and tests follow the conventions in old code and tests
78-
* a good commit message (see below)
75+
- a well-described requirement
76+
- tests for new code
77+
- tests for old code!
78+
- new code and tests follow the conventions in old code and tests
79+
- a good commit message (see below)
7980

8081
In general, we will merge a PR once two maintainers have endorsed it.
8182
Trivial changes (e.g., corrections to spelling) may get waved through.
@@ -87,7 +88,7 @@ We follow a rough convention for commit messages that is designed to answer two
8788
questions: what changed and why. The subject line should feature the what and
8889
the body of the commit should describe the why.
8990

90-
```
91+
```md
9192
scripts: add the test-cluster command
9293

9394
this uses tmux to setup a test cluster that you can easily kill and
@@ -98,7 +99,7 @@ Fixes #38
9899

99100
The format can be described more formally as follows:
100101

101-
```
102+
```md
102103
<subsystem>: <what changed>
103104
<BLANK LINE>
104105
<why this change was made>
@@ -112,6 +113,7 @@ This allows the message to be easier to read on GitHub as well as in various
112113
git tools.
113114

114115
## 3rd party plugins
116+
115117
So you've built a CNI plugin. Where should it live?
116118

117119
Short answer: We'd be happy to link to it from our [list of 3rd party plugins](README.md#3rd-party-plugins).

RELEASING.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Release process
22

33
## Resulting artifacts
4+
45
Creating a new release produces the following artifacts:
56

67
- Binaries (stored in the `release-<TAG>` directory) :
@@ -9,26 +10,31 @@ Creating a new release produces the following artifacts:
910
- `sha1`, `sha256` and `sha512` files for the above files.
1011

1112
## Preparing for a release
13+
1214
1. Releases are performed by maintainers and should usually be discussed and planned at a maintainer meeting.
13-
- Choose the version number. It should be prefixed with `v`, e.g. `v1.2.3`
14-
- Take a quick scan through the PRs and issues to make sure there isn't anything crucial that _must_ be in the next release.
15-
- Create a draft of the release note
16-
- Discuss the level of testing that's needed and create a test plan if sensible
17-
- Check what version of `go` is used in the build container, updating it if there's a new stable release.
15+
16+
- Choose the version number. It should be prefixed with `v`, e.g. `v1.2.3`
17+
- Take a quick scan through the PRs and issues to make sure there isn't anything crucial that _must_ be in the next release.
18+
- Create a draft of the release note
19+
- Discuss the level of testing that's needed and create a test plan if sensible
20+
- Check what version of `go` is used in the build container, updating it if there's a new stable release.
1821

1922
## Creating the release artifacts
23+
2024
1. Make sure you are on the master branch and don't have any local uncommitted changes.
2125
1. Create a signed tag for the release `git tag -s $VERSION` (Ensure that GPG keys are created and added to GitHub)
2226
1. Run the release script from the root of the repository
23-
- `scripts/release.sh`
24-
- The script requires Docker and ensures that a consistent environment is used.
25-
- The artifacts will now be present in the `release-<TAG>` directory.
27+
28+
- `scripts/release.sh`
29+
- The script requires Docker and ensures that a consistent environment is used.
30+
- The artifacts will now be present in the `release-<TAG>` directory.
31+
2632
1. Test these binaries according to the test plan.
2733

2834
## Publishing the release
35+
2936
1. Push the tag to git `git push origin <TAG>`
3037
1. Create a release on Github, using the tag which was just pushed.
3138
1. Attach all the artifacts from the release directory.
3239
1. Add the release note to the release.
3340
1. Announce the release on at least the CNI mailing, IRC and Slack.
34-

SPEC.md

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
# Container Network Interface Specification
22

3-
- [Version](#version)
4-
- [Overview](#overview)
5-
- [General considerations](#general-considerations)
6-
- [CNI Plugin](#cni-plugin)
7-
* [Overview](#overview-1)
8-
* [Parameters](#parameters)
9-
* [Result](#result)
10-
* [Network Configuration](#network-configuration)
11-
* [Example configurations](#example-configurations)
12-
* [Network Configuration Lists](#network-configuration-lists)
13-
* [IP Allocation](#ip-allocation)
14-
* [Well-known Structures](#well-known-structures)
15-
- [Well-known Error Codes](#well-known-error-codes)
3+
- [Container Network Interface Specification](#container-network-interface-specification)
4+
- [Version](#version)
5+
- [Released versions](#released-versions)
6+
- [Overview](#overview)
7+
- [General considerations](#general-considerations)
8+
- [CNI Plugin](#cni-plugin)
9+
- [Overview](#overview-1)
10+
- [Parameters](#parameters)
11+
- [Result](#result)
12+
- [Network Configuration](#network-configuration)
13+
- [Example configurations](#example-configurations)
14+
- [Example bridge configuration](#example-bridge-configuration)
15+
- [Example ovs configuration](#example-ovs-configuration)
16+
- [Example macvlan configuration](#example-macvlan-configuration)
17+
- [Network Configuration Lists](#network-configuration-lists)
18+
- [Network Configuration List Error Handling](#network-configuration-list-error-handling)
19+
- [Example network configuration lists](#example-network-configuration-lists)
20+
- [Network configuration list runtime examples](#network-configuration-list-runtime-examples)
21+
- [IP Allocation](#ip-allocation)
22+
- [IP Address Management (IPAM) Interface](#ip-address-management-ipam-interface)
23+
- [Notes](#notes)
24+
- [Well-known Structures](#well-known-structures)
25+
- [IPs](#ips)
26+
- [Routes](#routes)
27+
- [DNS](#dns)
28+
- [Well-known Error Codes](#well-known-error-codes)
1629

1730
## Version
1831

@@ -146,6 +159,7 @@ Plugins should generally complete a `DEL` action without error even if some reso
146159
147160
Runtimes must use the type of network (see [Network Configuration](#network-configuration) below) as the name of the executable to invoke.
148161
Runtimes should then look for this executable in a list of predefined directories (the list of directories is not prescribed by this specification). Once found, it must invoke the executable using the following environment variables for argument passing:
162+
149163
- `CNI_COMMAND`: indicates the desired operation; `ADD`, `DEL`, `CHECK`, or `VERSION`.
150164
- `CNI_CONTAINERID`: Container ID
151165
- `CNI_NETNS`: Path to network namespace file
@@ -255,6 +269,8 @@ Plugins may define additional fields that they accept and may generate an error
255269
256270
### Example configurations
257271
272+
#### Example bridge configuration
273+
258274
```jsonc
259275
{
260276
"cniVersion": "0.4.0",
@@ -274,6 +290,8 @@ Plugins may define additional fields that they accept and may generate an error
274290
}
275291
```
276292

293+
#### Example ovs configuration
294+
277295
```jsonc
278296
{
279297
"cniVersion": "0.4.0",
@@ -295,6 +313,8 @@ Plugins may define additional fields that they accept and may generate an error
295313
}
296314
```
297315

316+
#### Example macvlan configuration
317+
298318
```jsonc
299319
{
300320
"cniVersion": "0.4.0",
@@ -317,6 +337,7 @@ Network configuration lists provide a mechanism to run multiple CNI plugins for
317337
The list is composed of well-known fields and list of one or more standard CNI network configurations (see above).
318338

319339
The list is described in JSON form, and can be stored on disk or generated from other sources by the container runtime. The following fields are well-known and have the following meaning:
340+
320341
- `cniVersion` (string): [Semantic Version 2.0](https://semver.org) of CNI specification to which this configuration list and all the individual configurations conform.
321342
- `name` (string): Network name. This should be unique across all containers on the host (or other administrative domain). Must start with a alphanumeric character, optionally followed by any combination of one or more alphanumeric characters, underscore (_), dot (.) or hyphen (-).
322343
- `disableCheck` (string): Either `true` or `false`. If `disableCheck` is `true`, runtimes must not call `CHECK` for this network configuration list. This allows an administrator to prevent `CHECK`ing where a combination of plugins is known to return spurious errors.
@@ -567,16 +588,16 @@ Note that plugins are executed in reverse order from the `ADD` and `CHECK` actio
567588
"interfaces": [
568589
{
569590
"name": "cni0",
570-
"mac": "00:11:22:33:44:55",
591+
"mac": "00:11:22:33:44:55"
571592
},
572593
{
573594
"name": "veth3243",
574-
"mac": "55:44:33:22:11:11",
595+
"mac": "55:44:33:22:11:11"
575596
},
576597
{
577598
"name": "eth0",
578599
"mac": "99:88:77:66:55:44",
579-
"sandbox": "/var/run/netns/blue",
600+
"sandbox": "/var/run/netns/blue"
580601
}
581602
],
582603
"dns": {
@@ -768,11 +789,13 @@ The `dns` field contains a dictionary consisting of common DNS information.
768789

769790
Error codes 1-99 must not be used other than as specified here.
770791

771-
- `1` - Incompatible CNI version
772-
- `2` - Unsupported field in network configuration. The error message must contain the key and value of the unsupported field.
773-
- `3` - Container unknown or does not exist. This error implies the runtime does not need to perform any container network cleanup (for example, calling the `DEL` action on the container).
774-
- `4` - Invalid necessary environment variables, like CNI_COMMAND, CNI_CONTAINERID, etc. The error message must contain the names of invalid variables.
775-
- `5` - I/O failure. For example, failed to read network config bytes from stdin.
776-
- `6` - Failed to decode content. For example, failed to unmarshal network config from bytes or failed to decode version info from string.
777-
- `7` - Invalid network config. If some validations on network configs do not pass, this error will be raised.
778-
- `11` - Try again later. If the plugin detects some transient condition that should clear up, it can use this code to notify the runtime it should re-try the operation later.
792+
Error Code|Error Description
793+
---|---
794+
`-1`|Incompatible CNI version
795+
`-2`|Unsupported field in network configuration. The error message must contain the key and value of the unsupported field.
796+
`-3`|Container unknown or does not exist. This error implies the runtime does not need to perform any container network cleanup (for example, calling the `DEL` action on the container).
797+
`-4`|Invalid necessary environment variables, like CNI_COMMAND, CNI_CONTAINERID, etc. The error message must contain the names of invalid variables.
798+
`-5`|I/O failure. For example, failed to read network config bytes from stdin.
799+
`-6`|Failed to decode content. For example, failed to unmarshal network config from bytes or failed to decode version info from string.
800+
`-7`|Invalid network config. If some validations on network configs do not pass, this error will be raised.
801+
`-11`|Try again later. If the plugin detects some transient condition that should clear up, it can use this code to notify the runtime it should re-try the operation later.

0 commit comments

Comments
 (0)