Skip to content

Commit

Permalink
featrue: 当容器异常退出时,上报容器是否被OOM信息 TencentBlueKing#397
Browse files Browse the repository at this point in the history
  • Loading branch information
zmberg committed Mar 5, 2020
1 parent 5b8b22d commit 0b175ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bcs-mesos/bcs-container-executor/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type BcsContainerInfo struct {
Message string `json:"Message,omitempty"` //status message for container
Resource *schedTypes.Resource `json:"Resource,omitempty"`
BcsMessage *schedTypes.BcsMessage `json:",omitempty"`
OOMKilled bool `json:"OOMKilled,omitempty"` //container exited, whether oom
}

//Update data from other info
Expand All @@ -73,6 +74,7 @@ func (info *BcsContainerInfo) Update(other *BcsContainerInfo) {
info.Hostname = other.Hostname
info.IsChecked = other.IsChecked
info.ConsecutiveFailureTimes = other.ConsecutiveFailureTimes
info.OOMKilled = other.OOMKilled
if strings.Contains(other.NetworkMode, "container:") {
info.NetworkMode = "user"
} else {
Expand Down
1 change: 1 addition & 0 deletions bcs-mesos/bcs-container-executor/container/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ func (docker *DockerContainer) InspectContainer(containerName string) (*BcsConta
ExitCode: container.State.ExitCode,
Hostname: container.Config.Hostname,
NetworkMode: container.HostConfig.NetworkMode,
OOMKilled: container.State.OOMKilled,
Resource: &schedTypes.Resource{
Cpus: float64(container.HostConfig.CPUShares / 1024),
Mem: float64(container.HostConfig.Memory / 1024 / 1024),
Expand Down

0 comments on commit 0b175ce

Please sign in to comment.