@@ -24,11 +24,11 @@ type LinuxRuntime struct {
2424 Sysctl map [string ]string `json:"sysctl"`
2525 // Resources contain cgroup information for handling resource constraints
2626 // for the container
27- Resources * Resources `json:"resources"`
27+ Resources * Resources `json:"resources,omitempty "`
2828 // CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
2929 // The path is expected to be relative to the cgroups mountpoint.
3030 // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
31- CgroupsPath string `json:"cgroupsPath"`
31+ CgroupsPath * string `json:"cgroupsPath,omitempty "`
3232 // Namespaces contains the namespaces that are created and/or joined by the container
3333 Namespaces []Namespace `json:"namespaces"`
3434 // Devices are a list of device nodes that are created and enabled for the container
@@ -93,9 +93,9 @@ type Rlimit struct {
9393// HugepageLimit structure corresponds to limiting kernel hugepages
9494type HugepageLimit struct {
9595 // Pagesize is the hugepage size
96- Pagesize string `json:"pageSize"`
96+ Pagesize * string `json:"pageSize,omitempty "`
9797 // Limit is the limit of "hugepagesize" hugetlb usage
98- Limit uint64 `json:"limit"`
98+ Limit * uint64 `json:"limit,omitempty "`
9999}
100100
101101// InterfacePriority for network interfaces
@@ -118,9 +118,9 @@ type blockIODevice struct {
118118type WeightDevice struct {
119119 blockIODevice
120120 // Weight is the bandwidth rate for the device, range is from 10 to 1000
121- Weight uint16 `json:"weight"`
121+ Weight * uint16 `json:"weight,omitempty "`
122122 // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
123- LeafWeight uint16 `json:"leafWeight"`
123+ LeafWeight * uint16 `json:"leafWeight,omitempty "`
124124}
125125
126126// ThrottleDevice struct holds a `major:minor rate_per_second` pair
@@ -133,59 +133,59 @@ type ThrottleDevice struct {
133133// BlockIO for Linux cgroup 'blkio' resource management
134134type BlockIO struct {
135135 // Specifies per cgroup weight, range is from 10 to 1000
136- Weight uint16 `json:"blkioWeight"`
136+ Weight * uint16 `json:"blkioWeight,omitempty "`
137137 // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
138- LeafWeight uint16 `json:"blkioLeafWeight"`
138+ LeafWeight * uint16 `json:"blkioLeafWeight,omitempty "`
139139 // Weight per cgroup per device, can override BlkioWeight
140- WeightDevice []* WeightDevice `json:"blkioWeightDevice"`
140+ WeightDevice []* WeightDevice `json:"blkioWeightDevice,omitempty "`
141141 // IO read rate limit per cgroup per device, bytes per second
142- ThrottleReadBpsDevice []* ThrottleDevice `json:"blkioThrottleReadBpsDevice"`
142+ ThrottleReadBpsDevice []* ThrottleDevice `json:"blkioThrottleReadBpsDevice,omitempty "`
143143 // IO write rate limit per cgroup per device, bytes per second
144- ThrottleWriteBpsDevice []* ThrottleDevice `json:"blkioThrottleWriteBpsDevice"`
144+ ThrottleWriteBpsDevice []* ThrottleDevice `json:"blkioThrottleWriteBpsDevice,omitempty "`
145145 // IO read rate limit per cgroup per device, IO per second
146- ThrottleReadIOPSDevice []* ThrottleDevice `json:"blkioThrottleReadIOPSDevice"`
146+ ThrottleReadIOPSDevice []* ThrottleDevice `json:"blkioThrottleReadIOPSDevice,omitempty "`
147147 // IO write rate limit per cgroup per device, IO per second
148- ThrottleWriteIOPSDevice []* ThrottleDevice `json:"blkioThrottleWriteIOPSDevice"`
148+ ThrottleWriteIOPSDevice []* ThrottleDevice `json:"blkioThrottleWriteIOPSDevice,omitempty "`
149149}
150150
151151// Memory for Linux cgroup 'memory' resource management
152152type Memory struct {
153- // Memory limit (in bytes)
154- Limit uint64 `json:"limit"`
155- // Memory reservation or soft_limit (in bytes)
156- Reservation uint64 `json:"reservation"`
157- // Total memory usage (memory + swap); set `-1' to disable swap
158- Swap uint64 `json:"swap"`
159- // Kernel memory limit (in bytes)
160- Kernel uint64 `json:"kernel"`
153+ // Memory limit (in bytes).
154+ Limit * uint64 `json:"limit,omitempty "`
155+ // Memory reservation or soft_limit (in bytes).
156+ Reservation * uint64 `json:"reservation,omitempty "`
157+ // Total memory limit (memory + swap).
158+ Swap * uint64 `json:"swap,omitempty "`
159+ // Kernel memory limit (in bytes).
160+ Kernel * uint64 `json:"kernel,omitempty "`
161161 // Kernel memory limit for tcp (in bytes)
162- KernelTCP uint64 `json:"kernelTCP"`
163- // How aggressive the kernel will swap memory pages. Range from 0 to 100. Set -1 to use system default
164- Swappiness uint64 `json:"swappiness"`
162+ KernelTCP * uint64 `json:"kernelTCP"`
163+ // How aggressive the kernel will swap memory pages. Range from 0 to 100.
164+ Swappiness * uint64 `json:"swappiness,omitempty "`
165165}
166166
167167// CPU for Linux cgroup 'cpu' resource management
168168type CPU struct {
169- // CPU shares (relative weight vs. other cgroups with cpu shares)
170- Shares uint64 `json:"shares"`
171- // CPU hardcap limit (in usecs). Allowed cpu time in a given period
172- Quota uint64 `json:"quota"`
173- // CPU period to be used for hardcapping (in usecs). 0 to use system default
174- Period uint64 `json:"period"`
175- // How many time CPU will use in realtime scheduling (in usecs)
176- RealtimeRuntime uint64 `json:"realtimeRuntime"`
177- // CPU period to be used for realtime scheduling (in usecs)
178- RealtimePeriod uint64 `json:"realtimePeriod"`
179- // CPU to use within the cpuset
180- Cpus string `json:"cpus"`
181- // MEM to use within the cpuset
182- Mems string `json:"mems"`
169+ // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
170+ Shares * uint64 `json:"shares,omitempty "`
171+ // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
172+ Quota * uint64 `json:"quota,omitempty "`
173+ // CPU period to be used for hardcapping (in usecs).
174+ Period * uint64 `json:"period,omitempty "`
175+ // How much time realtime scheduling may use (in usecs).
176+ RealtimeRuntime * uint64 `json:"realtimeRuntime,omitempty "`
177+ // CPU period to be used for realtime scheduling (in usecs).
178+ RealtimePeriod * uint64 `json:"realtimePeriod,omitempty "`
179+ // CPUs to use within the cpuset. Default is to use any CPU available.
180+ Cpus * string `json:"cpus,omitempty "`
181+ // List of memory nodes in the cpuset. Default is to use any available memory node.
182+ Mems * string `json:"mems,omitempty "`
183183}
184184
185185// Pids for Linux cgroup 'pids' resource management (Linux 4.3)
186186type Pids struct {
187- // Maximum number of PIDs. A value <= 0 indicates "no limit".
188- Limit int64 `json:"limit"`
187+ // Maximum number of PIDs. Default is "no limit".
188+ Limit * int64 `json:"limit,omitempty "`
189189}
190190
191191// Network identification and priority configuration
@@ -201,21 +201,21 @@ type Network struct {
201201// Resources has container runtime resource constraints
202202type Resources struct {
203203 // DisableOOMKiller disables the OOM killer for out of memory conditions
204- DisableOOMKiller bool `json:"disableOOMKiller"`
205- // Specify an oom_score_adj for the container. Optional.
206- OOMScoreAdj int `json:"oomScoreAdj"`
204+ DisableOOMKiller * bool `json:"disableOOMKiller,omitempty "`
205+ // Specify an oom_score_adj for the container.
206+ OOMScoreAdj * int `json:"oomScoreAdj,omitempty "`
207207 // Memory restriction configuration
208- Memory Memory `json:"memory"`
208+ Memory * Memory `json:"memory,omitempty "`
209209 // CPU resource restriction configuration
210- CPU CPU `json:"cpu"`
210+ CPU * CPU `json:"cpu,omitempty "`
211211 // Task resource restriction configuration.
212- Pids Pids `json:"pids"`
212+ Pids * Pids `json:"pids,omitempty "`
213213 // BlockIO restriction configuration
214- BlockIO BlockIO `json:"blockIO"`
214+ BlockIO * BlockIO `json:"blockIO,omitempty "`
215215 // Hugetlb limit (in bytes)
216- HugepageLimits []HugepageLimit `json:"hugepageLimits"`
216+ HugepageLimits []HugepageLimit `json:"hugepageLimits,omitempty "`
217217 // Network restriction configuration
218- Network Network `json:"network"`
218+ Network * Network `json:"network,omitempty "`
219219}
220220
221221// Device represents the information on a Linux special device file
0 commit comments