sandbox

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func HostNetNsPath() (string, error)

HostNetNsPath returns the current network namespace for the host

Types

type NetNs

type NetNs struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NetNs handles data pertaining a network namespace

func NetNsGet

func NetNsGet(nspath, name string) (*NetNs, error)

NetNsGet returns the NetNs associated with the given nspath and name

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) (*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

func (s *Sandbox) AddContainer(c *oci.Container)

AddContainer adds a container to the sandbox

func (*Sandbox) AddHostnamePath

func (s *Sandbox) AddHostnamePath(hostname string)

AddHostnamePath adds the hostname path to the sandbox

func (*Sandbox) AddIP

func (s *Sandbox) AddIP(ip string)

AddIP stores the ip in the sandbox

func (*Sandbox) Annotations

func (s *Sandbox) Annotations() map[string]string

Annotations returns a list of annotations for the sandbox

func (*Sandbox) CgroupParent

func (s *Sandbox) CgroupParent() string

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

func (s *Sandbox) GetContainer(name string) *oci.Container

GetContainer retrieves a container from the sandbox

func (*Sandbox) Hostname

func (s *Sandbox) Hostname() string

Hostname returns the hsotname of the sandbox

func (*Sandbox) HostnamePath

func (s *Sandbox) HostnamePath() string

HostnamePath retrieves the hostname path from a sandbox

func (*Sandbox) ID

func (s *Sandbox) ID() string

ID returns the id of the sandbox

func (*Sandbox) IP

func (s *Sandbox) IP() string

IP returns the ip of the sandbox

func (*Sandbox) InfraContainer

func (s *Sandbox) InfraContainer() *oci.Container

InfraContainer returns the infrastructure container for the sandbox

func (*Sandbox) KubeName

func (s *Sandbox) KubeName() string

KubeName returns the kubernetes name for the sandbox

func (*Sandbox) Labels

func (s *Sandbox) Labels() fields.Set

Labels returns the labels associated with the sandbox

func (*Sandbox) LogDir

func (s *Sandbox) LogDir() string

LogDir returns the location of the logging directory for the sandbox

func (*Sandbox) Metadata

func (s *Sandbox) Metadata() *pb.PodSandboxMetadata

Metadata returns a set of metadata about the sandbox

func (*Sandbox) MountLabel

func (s *Sandbox) MountLabel() string

MountLabel returns the mount label for the sandbox

func (*Sandbox) Name

func (s *Sandbox) Name() string

Name returns the name of the sandbox

func (*Sandbox) Namespace

func (s *Sandbox) Namespace() string

Namespace returns the namespace for the sandbox

func (*Sandbox) NetNs

func (s *Sandbox) NetNs() ns.NetNS

NetNs retrieves the network namespace of the sandbox If the sandbox uses the host namespace, nil is returned

func (*Sandbox) NetNsCreate

func (s *Sandbox) NetNsCreate() error

NetNsCreate creates a new network namespace for the sandbox

func (*Sandbox) NetNsJoin

func (s *Sandbox) NetNsJoin(nspath, name string) error

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

func (s *Sandbox) NetNsPath() string

NetNsPath returns the path to the network namespace of the sandbox. If the sandbox uses the host namespace, nil is returned

func (*Sandbox) NetNsRemove

func (s *Sandbox) NetNsRemove() error

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

func (s *Sandbox) Privileged() bool

Privileged returns whether or not the containers in the sandbox are privileged containers

func (*Sandbox) ProcessLabel

func (s *Sandbox) ProcessLabel() string

ProcessLabel returns the process label for the sandbox

func (*Sandbox) RemoveContainer

func (s *Sandbox) RemoveContainer(c *oci.Container)

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

func (s *Sandbox) ResolvPath() string

ResolvPath returns the resolv path for the sandbox

func (*Sandbox) SeccompProfilePath added in v1.8.0

func (s *Sandbox) SeccompProfilePath() string

SeccompProfilePath returns the seccomp profile path

func (*Sandbox) SetInfraContainer

func (s *Sandbox) SetInfraContainer(infraCtr *oci.Container) error

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 added in v1.8.0

func (s *Sandbox) SetSeccompProfilePath(pp string)

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.

func (*Sandbox) ShmPath

func (s *Sandbox) ShmPath() string

ShmPath returns the shm path of the sandbox

func (*Sandbox) Stopped

func (s *Sandbox) Stopped() bool

Stopped returns whether the sandbox state has been set to stopped.

func (*Sandbox) Trusted

func (s *Sandbox) Trusted() bool

Trusted returns whether or not the containers in the sandbox are trusted

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL