Skip to content

Commit ee7c96f

Browse files
authored
Merge pull request #1152 from architkulkarni/status-codes
Add error codes for STATUS verb to `types.go` and `SPEC.md`
2 parents d0bdb01 + 5f84615 commit ee7c96f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

SPEC.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ Error Code|Error Description
651651
`6`|Failed to decode content. For example, failed to unmarshal network config from bytes or failed to decode version info from string.
652652
`7`|Invalid network config. If some validations on network configs do not pass, this error will be raised.
653653
`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.
654+
`50`|The plugin is not available (i.e. cannot service `ADD` requests)
655+
`51`|The plugin is not available, and existing containers in the network may have limited connectivity.
654656

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

pkg/types/types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func (r *Route) Copy() *Route {
229229
}
230230

231231
// Well known error codes
232-
// see https://github.com/containernetworking/cni/blob/main/SPEC.md#well-known-error-codes
232+
// see https://github.com/containernetworking/cni/blob/main/SPEC.md#error
233233
const (
234234
ErrUnknown uint = iota // 0
235235
ErrIncompatibleCNIVersion // 1
@@ -241,6 +241,8 @@ const (
241241
ErrInvalidNetworkConfig // 7
242242
ErrInvalidNetNS // 8
243243
ErrTryAgainLater uint = 11
244+
ErrPluginNotAvailable uint = 50
245+
ErrLimitedConnectivity uint = 51
244246
ErrInternal uint = 999
245247
)
246248

0 commit comments

Comments
 (0)