Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FDClient ¶
type FDClient struct {
// contains filtered or unexported fields
}
FDClient can be used to connect to an FDServer listening on a Unix domain socket
func NewFDClient ¶
NewFDClient returns an FDClient for specified socket path
func (*FDClient) AddFD ¶
AddFD requests the FDServer to add a new file descriptor using its FDSource. It returns the info which is returned by FDSource's GetFD() call
func (*FDClient) Connect ¶
Connect makes FDClient connect to its socket. You must call Connect() method to be able to use the FDClient
type FDManager ¶
type FDManager interface {
AddFD(key string, data interface{}) ([]byte, error)
ReleaseFD(key string) error
}
FDManager denotes an object that provides 'master'-side functionality of FDClient
type FDServer ¶
FDServer listens on a Unix domain socket, serving requests to create, destroy and obtain file descriptors. It serves the purpose of sending the file descriptors across mount namespace boundaries, as well as making it easier to work around the Go namespace problem (to be fixed in Go 1.10): https://www.weave.works/blog/linux-namespaces-and-go-don-t-mix When the Go namespace problem is resolved, it should be possible to dumb down FDServer by making it only serve GetFD() requests, performing other actions within the process boundary.
func NewFDServer ¶
NewFDServer returns an FDServer for the specified socket path and an FDSource
type FDSource ¶
type FDSource interface {
// GetFD sets up a file descriptor based on key
// and extra data. It should return the file descriptor,
// any data that should be passed back to the client
// invoking AddFD() and an error, if any.
GetFD(key string, data []byte) (int, []byte, error)
// Release destroys (closes) the file descriptor and
// any associated resources
Release(key string) error
// GetInfo returns the information which needs to be
// propagated back the FDClient upon GetFD() call
GetInfo(key string) ([]byte, error)
}
FDSource denotes an 'executive' part for FDServer which creates and destroys (closes) the file descriptors and associated resources
type GetFDPayload ¶
type GetFDPayload struct {
// Description specifies pod network description for already
// prepared network configuration
Description *PodNetworkDesc `json:"podNetworkDesc"`
// CNIConfig specifies CNI configuration used to configure retaken
// environment
CNIConfig *cnicurrent.Result `json:"cniConfig"`
}
GetFDPayload contains the data that are required by TapFDSource to recover the tap device that was already configured, or create a new one if CNIConfig is nil
type PodNetworkDesc ¶
type PodNetworkDesc struct {
// PodId specifies the id of the pod
PodId string `json:"podId"`
// PodNs specifies the namespace of the pod
PodNs string `json:"podNs"`
// PodName specifies the name of the pod
PodName string `json:"podName"`
// DNS specifies DNS settings for the pod
DNS *cnitypes.DNS
}
PodNetworkDesc contains the data that are required by TapFDSource to set up a tap device for a VM
type TapFDSource ¶
TapFDSource sets up and tears down Virtlet VM network. It implements FDSource interface
func NewTapFDSource ¶
func NewTapFDSource(cniPluginsDir, cniConfigsDir string) (*TapFDSource, error)
NewTapFDSource returns a TapFDSource for the specified CNI plugin & config dir
func (*TapFDSource) GetInfo ¶
func (s *TapFDSource) GetInfo(key string) ([]byte, error)
GetInfo implements GetInfo method of FDSource interface
func (*TapFDSource) Release ¶
func (s *TapFDSource) Release(key string) error
Release implements Release method of FDSource interface