Documentation ¶
Index ¶
- Constants
- Variables
- func HostNetNsPath() (string, error)
- type History
- type NetNs
- type Sandbox
- func (s *Sandbox) AddContainer(c *oci.Container)
- func (s *Sandbox) AddHostnamePath(hostname string)
- func (s *Sandbox) AddIP(ip string)
- func (s *Sandbox) Annotations() map[string]string
- func (s *Sandbox) CgroupParent() string
- func (s *Sandbox) Containers() oci.ContainerStorer
- func (s *Sandbox) GetContainer(name string) *oci.Container
- func (s *Sandbox) HostNetwork() bool
- func (s *Sandbox) Hostname() string
- func (s *Sandbox) HostnamePath() string
- func (s *Sandbox) ID() string
- func (s *Sandbox) IP() string
- func (s *Sandbox) InfraContainer() *oci.Container
- func (s *Sandbox) KubeName() string
- func (s *Sandbox) Labels() fields.Set
- func (s *Sandbox) LogDir() string
- func (s *Sandbox) Metadata() *pb.PodSandboxMetadata
- func (s *Sandbox) MountLabel() string
- func (s *Sandbox) Name() string
- func (s *Sandbox) Namespace() string
- func (s *Sandbox) NetNs() ns.NetNS
- func (s *Sandbox) NetNsCreate() error
- func (s *Sandbox) NetNsJoin(nspath, name string) error
- func (s *Sandbox) NetNsPath() string
- func (s *Sandbox) NetNsRemove() error
- func (s *Sandbox) PortMappings() []*hostport.PortMapping
- func (s *Sandbox) Privileged() bool
- func (s *Sandbox) ProcessLabel() string
- func (s *Sandbox) RemoveContainer(c *oci.Container)
- func (s *Sandbox) RemoveInfraContainer()
- func (s *Sandbox) ResolvPath() string
- func (s *Sandbox) SeccompProfilePath() string
- func (s *Sandbox) SetInfraContainer(infraCtr *oci.Container) error
- func (s *Sandbox) SetSeccompProfilePath(pp string)
- func (s *Sandbox) SetStopped()
- func (s *Sandbox) ShmPath() string
- func (s *Sandbox) Stopped() bool
- func (s *Sandbox) Trusted() bool
- type StoreFilter
- type StoreReducer
- type Storer
Constants ¶
const ( // DefaultShmSize is the default shm size DefaultShmSize = 64 * 1024 * 1024 // NsRunDir is the default directory in which running network namespaces // are stored NsRunDir = "/var/run/netns" // PodInfraCommand is the default command when starting a pod infrastructure // container PodInfraCommand = "/pause" )
Variables ¶
var ( // ErrIDEmpty is the erro returned when the id of the sandbox is empty ErrIDEmpty = errors.New("PodSandboxId should not be empty") // ErrClosedNetNS is the error returned when the network namespace of the // sandbox is closed ErrClosedNetNS = errors.New("PodSandbox networking namespace is closed") )
Functions ¶
func HostNetNsPath ¶
HostNetNsPath returns the current network namespace for the host
Types ¶
type History ¶
type History []*Sandbox
History is a convenience type for storing a list of sandboxes, sorted by creation date in descendant order.
type Sandbox ¶
type Sandbox struct {
// contains filtered or unexported fields
}
Sandbox contains data surrounding kubernetes sandboxes on the server
func New ¶
func New(id, namespace, name, kubeName, logDir string, labels, annotations map[string]string, processLabel, mountLabel string, metadata *pb.PodSandboxMetadata, shmPath, cgroupParent string, privileged, trusted bool, resolvPath, hostname string, portMappings []*hostport.PortMapping, hostNetwork bool) (*Sandbox, error)
New creates and populates a new pod sandbox New sandboxes have no containers, no infra container, and no network namespaces associated with them An infra container must be attached before the sandbox is added to the state
func (*Sandbox) AddContainer ¶
AddContainer adds a container to the sandbox
func (*Sandbox) AddHostnamePath ¶
AddHostnamePath adds the hostname path to the sandbox
func (*Sandbox) Annotations ¶
Annotations returns a list of annotations for the sandbox
func (*Sandbox) CgroupParent ¶
CgroupParent returns the cgroup parent of the sandbox
func (*Sandbox) Containers ¶
func (s *Sandbox) Containers() oci.ContainerStorer
Containers returns the ContainerStorer that contains information on all of the containers in the sandbox
func (*Sandbox) GetContainer ¶
GetContainer retrieves a container from the sandbox
func (*Sandbox) HostNetwork ¶ added in v1.9.8
HostNetwork returns whether the sandbox runs in the host network namespace
func (*Sandbox) HostnamePath ¶
HostnamePath retrieves the hostname path from a sandbox
func (*Sandbox) InfraContainer ¶
InfraContainer returns the infrastructure container for the sandbox
func (*Sandbox) Metadata ¶
func (s *Sandbox) Metadata() *pb.PodSandboxMetadata
Metadata returns a set of metadata about the sandbox
func (*Sandbox) MountLabel ¶
MountLabel returns the mount label for the sandbox
func (*Sandbox) NetNs ¶
NetNs retrieves the network namespace of the sandbox If the sandbox uses the host namespace, nil is returned
func (*Sandbox) NetNsCreate ¶
NetNsCreate creates a new network namespace for the sandbox
func (*Sandbox) NetNsJoin ¶
NetNsJoin attempts to join the sandbox to an existing network namespace This will fail if the sandbox is already part of a network namespace
func (*Sandbox) NetNsPath ¶
NetNsPath returns the path to the network namespace of the sandbox. If the sandbox uses the host namespace, nil is returned
func (*Sandbox) NetNsRemove ¶
NetNsRemove removes the network namespace associated with the sandbox
func (*Sandbox) PortMappings ¶
func (s *Sandbox) PortMappings() []*hostport.PortMapping
PortMappings returns a list of port mappings between the host and the sandbox
func (*Sandbox) Privileged ¶
Privileged returns whether or not the containers in the sandbox are privileged containers
func (*Sandbox) ProcessLabel ¶
ProcessLabel returns the process label for the sandbox
func (*Sandbox) RemoveContainer ¶
RemoveContainer deletes a container from the sandbox
func (*Sandbox) RemoveInfraContainer ¶
func (s *Sandbox) RemoveInfraContainer()
RemoveInfraContainer removes the infrastructure container of a sandbox
func (*Sandbox) ResolvPath ¶
ResolvPath returns the resolv path for the sandbox
func (*Sandbox) SeccompProfilePath ¶
SeccompProfilePath returns the seccomp profile path
func (*Sandbox) SetInfraContainer ¶
SetInfraContainer sets the infrastructure container of a sandbox Attempts to set the infrastructure container after one is already present will throw an error
func (*Sandbox) SetSeccompProfilePath ¶
SetSeccompProfilePath sets the seccomp profile path
func (*Sandbox) SetStopped ¶
func (s *Sandbox) SetStopped()
SetStopped sets the sandbox state to stopped. This should be set after a stop operation succeeds so that subsequent stops can return fast.
type StoreFilter ¶
StoreFilter defines a function to filter sandboxes in the store.
type StoreReducer ¶
type StoreReducer func(*Sandbox)
StoreReducer defines a function to manipulate sandboxes in the store
type Storer ¶
type Storer interface { // Add appends a new sandbox to the store. Add(string, *Sandbox) // Get returns a sandbox from the store by the identifier it was stored with. Get(string) *Sandbox // Delete removes a sandbox from the store by the identifier it was stored with. Delete(string) // List returns a list of sandboxes from the store. List() []*Sandbox // Size returns the number of sandboxes in the store. Size() int // First returns the first sandbox found in the store by a given filter. First(StoreFilter) *Sandbox // ApplyAll calls the reducer function with every sandbox in the store. ApplyAll(StoreReducer) }
Storer defines an interface that any container store must implement.