Skip to content

Conversation

@mariomac
Copy link
Contributor

A host may share its /proc FS folder with a privileged container, mounted in an
alternative folder (e.g. /host/proc), as some users prefer to run their
monitoring software inside a container rather than a host process.

This patch allows overriding the default /proc folder to allow the blkio
Controller working inside containerized monitoring software.

The /proc root can be overriden via an optional function (ProcRoot) to
avoid introducing a new NewBlkio constructor or introducing breaking changes
in the current API.

Then, the NewBlkio constructor can be invoked as usual, or in the following
form, to override the /proc path:

ctrl := NewBlkio("/sys/fs/cgroup", ProcRoot("/host/proc"))

A host may share its /proc FS folder with a privileged container, mounted in an
alternative folder (e.g. /host/proc), as some users prefer to run their
monitoring software inside a container instead of as a host process.

This patch allows overriding the default /proc folder to allow the blkio
Controller working inside containerized monitoring software.

The /proc root can be overriden via an optional function (ProcRoot) to
avoid introducing a new NewBlkio constructor or introducing breaking changes
in the current API.

Then, the NewBlkio constructor can be invoked as usual, or in the following
form, to override the /proc path:

ctrl := NewBlkio("/sys/fs/cgroup", ProcRoot("/host/proc"))

Signed-off-by: Mario Macias <[email protected]>
@codecov-io
Copy link

Codecov Report

Merging #97 into master will increase coverage by 0.25%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   41.76%   42.02%   +0.25%     
==========================================
  Files          23       23              
  Lines        1616     1623       +7     
==========================================
+ Hits          675      682       +7     
  Misses        817      817              
  Partials      124      124
Impacted Files Coverage Δ
blkio.go 23.25% <100%> (+2.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf292b2...af0bc55. Read the comment docs.

@crosbymichael
Copy link
Member

LGTM

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@estesp estesp merged commit 484059a into containerd:master Sep 23, 2019
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Oct 31, 2019
full diff: containerd/cgroups@c4b9ac5...5fbad35

- containerd/cgroups#82 Add go module support
- containerd/cgroups#96 Move metrics proto package to stats/v1
- containerd/cgroups#97 Allow overriding the default /proc folder in blkioController
- containerd/cgroups#98 Allows ignoring memory modules
- containerd/cgroups#99 Add Go 1.13 to Travis
- containerd/cgroups#100 stats/v1: export per-cgroup stats

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Oct 31, 2019
full diff: containerd/cgroups@c4b9ac5...5fbad35

- containerd/cgroups#82 Add go module support
- containerd/cgroups#96 Move metrics proto package to stats/v1
- containerd/cgroups#97 Allow overriding the default /proc folder in blkioController
- containerd/cgroups#98 Allows ignoring memory modules
- containerd/cgroups#99 Add Go 1.13 to Travis
- containerd/cgroups#100 stats/v1: export per-cgroup stats

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 27552ceb15bca544820229e574427d4c1d6ef585
Component: engine
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Dec 3, 2019
full diff: containerd/cgroups@c4b9ac5...5fbad35

- containerd/cgroups#82 Add go module support
- containerd/cgroups#96 Move metrics proto package to stats/v1
- containerd/cgroups#97 Allow overriding the default /proc folder in blkioController
- containerd/cgroups#98 Allows ignoring memory modules
- containerd/cgroups#99 Add Go 1.13 to Travis
- containerd/cgroups#100 stats/v1: export per-cgroup stats

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 27552ce)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Jan 23, 2020
full diff: containerd/cgroups@c4b9ac5...5fbad35

- containerd/cgroups#82 Add go module support
- containerd/cgroups#96 Move metrics proto package to stats/v1
- containerd/cgroups#97 Allow overriding the default /proc folder in blkioController
- containerd/cgroups#98 Allows ignoring memory modules
- containerd/cgroups#99 Add Go 1.13 to Travis
- containerd/cgroups#100 stats/v1: export per-cgroup stats

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 27552ceb15bca544820229e574427d4c1d6ef585)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 9ab162a73ac9e133a21cffbadd3339cbb5213939
Component: engine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants