2017-02-12 13:03:39 +03:00
|
|
|
// Copyright 2017 Microsoft. All rights reserved.
|
|
|
|
// MIT License
|
2016-12-01 05:00:08 +03:00
|
|
|
|
|
|
|
package cni
|
|
|
|
|
|
|
|
import (
|
2016-12-10 05:05:33 +03:00
|
|
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2017-01-20 03:34:03 +03:00
|
|
|
// CNI commands.
|
2021-08-11 21:21:14 +03:00
|
|
|
Cmd = "CNI_COMMAND"
|
|
|
|
// CmdAdd - CNI ADD command.
|
|
|
|
CmdAdd = "ADD"
|
|
|
|
// CmdGet - CNI GET command.
|
|
|
|
CmdGet = "GET"
|
|
|
|
// CmdDel - CNI DEL command.
|
|
|
|
CmdDel = "DEL"
|
|
|
|
// CmdUpdate - CNI UPDATE command.
|
2018-10-29 21:10:27 +03:00
|
|
|
CmdUpdate = "UPDATE"
|
2021-08-11 21:21:14 +03:00
|
|
|
// CmdVersion - CNI VERSION command.
|
|
|
|
CmdVersion = "VERSION"
|
2017-05-10 05:29:15 +03:00
|
|
|
|
2021-06-12 00:01:42 +03:00
|
|
|
// nonstandard CNI spec command, used to dump CNI state to stdout
|
|
|
|
CmdGetEndpointsState = "GET_ENDPOINT_STATE"
|
|
|
|
|
2017-06-16 22:03:54 +03:00
|
|
|
// CNI errors.
|
|
|
|
ErrRuntime = 100
|
|
|
|
|
2017-05-10 05:29:15 +03:00
|
|
|
// DefaultVersion is the CNI version used when no version is specified in a network config file.
|
|
|
|
defaultVersion = "0.2.0"
|
2016-12-01 05:00:08 +03:00
|
|
|
)
|
|
|
|
|
2017-02-06 10:52:35 +03:00
|
|
|
// Supported CNI versions.
|
2024-07-11 19:05:28 +03:00
|
|
|
var supportedVersions = []string{"0.1.0", "0.2.0", "0.3.0", "0.3.1", "0.4.0", "1.0.0"}
|
2017-02-06 10:52:35 +03:00
|
|
|
|
2016-12-10 05:05:33 +03:00
|
|
|
// CNI contract.
|
2017-01-25 02:21:57 +03:00
|
|
|
type PluginApi interface {
|
2016-12-10 05:05:33 +03:00
|
|
|
Add(args *cniSkel.CmdArgs) error
|
2018-06-02 03:48:19 +03:00
|
|
|
Get(args *cniSkel.CmdArgs) error
|
2016-12-10 05:05:33 +03:00
|
|
|
Delete(args *cniSkel.CmdArgs) error
|
2018-10-29 21:10:27 +03:00
|
|
|
Update(args *cniSkel.CmdArgs) error
|
2016-12-10 05:05:33 +03:00
|
|
|
}
|