Skip to content

Commit

Permalink
Add error codes for STATUS verb to types.go and SPEC.md
Browse files Browse the repository at this point in the history
Signed-off-by: Archit Kulkarni <[email protected]>
  • Loading branch information
architkulkarni committed Jan 16, 2025
1 parent 3b4dfc5 commit 5f84615
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ Error Code|Error Description
`6`|Failed to decode content. For example, failed to unmarshal network config from bytes or failed to decode version info from string.
`7`|Invalid network config. If some validations on network configs do not pass, this error will be raised.
`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.
`50`|The plugin is not available (i.e. cannot service `ADD` requests)
`51`|The plugin is not available, and existing containers in the network may have limited connectivity.

In addition, stderr can be used for unstructured output such as logs.

Expand Down
4 changes: 3 additions & 1 deletion pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (r *Route) Copy() *Route {
}

// Well known error codes
// see https://github.com/containernetworking/cni/blob/main/SPEC.md#well-known-error-codes
// see https://github.com/containernetworking/cni/blob/main/SPEC.md#error
const (
ErrUnknown uint = iota // 0
ErrIncompatibleCNIVersion // 1
Expand All @@ -241,6 +241,8 @@ const (
ErrInvalidNetworkConfig // 7
ErrInvalidNetNS // 8
ErrTryAgainLater uint = 11
ErrPluginNotAvailable uint = 50
ErrLimitedConnectivity uint = 51
ErrInternal uint = 999
)

Expand Down

0 comments on commit 5f84615

Please sign in to comment.