Documentation
¶
Index ¶
- func Init() (err error)
- func NewNSenterService() domain.NSenterServiceIface
- type NSenterEvent
- func (e *NSenterEvent) GetProcessID() uint32
- func (e *NSenterEvent) GetRequestMsg() *domain.NSenterMessage
- func (e *NSenterEvent) GetResponseMsg() *domain.NSenterMessage
- func (e *NSenterEvent) ReceiveResponse() *domain.NSenterMessage
- func (e *NSenterEvent) SendRequest() error
- func (e *NSenterEvent) SetRequestMsg(m *domain.NSenterMessage)
- func (e *NSenterEvent) SetResponseMsg(m *domain.NSenterMessage)
- func (e *NSenterEvent) TerminateRequest() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init() (err error)
nsenter process initialization function. To be executed within the context of one (or more) container namespaces.
func NewNSenterService ¶
func NewNSenterService() domain.NSenterServiceIface
Types ¶
type NSenterEvent ¶
type NSenterEvent struct {
// Credentials for the process on whose behalf sysbox-fs is creating the nsenter event.
Pid uint32 `json:"pid"`
Uid uint32 `json:"uid"`
Gid uint32 `json:"gid"`
// namespace-types to attach to.
Namespace *[]domain.NStype `json:"namespace"`
// namepsaces to create (i.e., unshare)
CloneFlags uint32
// Request message to be sent.
ReqMsg *domain.NSenterMessage `json:"request"`
// Response message to be received.
ResMsg *domain.NSenterMessage `json:"response"`
// Nsenter process carrying out the nsexec instruction.
Process *os.Process `json:"process"`
// Asynchronous flag to tag events for which no response is expected.
Async bool
// contains filtered or unexported fields
}
NSenterEvent struct serves as a transport abstraction (envelope) to carry all the potential messages that can be exchanged between sysbox-fs master instance and secondary (forked) ones (aka child nsenter processes). These nsenter processes are dispatched to perform actions inside the container namespaces (e.g,. open files, mounts, etc.) which cannot be executed by sysbox-fs' main instance.
Every bidirectional transaction is represented by an event structure (nsenterEvent), which holds both 'request' and 'response' messages, as well as the context necessary to complete any action demanding inter-namespace message exchanges.
func (*NSenterEvent) GetProcessID ¶
func (e *NSenterEvent) GetProcessID() uint32
func (*NSenterEvent) GetRequestMsg ¶
func (e *NSenterEvent) GetRequestMsg() *domain.NSenterMessage
func (*NSenterEvent) GetResponseMsg ¶
func (e *NSenterEvent) GetResponseMsg() *domain.NSenterMessage
func (*NSenterEvent) ReceiveResponse ¶
func (e *NSenterEvent) ReceiveResponse() *domain.NSenterMessage
func (*NSenterEvent) SendRequest ¶
func (e *NSenterEvent) SendRequest() error
Sysbox-fs nsenter requests are generated through this method. Handlers seeking to access namespaced resources will call this method to dispatch an nsenter agent, which will enter the container namespaces to perform the requested operations.
func (*NSenterEvent) SetRequestMsg ¶
func (e *NSenterEvent) SetRequestMsg(m *domain.NSenterMessage)
func (*NSenterEvent) SetResponseMsg ¶
func (e *NSenterEvent) SetResponseMsg(m *domain.NSenterMessage)
func (*NSenterEvent) TerminateRequest ¶
func (e *NSenterEvent) TerminateRequest() error
TerminateRequest serves to unwind the nsenter-event FSM after the generation of an asynchronous event. This method is not required for regular nsenter events, as in those cases the SendRequest() method itself takes care of cleaning all the utilized resources.