Documentation ¶
Index ¶
Constants ¶
const ( // StateReady is ready state, it means sandbox container // is running. StateReady = iota // StateNotReady is notready state, it ONLY means sandbox // container is not running. // StopPodSandbox should still be called for NOTREADY sandbox to // cleanup resources other than sandbox container, e.g. network namespace. // This is an assumption made in CRI. StateNotReady // StateUnknown is unknown state. Sandbox only goes // into unknown state when its status fails to be loaded. StateUnknown )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata struct { // ID is the sandbox id. ID string // Name is the sandbox name. Name string // Config is the CRI sandbox config. Config *runtime.PodSandboxConfig // NetNSPath is the network namespace used by the sandbox. NetNSPath string // IP of Pod if it is attached to non host network IP string // AdditionalIPs of the Pod if it is attached to non host network AdditionalIPs []string // RuntimeHandler is the runtime handler name of the pod. RuntimeHandler string // CNIresult resulting configuration for attached network namespace interfaces CNIResult *cni.CNIResult }
Metadata is the unversioned sandbox metadata.
func (*Metadata) MarshalJSON ¶
MarshalJSON encodes Metadata into bytes in json format.
func (*Metadata) UnmarshalJSON ¶
UnmarshalJSON decodes Metadata from bytes.
type Sandbox ¶
type Sandbox struct { // Metadata is the metadata of the sandbox, it is immutable after created. Metadata // Status stores the status of the sandbox. Status StatusStorage // Container is the containerd sandbox container client. Container containerd.Container // CNI network namespace client. // For hostnetwork pod, this is always nil; // For non hostnetwork pod, this should never be nil. NetNS *netns.NetNS // StopCh is used to propagate the stop information of the sandbox. *store.StopCh }
Sandbox contains all resources associated with the sandbox. All methods to mutate the internal state are thread safe.
func NewSandbox ¶
NewSandbox creates an internally used sandbox type. This functions reminds the caller that a sandbox must have a status.
type State ¶
type State uint32
State is the sandbox state we use in containerd/cri. It includes unknown, which is internal states not defined in CRI. The state mapping from internal states to CRI states: * ready -> ready * not ready -> not ready * unknown -> not ready
type Status ¶
type Status struct { // Pid is the init process id of the sandbox container. Pid uint32 // CreatedAt is the created timestamp. CreatedAt time.Time // State is the state of the sandbox. State State }
Status is the status of a sandbox.
type StatusStorage ¶
type StatusStorage interface { // Get a sandbox status. Get() Status // Update the sandbox status. Note that the update MUST be applied // in one transaction. Update(UpdateFunc) error }
StatusStorage manages the sandbox status. The status storage for sandbox is different from container status storage, because we don't checkpoint sandbox status. If we need checkpoint in the future, we should combine this with container status storage.
func StoreStatus ¶
func StoreStatus(status Status) StatusStorage
StoreStatus creates the storage containing the passed in sandbox status with the specified id. The status MUST be created in one transaction.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores all sandboxes.
type UpdateFunc ¶
UpdateFunc is function used to update the sandbox status. If there is an error, the update will be rolled back.