File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
pkg/inspecttypes/dockercompat Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ type HostConfig struct {
160160 DNS []string `json:"Dns"` // List of DNS server to lookup
161161 DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for
162162 DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for
163+ OomScoreAdj int // specifies the tune container’s OOM preferences (-1000 to 1000, rootless: 100 to 1000)
163164}
164165
165166// From https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L416-L427
@@ -446,6 +447,9 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
446447 c .HostConfig .DNSOptions = dnsSettings .DNSResolvConfOptions
447448 c .HostConfig .DNSSearch = dnsSettings .DNSSearchDomains
448449
450+ oomScoreAdj , _ := getOomScoreAdjFromNative (n .Spec .(* specs.Spec ))
451+ c .HostConfig .OomScoreAdj = oomScoreAdj
452+
449453 c .State = cs
450454 c .Config = & Config {
451455 Labels : n .Labels ,
@@ -726,6 +730,14 @@ func getDnsFromNative(Labels map[string]string) (*DNSSettings, error) {
726730 return res , nil
727731}
728732
733+ func getOomScoreAdjFromNative (sp * specs.Spec ) (int , error ) {
734+ var res int
735+ if sp .Process != nil && sp .Process .OOMScoreAdj != nil {
736+ res = * sp .Process .OOMScoreAdj
737+ }
738+ return res , nil
739+ }
740+
729741type IPAMConfig struct {
730742 Subnet string `json:"Subnet,omitempty"`
731743 Gateway string `json:"Gateway,omitempty"`
You can’t perform that action at this time.
0 commit comments