@@ -23,24 +23,24 @@ type Cgroup struct {
2323
2424 // Path specifies the path to cgroups that are created and/or joined by the container.
2525 // The path is assumed to be relative to the host system cgroup mountpoint.
26- Path string `json:"path"`
26+ Path string `json:"path,omitempty "`
2727
28- // ScopePrefix describes prefix for the scope name
29- ScopePrefix string `json:"scope_prefix"`
28+ // ScopePrefix describes prefix for the scope name.
29+ ScopePrefix string `json:"scope_prefix,omitempty "`
3030
31- // Resources contains various cgroups settings to apply
32- * Resources
31+ // Resources contains various cgroups settings to apply.
32+ * Resources `json:"Resources,omitempty"`
3333
3434 // Systemd tells if systemd should be used to manage cgroups.
35- Systemd bool
35+ Systemd bool `json:"Systemd,omitempty"`
3636
3737 // SystemdProps are any additional properties for systemd,
3838 // derived from org.systemd.property.xxx annotations.
3939 // Ignored unless systemd is used for managing cgroups.
4040 SystemdProps []systemdDbus.Property `json:"-"`
4141
4242 // Rootless tells if rootless cgroups should be used.
43- Rootless bool
43+ Rootless bool `json:"Rootless,omitempty"`
4444
4545 // The host UID that should own the cgroup, or nil to accept
4646 // the default ownership. This should only be set when the
@@ -52,96 +52,96 @@ type Cgroup struct {
5252
5353type Resources struct {
5454 // Devices is the set of access rules for devices in the container.
55- Devices []* devices.Rule `json:"devices"`
55+ Devices []* devices.Rule `json:"devices,omitempty "`
5656
57- // Memory limit (in bytes)
58- Memory int64 `json:"memory"`
57+ // Memory limit (in bytes).
58+ Memory int64 `json:"memory,omitempty "`
5959
60- // Memory reservation or soft_limit (in bytes)
61- MemoryReservation int64 `json:"memory_reservation"`
60+ // Memory reservation or soft_limit (in bytes).
61+ MemoryReservation int64 `json:"memory_reservation,omitempty "`
6262
63- // Total memory usage (memory + swap); set `-1` to enable unlimited swap
64- MemorySwap int64 `json:"memory_swap"`
63+ // Total memory usage (memory+ swap); use -1 for unlimited swap.
64+ MemorySwap int64 `json:"memory_swap,omitempty "`
6565
66- // CPU shares (relative weight vs. other containers)
67- CpuShares uint64 `json:"cpu_shares"`
66+ // CPU shares (relative weight vs. other containers).
67+ CpuShares uint64 `json:"cpu_shares,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuShares should be CPUShares".
6868
6969 // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
70- CpuQuota int64 `json:"cpu_quota"`
70+ CpuQuota int64 `json:"cpu_quota,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuQuota should be CPUQuota".
7171
7272 // CPU hardcap burst limit (in usecs). Allowed accumulated cpu time additionally for burst in a given period.
73- CpuBurst * uint64 `json:"cpu_burst"` //nolint:revive
73+ CpuBurst * uint64 `json:"cpu_burst,omitempty "` //nolint:revive // Suppress "var-naming: struct field CpuBurst should be CPUBurst".
7474
7575 // CPU period to be used for hardcapping (in usecs). 0 to use system default.
76- CpuPeriod uint64 `json:"cpu_period"`
76+ CpuPeriod uint64 `json:"cpu_period,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuPeriod should be CPUPeriod".
7777
7878 // How many time CPU will use in realtime scheduling (in usecs).
79- CpuRtRuntime int64 `json:"cpu_rt_quota"`
79+ CpuRtRuntime int64 `json:"cpu_rt_quota,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuRtRuntime should be CPURtRuntime".
8080
8181 // CPU period to be used for realtime scheduling (in usecs).
82- CpuRtPeriod uint64 `json:"cpu_rt_period"`
82+ CpuRtPeriod uint64 `json:"cpu_rt_period,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuQuota should be CPUQuota".
8383
84- // CPU to use
85- CpusetCpus string `json:"cpuset_cpus"`
84+ // Cpuset CPUs to use.
85+ CpusetCpus string `json:"cpuset_cpus,omitempty "`
8686
87- // MEM to use
88- CpusetMems string `json:"cpuset_mems"`
87+ // Cpuset memory nodes to use.
88+ CpusetMems string `json:"cpuset_mems,omitempty "`
8989
90- // cgroup SCHED_IDLE
90+ // Cgroup's SCHED_IDLE value.
9191 CPUIdle * int64 `json:"cpu_idle,omitempty"`
9292
9393 // Process limit; set <= `0' to disable limit.
94- PidsLimit int64 `json:"pids_limit"`
94+ PidsLimit int64 `json:"pids_limit,omitempty "`
9595
9696 // Specifies per cgroup weight, range is from 10 to 1000.
97- BlkioWeight uint16 `json:"blkio_weight"`
97+ BlkioWeight uint16 `json:"blkio_weight,omitempty "`
9898
99- // Specifies tasks ' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only
100- BlkioLeafWeight uint16 `json:"blkio_leaf_weight"`
99+ // Tasks ' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only.
100+ BlkioLeafWeight uint16 `json:"blkio_leaf_weight,omitempty "`
101101
102102 // Weight per cgroup per device, can override BlkioWeight.
103- BlkioWeightDevice []* WeightDevice `json:"blkio_weight_device"`
103+ BlkioWeightDevice []* WeightDevice `json:"blkio_weight_device,omitempty "`
104104
105105 // IO read rate limit per cgroup per device, bytes per second.
106- BlkioThrottleReadBpsDevice []* ThrottleDevice `json:"blkio_throttle_read_bps_device"`
106+ BlkioThrottleReadBpsDevice []* ThrottleDevice `json:"blkio_throttle_read_bps_device,omitempty "`
107107
108108 // IO write rate limit per cgroup per device, bytes per second.
109- BlkioThrottleWriteBpsDevice []* ThrottleDevice `json:"blkio_throttle_write_bps_device"`
109+ BlkioThrottleWriteBpsDevice []* ThrottleDevice `json:"blkio_throttle_write_bps_device,omitempty "`
110110
111111 // IO read rate limit per cgroup per device, IO per second.
112- BlkioThrottleReadIOPSDevice []* ThrottleDevice `json:"blkio_throttle_read_iops_device"`
112+ BlkioThrottleReadIOPSDevice []* ThrottleDevice `json:"blkio_throttle_read_iops_device,omitempty "`
113113
114114 // IO write rate limit per cgroup per device, IO per second.
115- BlkioThrottleWriteIOPSDevice []* ThrottleDevice `json:"blkio_throttle_write_iops_device"`
115+ BlkioThrottleWriteIOPSDevice []* ThrottleDevice `json:"blkio_throttle_write_iops_device,omitempty "`
116116
117- // set the freeze value for the process
118- Freezer FreezerState `json:"freezer"`
117+ // Freeze value for the process.
118+ Freezer FreezerState `json:"freezer,omitempty "`
119119
120- // Hugetlb limit (in bytes)
121- HugetlbLimit []* HugepageLimit `json:"hugetlb_limit"`
120+ // Hugetlb limit (in bytes).
121+ HugetlbLimit []* HugepageLimit `json:"hugetlb_limit,omitempty "`
122122
123- // Whether to disable OOM Killer
124- OomKillDisable bool `json:"oom_kill_disable"`
123+ // Whether to disable OOM killer.
124+ OomKillDisable bool `json:"oom_kill_disable,omitempty "`
125125
126- // Tuning swappiness behaviour per cgroup
127- MemorySwappiness * uint64 `json:"memory_swappiness"`
126+ // Tuning swappiness behaviour per cgroup.
127+ MemorySwappiness * uint64 `json:"memory_swappiness,omitempty "`
128128
129- // Set priority of network traffic for container
130- NetPrioIfpriomap []* IfPrioMap `json:"net_prio_ifpriomap"`
129+ // Set priority of network traffic for container.
130+ NetPrioIfpriomap []* IfPrioMap `json:"net_prio_ifpriomap,omitempty "`
131131
132- // Set class identifier for container's network packets
133- NetClsClassid uint32 `json:"net_cls_classid_u"`
132+ // Set class identifier for container's network packets.
133+ NetClsClassid uint32 `json:"net_cls_classid_u,omitempty "`
134134
135- // Rdma resource restriction configuration
136- Rdma map [string ]LinuxRdma `json:"rdma"`
135+ // Rdma resource restriction configuration.
136+ Rdma map [string ]LinuxRdma `json:"rdma,omitempty "`
137137
138138 // Used on cgroups v2:
139139
140140 // CpuWeight sets a proportional bandwidth limit.
141- CpuWeight uint64 `json:"cpu_weight"`
141+ CpuWeight uint64 `json:"cpu_weight,omitempty"` //nolint:revive // Suppress "var-naming: struct field CpuWeight should be CPUWeight".
142142
143143 // Unified is cgroupv2-only key-value map.
144- Unified map [string ]string `json:"unified"`
144+ Unified map [string ]string `json:"unified,omitempty "`
145145
146146 // SkipDevices allows to skip configuring device permissions.
147147 // Used by e.g. kubelet while creating a parent cgroup (kubepods)
@@ -165,5 +165,5 @@ type Resources struct {
165165 // MemoryCheckBeforeUpdate is a flag for cgroup v2 managers to check
166166 // if the new memory limits (Memory and MemorySwap) being set are lower
167167 // than the current memory usage, and reject if so.
168- MemoryCheckBeforeUpdate bool `json:"memory_check_before_update"`
168+ MemoryCheckBeforeUpdate bool `json:"memory_check_before_update,omitempty "`
169169}
0 commit comments