Skip to content

Commit

Permalink
spec: add capabilityArgs for adding additional info in result.
Browse files Browse the repository at this point in the history
  • Loading branch information
Colstuwjx committed Feb 11, 2020
1 parent f69d1f2 commit a6ba0bb
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Network configuration in JSON format must be streamed to the plugin through stdi
Note that IPAM plugins should return an abbreviated `Result` structure as described in [IP Allocation](#ip-allocation).
Plugins must indicate success with a return code of zero and the following JSON printed to stdout in the case of the ADD command. The `ips` and `dns` items should be the same output as was returned by the IPAM plugin (see [IP Allocation](#ip-allocation) for details) except that the plugin should fill in the `interface` indexes appropriately, which are missing from IPAM plugin output since IPAM plugins should be unaware of interfaces.
Plugins must indicate success with a return code of zero and the following JSON printed to stdout in the case of the ADD command. The `ips`, `dns` and `capabilityArgs` items should be the same output as was returned by the IPAM plugin (see [IP Allocation](#ip-allocation) for details) except that the plugin should fill in the `interface` indexes appropriately, which are missing from IPAM plugin output since IPAM plugins should be unaware of interfaces.
```
{
Expand Down Expand Up @@ -193,6 +193,10 @@ Plugins must indicate success with a return code of zero and the following JSON
"domain": <name-of-local-domain> (optional)
"search": <list-of-additional-search-domains> (optional)
"options": <list-of-options> (optional)
},
"capabilityArgs": { (optional)
"<name-of-the-arg>": <value-of-the-arg> (optional)
...
}
}
```
Expand All @@ -216,6 +220,9 @@ See the [Routes well-known structure](#routes) section for more information.
The `dns` field contains a dictionary consisting of common DNS information.
See the [DNS well-known structure](#dns) section for more information.
The `capabilityArgs` field contains a dictionary which carries additional plugin execution information.
See the [CapabilityArgs well-known structure](#capabilityArgs) section for more information.
The specification does not declare how this information must be processed by CNI consumers.
Examples include generating an `/etc/resolv.conf` file to be injected into the container filesystem or running a DNS forwarder on the host.
Expand Down Expand Up @@ -674,6 +681,10 @@ Success must be indicated by a zero return code and the following JSON being pri
"search": <list-of-search-domains> (optional)
"options": <list-of-options> (optional)
}
"capabilityArgs": { (optional)
"<name-of-the-arg>": <value-of-the-arg> (optional)
...
}
}
```

Expand All @@ -690,6 +701,9 @@ See the [Routes well-known structure](#routes) section for more information.
The `dns` field contains a dictionary consisting of common DNS information.
See the [DNS well-known structure](#dns) section for more information.

The `capabilityArgs` field contains a dictionary which carries additional plugin execution information.
See the [CapabilityArgs well-known structure](#capabilityArgs) section for more information.

Errors and logs are communicated in the same way as the CNI plugin. See [CNI Plugin Result](#result) section for details.

IPAM plugin examples:
Expand Down Expand Up @@ -763,7 +777,19 @@ The `dns` field contains a dictionary consisting of common DNS information.
- `search` (list of strings): list of priority ordered search domains for short hostname lookups. Will be preferred over `domain` by most resolvers.
- `options` (list of strings): list of options that can be passed to the resolver.
See [CNI Plugin Result](#result) section for more information.


#### CapabilityArgs

```
"capabilityArgs": {
"<name-of-the-arg>": <value-of-the-arg> (optional)
...
}
```

The `capabilityArgs` field contains a dictionary which carries additional plugin execution information.
For the each item of `capabilityArgs`, both the key and value are string type. If `capabilityArgs` is set, it could be passed through the chain, and the downstream plugins could consume this additional information.

## Well-known Error Codes

Error codes 1-99 must not be used other than as specified here.
Expand Down

0 comments on commit a6ba0bb

Please sign in to comment.