Documentation ¶
Index ¶
- Constants
- func CallPlugin(plugin PluginApi, cmd string, args *cniSkel.CmdArgs, nwCfg *NetworkConfig) (*cniTypes.Result, error)
- func GetPoliciesFromNwCfg(kvp []KVPair) []policy.Policy
- type K8SPodEnvArgs
- type KVPair
- type NetworkConfig
- type Plugin
- func (plugin *Plugin) DelegateAdd(pluginName string, nwCfg *NetworkConfig) (*cniTypesCurr.Result, error)
- func (plugin *Plugin) DelegateDel(pluginName string, nwCfg *NetworkConfig) error
- func (plugin *Plugin) Error(err error) *cniTypes.Error
- func (plugin *Plugin) Errorf(format string, args ...interface{}) *cniTypes.Error
- func (plugin *Plugin) Execute(api PluginApi) (err error)
- func (plugin *Plugin) Initialize(config *common.PluginConfig) error
- func (plugin *Plugin) InitializeKeyValueStore(config *common.PluginConfig) error
- func (plugin *Plugin) Uninitialize()
- func (plugin *Plugin) UninitializeKeyValueStore() error
- type PluginApi
- type PortMapping
- type RuntimeConfig
Constants ¶
const ( // CNI commands. Cmd = "CNI_COMMAND" CmdAdd = "ADD" CmdGet = "GET" CmdDel = "DEL" CmdUpdate = "UPDATE" // CNI errors. ErrRuntime = 100 )
const (
Internal = "internal"
)
const (
PolicyStr string = "Policy"
)
Variables ¶
This section is empty.
Functions ¶
func CallPlugin ¶
func CallPlugin(plugin PluginApi, cmd string, args *cniSkel.CmdArgs, nwCfg *NetworkConfig) (*cniTypes.Result, error)
CallPlugin calls the given CNI plugin through the internal interface.
func GetPoliciesFromNwCfg ¶
GetPoliciesFromNwCfg returns network policies from network config.
Types ¶
type K8SPodEnvArgs ¶
type K8SPodEnvArgs struct { cniTypes.CommonArgs K8S_POD_NAMESPACE cniTypes.UnmarshallableString `json:"K8S_POD_NAMESPACE,omitempty"` K8S_POD_NAME cniTypes.UnmarshallableString `json:"K8S_POD_NAME,omitempty"` K8S_POD_INFRA_CONTAINER_ID cniTypes.UnmarshallableString `json:"K8S_POD_INFRA_CONTAINER_ID,omitempty"` }
func ParseCniArgs ¶
func ParseCniArgs(args string) (*K8SPodEnvArgs, error)
ParseCniArgs unmarshals cni arguments.
type KVPair ¶
type KVPair struct { Name string `json:"name"` Value json.RawMessage `json:"value"` }
KVPair represents a K-V pair of a json object.
type NetworkConfig ¶
type NetworkConfig struct { CNIVersion string `json:"cniVersion"` Name string `json:"name"` Type string `json:"type"` Mode string `json:"mode"` Master string `json:"master"` Bridge string `json:"bridge,omitempty"` LogLevel string `json:"logLevel,omitempty"` LogTarget string `json:"logTarget,omitempty"` InfraVnetAddressSpace string `json:"infraVnetAddressSpace,omitempty"` PodNamespaceForDualNetwork []string `json:"podNamespaceForDualNetwork,omitempty"` MultiTenancy bool `json:"multiTenancy,omitempty"` EnableSnatOnHost bool `json:"enableSnatOnHost,omitempty"` EnableExactMatchForPodName bool `json:"enableExactMatchForPodName,omitempty"` CNSUrl string `json:"cnsurl,omitempty"` Ipam struct { Type string `json:"type"` Environment string `json:"environment,omitempty"` AddrSpace string `json:"addressSpace,omitempty"` Subnet string `json:"subnet,omitempty"` Address string `json:"ipAddress,omitempty"` QueryInterval string `json:"queryInterval,omitempty"` } DNS cniTypes.DNS `json:"dns"` RuntimeConfig RuntimeConfig `json:"runtimeConfig"` AdditionalArgs []KVPair }
NetworkConfig represents Azure CNI plugin network configuration.
func ParseNetworkConfig ¶
func ParseNetworkConfig(b []byte) (*NetworkConfig, error)
ParseNetworkConfig unmarshals network configuration from bytes.
func (*NetworkConfig) Serialize ¶
func (nwcfg *NetworkConfig) Serialize() []byte
Serialize marshals a network configuration to bytes.
type Plugin ¶
Plugin is the parent class for CNI plugins.
func (*Plugin) DelegateAdd ¶
func (plugin *Plugin) DelegateAdd(pluginName string, nwCfg *NetworkConfig) (*cniTypesCurr.Result, error)
DelegateAdd calls the given plugin's ADD command and returns the result.
func (*Plugin) DelegateDel ¶
func (plugin *Plugin) DelegateDel(pluginName string, nwCfg *NetworkConfig) error
DelegateDel calls the given plugin's DEL command and returns the result.
func (*Plugin) Initialize ¶
func (plugin *Plugin) Initialize(config *common.PluginConfig) error
Initialize initializes the plugin.
func (*Plugin) InitializeKeyValueStore ¶
func (plugin *Plugin) InitializeKeyValueStore(config *common.PluginConfig) error
Initialize key-value store
func (*Plugin) Uninitialize ¶
func (plugin *Plugin) Uninitialize()
Uninitialize uninitializes the plugin.
func (*Plugin) UninitializeKeyValueStore ¶
Uninitialize key-value store
type PluginApi ¶
type PluginApi interface { Add(args *cniSkel.CmdArgs) error Get(args *cniSkel.CmdArgs) error Delete(args *cniSkel.CmdArgs) error Update(args *cniSkel.CmdArgs) error }
CNI contract.
type PortMapping ¶
type RuntimeConfig ¶
type RuntimeConfig struct {
PortMappings []PortMapping `json:"portMappings,omitempty"`
}