Remove spec types from runc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
e15b86edb9
commit
d8af59822b
34
spec.go
34
spec.go
|
@ -9,40 +9,6 @@ import (
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mount struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
Destination string `json:"destination"`
|
|
||||||
Options string `json:"options"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Process struct {
|
|
||||||
Terminal bool `json:"terminal"`
|
|
||||||
User User `json:"user"`
|
|
||||||
Args []string `json:"args"`
|
|
||||||
Env []string `json:"env"`
|
|
||||||
Cwd string `json:"cwd"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Root struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
Readonly bool `json:"readonly"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Platform struct {
|
|
||||||
OS string `json:"os"`
|
|
||||||
Arch string `json:"arch"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PortableSpec struct {
|
|
||||||
Version string `json:"version"`
|
|
||||||
Platform Platform `json:"platform"`
|
|
||||||
Process Process `json:"process"`
|
|
||||||
Root Root `json:"root"`
|
|
||||||
Hostname string `json:"hostname"`
|
|
||||||
Mounts []Mount `json:"mounts"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var specCommand = cli.Command{
|
var specCommand = cli.Command{
|
||||||
Name: "spec",
|
Name: "spec",
|
||||||
Usage: "create a new specification file",
|
Usage: "create a new specification file",
|
||||||
|
|
|
@ -15,99 +15,6 @@ import (
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"github.com/opencontainers/runc/libcontainer/devices"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Spec struct {
|
|
||||||
PortableSpec
|
|
||||||
Linux Linux `json:"linux"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Linux struct {
|
|
||||||
UserMapping map[string]UserMapping `json:"userMapping"`
|
|
||||||
Rlimits []Rlimit `json:"rlimits"`
|
|
||||||
SystemProperties map[string]string `json:"systemProperties"`
|
|
||||||
Resources *Resources `json:"resources"`
|
|
||||||
Namespaces []Namespace `json:"namespaces"`
|
|
||||||
Capabilities []string `json:"capabilities"`
|
|
||||||
Devices []string `json:"devices"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type User struct {
|
|
||||||
Uid int32 `json:"uid"`
|
|
||||||
Gid int32 `json:"gid"`
|
|
||||||
AdditionalGids []int32 `json:"additionalGids"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Namespace struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserMapping struct {
|
|
||||||
From int `json:"from"`
|
|
||||||
To int `json:"to"`
|
|
||||||
Count int `json:"count"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Rlimit struct {
|
|
||||||
Type int `json:"type"`
|
|
||||||
Hard uint64 `json:"hard"`
|
|
||||||
Soft uint64 `json:"soft"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HugepageLimit struct {
|
|
||||||
Pagesize string `json:"pageSize"`
|
|
||||||
Limit int `json:"limit"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type IfPrioMap struct {
|
|
||||||
Interface string `json:"interface"`
|
|
||||||
Priority int64 `json:"priority"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Resources struct {
|
|
||||||
// Memory limit (in bytes)
|
|
||||||
MemoryLimit int64 `json:"memoryLimit"`
|
|
||||||
// Memory reservation or soft_limit (in bytes)
|
|
||||||
MemoryReservation int64 `json:"memoryReservation"`
|
|
||||||
// Total memory usage (memory + swap); set `-1' to disable swap
|
|
||||||
MemorySwap int64 `json:"memorySwap"`
|
|
||||||
// Kernel memory limit (in bytes)
|
|
||||||
KernelMemory int64 `json:"kernelMemory"`
|
|
||||||
// CPU shares (relative weight vs. other containers)
|
|
||||||
CpuShares int64 `json:"cpuShares"`
|
|
||||||
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
|
|
||||||
CpuQuota int64 `json:"cpuQuota"`
|
|
||||||
// CPU period to be used for hardcapping (in usecs). 0 to use system default.
|
|
||||||
CpuPeriod int64 `json:"cpuPeriod"`
|
|
||||||
// How many time CPU will use in realtime scheduling (in usecs).
|
|
||||||
CpuRtRuntime int64 `json:"cpuQuota"`
|
|
||||||
// CPU period to be used for realtime scheduling (in usecs).
|
|
||||||
CpuRtPeriod int64 `json:"cpuPeriod"`
|
|
||||||
// CPU to use
|
|
||||||
CpusetCpus string `json:"cpusetCpus"`
|
|
||||||
// MEM to use
|
|
||||||
CpusetMems string `json:"cpusetMems"`
|
|
||||||
// IO read rate limit per cgroup per device, bytes per second.
|
|
||||||
BlkioThrottleReadBpsDevice string `json:"blkioThrottleReadBpsDevice"`
|
|
||||||
// IO write rate limit per cgroup per divice, bytes per second.
|
|
||||||
BlkioThrottleWriteBpsDevice string `json:"blkioThrottleWriteBpsDevice"`
|
|
||||||
// IO read rate limit per cgroup per device, IO per second.
|
|
||||||
BlkioThrottleReadIOpsDevice string `json:"blkioThrottleReadIopsDevice"`
|
|
||||||
// IO write rate limit per cgroup per device, IO per second.
|
|
||||||
BlkioThrottleWriteIOpsDevice string `json:"blkioThrottleWriteIopsDevice"`
|
|
||||||
// Specifies per cgroup weight, range is from 10 to 1000.
|
|
||||||
BlkioWeight int64 `json:"blkioWeight"`
|
|
||||||
// Weight per cgroup per device, can override BlkioWeight.
|
|
||||||
BlkioWeightDevice string `json:"blkioWeightDevice"`
|
|
||||||
// Hugetlb limit (in bytes)
|
|
||||||
HugetlbLimit []*HugepageLimit `json:"hugetlbLimit"`
|
|
||||||
// Whether to disable OOM Killer
|
|
||||||
DisableOOMKiller bool `json:"disableOOMKiller"`
|
|
||||||
// Set priority of network traffic for container
|
|
||||||
NetPrioIfpriomap []*IfPrioMap `json:"netPrioIfpriomap"`
|
|
||||||
// Set class identifier for container's network packets
|
|
||||||
NetClsClassid string `json:"netClsClassid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var namespaceMapping = map[string]configs.NamespaceType{
|
var namespaceMapping = map[string]configs.NamespaceType{
|
||||||
"process": configs.NEWPID,
|
"process": configs.NEWPID,
|
||||||
"network": configs.NEWNET,
|
"network": configs.NEWNET,
|
||||||
|
|
Loading…
Reference in New Issue