configs

package
v0.0.0-...-28e6f37 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cgroup

type Cgroup struct {
	// Resources contains various cgroups settings to apply
	// 继承
	*Resources
}

type ContainerConfig

type ContainerConfig struct {
	// Path to a directory containing the container's root filesystem.
	Rootfs string `json:"rootfs"`

	// Readonlyfs will remount the container's rootfs as readonly where only externally mounted
	// bind mounts are writtable.
	Readonlyfs bool `json:"readonlyfs"`

	// Mounts specify additional source and destination paths that will be mounted inside the container's
	// rootfs and mount namespace if specified
	Mounts []*Mount `json:"mounts"`

	// The device nodes that should be automatically created within the container upon container start.
	// Note, make sure that the node is marked as allowed in the cgroup as well!
	Devices []*Device `json:"devices"`

	// Hostname optionally sets the container's hostname if provided
	Hostname string `json:"hostname"`

	// Namespaces specifies the container's namespaces that it should setup when cloning the init process
	// If a namespace is not provided that namespace is shared from the container's parent process
	Namespaces Namespaces `json:"namespaces"`

	// Endpoint specifies the container's network setup to be created
	Endpoint EndpointConfig `json:"endpoint"`

	// Cgroup specifies specific cgroup settings for the various subsystems that the container is
	// placed into to limit the resources the container has available
	Cgroup *Cgroup `json:"cgroups"`

	// Sysctl is a map of properties and their values. It is the equivalent of using
	// sysctl -w my.property.name value in Linux.
	Sysctl map[string]string `json:"sysctl"`

	// Version is the version of opencontainer specification that is supported.
	Version string `json:"version"`

	// Labels are user defined metadata that is stored in the config and populated on the state
	Labels []string `json:"labels"`
}

type Device

type Device struct {
	// Device type, block, char, etc.
	Type rune `json:"type"`

	// Path to the device.
	Path string `json:"path"`

	// Major is the device's major number.
	// major number:表示不同的设备类型
	// minor number:表示同一个设备的的不同分区
	Major int64 `json:"major"`

	// Minor is the device's minor number.
	Minor int64 `json:"minor"`

	// Cgroup permissions format, rwm.
	Permissions string `json:"permissions"`

	// FileMode permission bits for the device.
	FileMode os.FileMode `json:"file_mode"`

	// Uid of the device.
	Uid uint32 `json:"uid"`

	// Gid of the device.
	Gid uint32 `json:"gid"`
}

func (*Device) Mkdev

func (d *Device) Mkdev() int

type EndpointConfig

type EndpointConfig struct {
	// uuid
	ID           string   `json:"id"`
	NetworkName  string   `json:"network_name"`
	PortMappings []string `json:"port_mappings"`
}

type Mount

type Mount struct {
	// Source path for the mount.
	Source string `json:"source"`

	// Destination path for the mount inside the container.
	Destination string `json:"destination"`

	// Device the mount is for.
	Device string `json:"device"`

	// Mount flags.
	Flags int `json:"flags"`

	// Mount data applied to the mount.
	Data string `json:"data"`
}

type Namespace

type Namespace struct {
	Type NamespaceType `json:"type"`
	Path string        `json:"path"`
}

Namespace defines configuration for each namespace. It specifies an alternate path that is able to be joined via setns.

func (*Namespace) GetPath

func (n *Namespace) GetPath(pid int) string

type NamespaceType

type NamespaceType string
const (
	NEWNET NamespaceType = "NEWNET"
	NEWPID NamespaceType = "NEWPID"
	NEWNS  NamespaceType = "NEWNS"
	NEWUTS NamespaceType = "NEWUTS"
	NEWIPC NamespaceType = "NEWIPC"
)

func AllNamespaceTypes

func AllNamespaceTypes() []NamespaceType

func (NamespaceType) NsFlag

func (ns NamespaceType) NsFlag() uintptr

NsFlag converts the namespace type to its flag

func (NamespaceType) NsName

func (ns NamespaceType) NsName() string

NsName converts the namespace type to its filename

type Namespaces

type Namespaces []Namespace

func (*Namespaces) Add

func (n *Namespaces) Add(t NamespaceType, path string)

func (*Namespaces) CloneFlagsOfEmptyPath

func (n *Namespaces) CloneFlagsOfEmptyPath() uintptr

func (*Namespaces) Contains

func (n *Namespaces) Contains(t NamespaceType) bool

func (*Namespaces) PathOf

func (n *Namespaces) PathOf(t NamespaceType) string

func (*Namespaces) Remove

func (n *Namespaces) Remove(t NamespaceType) bool

type Resources

type Resources struct {
	// Memory limit (in bytes)
	Memory int64 `json:"memory"`

	// CPU shares (relative weight vs. other containers)
	CpuShares uint64 `json:"cpu_shares"`

	// CPU to use
	CpusetCpus string `json:"cpuset_cpus"`
}

Jump to

Keyboard shortcuts

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