Documentation ¶
Index ¶
- Constants
- Variables
- func ConnectedToBridgeVethPeerIds(bridgeName string) ([]int, error)
- func CreateCNINetwork(ctx context.Context, cni gocni.CNI, task containerd.Task, ...) (*gocni.CNIResult, error)
- func DeleteCNINetwork(ctx context.Context, cni gocni.CNI, client *containerd.Client, name string) error
- func GetIPAddress(result *gocni.CNIResult, task containerd.Task) (net.IP, error)
- func GetIPfromPID(pid int) (*net.IP, error)
- func InitNetwork() (gocni.CNI, error)
- func ListFunctions(client *containerd.Client) (map[string]Function, error)
- func MakeDeleteHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
- func MakeDeployHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
- func MakeInfoHandler(version, sha string) http.HandlerFunc
- func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *http.Request)
- func MakeReplicaReaderHandler(client *containerd.Client) func(w http.ResponseWriter, r *http.Request)
- func MakeReplicaUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
- func MakeUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
- func NSPathByPid(pid int) string
- func NSPathByPidWithRoot(root string, pid int) string
- func NetID(task containerd.Task) string
- func NetNamespace(task containerd.Task) string
- func WithNetNS(ns netns.NsHandle, work func() error) error
- func WithNetNSByPath(path string, work func() error) error
- func WithNetNSLink(ns netns.NsHandle, ifName string, work func(link netlink.Link) error) error
- type Dev
- type Function
- type InvokeResolver
Constants ¶
const ( // CNIBinDir describes the directory where the CNI binaries are stored CNIBinDir = "/opt/cni/bin" // CNIConfDir describes the directory where the CNI plugin's configuration is stored CNIConfDir = "/etc/cni/net.d" // NetNSPathFmt gives the path to the a process network namespace, given the pid NetNSPathFmt = "/proc/%d/ns/net" )
const ( //OrchestrationIdentifier identifier string for provider orchestration OrchestrationIdentifier = "containerd" //ProviderName name of the provider ProviderName = "faas-containerd" )
const (
// FunctionNamespace is the containerd namespace functions are created
FunctionNamespace = "openfaas-fn"
)
Variables ¶
var ErrLinkNotFound = errors.New("Link not found")
Functions ¶
func ConnectedToBridgeVethPeerIds ¶
ConnectedToBridgeVethPeerIds returns peer indexes of veth links connected to the given bridge. The peer index is used to query from a container netns whether the container is connected to the bridge.
func CreateCNINetwork ¶
func CreateCNINetwork(ctx context.Context, cni gocni.CNI, task containerd.Task, labels map[string]string) (*gocni.CNIResult, error)
CreateCNINetwork creates a CNI network interface and attaches it to the context
func DeleteCNINetwork ¶
func DeleteCNINetwork(ctx context.Context, cni gocni.CNI, client *containerd.Client, name string) error
DeleteCNINetwork deletes a CNI network based on task ID and Pid
func GetIPAddress ¶
GetIPAddress returns the IP address of the created container
func InitNetwork ¶
InitNetwork writes configlist file and initializes CNI network
func ListFunctions ¶
func ListFunctions(client *containerd.Client) (map[string]Function, error)
ListFunctions returns a map of all functions with running tasks on namespace
func MakeDeleteHandler ¶
func MakeDeleteHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
func MakeDeployHandler ¶
func MakeDeployHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
func MakeInfoHandler ¶
func MakeInfoHandler(version, sha string) http.HandlerFunc
MakeInfoHandler creates handler for /system/info endpoint
func MakeReadHandler ¶
func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *http.Request)
func MakeReplicaReaderHandler ¶
func MakeReplicaReaderHandler(client *containerd.Client) func(w http.ResponseWriter, r *http.Request)
func MakeReplicaUpdateHandler ¶
func MakeReplicaUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
func MakeUpdateHandler ¶
func MakeUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w http.ResponseWriter, r *http.Request)
func NSPathByPid ¶
func NSPathByPidWithRoot ¶
func NetID ¶
func NetID(task containerd.Task) string
NetID generates the network IF based on task name and task PID
func NetNamespace ¶
func NetNamespace(task containerd.Task) string
NetNamespace generates the namespace path based on task PID.
func WithNetNSByPath ¶
Types ¶
type Dev ¶
type Dev struct { Name string `json:"Name,omitempty"` MAC net.HardwareAddr `json:"MAC,omitempty"` CIDRs []*net.IPNet `json:"CIDRs,omitempty"` }
func GetBridgeNetDev ¶
Get the weave bridge interface. NB: Should be called from the root network namespace.
func GetNetDevsByVethPeerIds ¶
func GetWeaveNetDevs ¶
Lookup the weave interface of a container
type Function ¶
type Function struct { IP string // contains filtered or unexported fields }
func GetFunction ¶
func GetFunction(client *containerd.Client, name string) (Function, error)
GetFunction returns a function that matches name
type InvokeResolver ¶
type InvokeResolver struct {
// contains filtered or unexported fields
}
func NewInvokeResolver ¶
func NewInvokeResolver(client *containerd.Client) *InvokeResolver