Documentation ¶
Overview ¶
Modifed from https://github.com/openfaas/faasd/blob/master/pkg/cninetwork/cni_network.go
Index ¶
- Variables
- func CNIGateway() (string, error)
- func CreateCNINetwork(ctx context.Context, fn *pb.Function) (*gocni.Result, error)
- func DeleteCNINetwork(ctx context.Context, fn *pb.Function) error
- func GetIPAddress(fn *pb.Function) (string, error)
- func GetIPAddressRaw(container string, PID int64) (string, error)
- func Init(config *types.NetworkOption) error
- func NSPathByPid(pid int) string
- func NSPathByPidWithRoot(root string, pid int) string
- func Uninstall() error
- func WithNetNS(ns netns.NsHandle, work func() error) (err error)
- func WithNetNSByPath(path string, work func() error) error
- func WithNetNSLink(ns netns.NsHandle, ifName string, work func(link netlink.Link) error) error
- type CNIManager
- func (m *CNIManager) CNIGateway() (string, error)
- func (m *CNIManager) CreateCNINetwork(ctx context.Context, fn *pb.Function) (*gocni.Result, error)
- func (m *CNIManager) DeleteCNINetwork(ctx context.Context, fn *pb.Function) error
- func (m *CNIManager) GenerateJSON() []byte
- func (m *CNIManager) GetIPAddress(fn *pb.Function) (string, error)
- func (m *CNIManager) GetIPAddressRaw(container string, PID int64) (string, error)
- func (m *CNIManager) Init(config *types.NetworkOption) error
- func (m *CNIManager) NetID(id string, pid int64) string
- func (m *CNIManager) NetNamespace(fn *pb.Function) string
- func (m *CNIManager) Uninstall() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLinkNotFound = errors.New("link not found")
Functions ¶
func CNIGateway ¶
func CreateCNINetwork ¶
func Init ¶
func Init(config *types.NetworkOption) error
InitNetwork initialize the default cni manager
func NSPathByPid ¶
func NSPathByPidWithRoot ¶
func WithNetNSByPath ¶
Types ¶
type CNIManager ¶
type CNIManager struct {
// contains filtered or unexported fields
}
var (
DefaultManager *CNIManager
)
func (*CNIManager) CNIGateway ¶
func (m *CNIManager) CNIGateway() (string, error)
CNIGateway returns the gateway for default subnet
func (*CNIManager) CreateCNINetwork ¶
CreateCNINetwork creates a CNI network interface and attaches it to the context
func (*CNIManager) DeleteCNINetwork ¶
DeleteCNINetwork deletes a CNI network based on container's id and pid
func (*CNIManager) GenerateJSON ¶
func (m *CNIManager) GenerateJSON() []byte
func (*CNIManager) GetIPAddress ¶
func (m *CNIManager) GetIPAddress(fn *pb.Function) (string, error)
GetIPAddress returns the IP address from container based on container name and PID
func (*CNIManager) GetIPAddressRaw ¶
func (m *CNIManager) GetIPAddressRaw(container string, PID int64) (string, error)
func (*CNIManager) Init ¶
func (m *CNIManager) Init(config *types.NetworkOption) error
InitNetwork initialize the default cni network for all function containers
func (*CNIManager) NetID ¶
func (m *CNIManager) NetID(id string, pid int64) string
NetID generates the network IF based on task name and task PID
func (*CNIManager) NetNamespace ¶
func (m *CNIManager) NetNamespace(fn *pb.Function) string
NetNamespace generates the namespace path based on task PID.
Click to show internal directories.
Click to hide internal directories.