Commit Graph

791 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
002dbf6a4c
Merge pull request #83777 from lmdaly/fix-single-numa-node-with-best-effort-pods
Fixed bug in TopologyManager with SingleNUMANode Policy
2019-11-01 04:53:23 -07:00
Kubernetes Prow Robot
17a57f99d5
Merge pull request #81344 from zouyee/cpm
fix cpumanager reconcileState without sourceready
2019-10-30 23:33:36 -07:00
nolancon
b0a85177d2 Clean-up and additional test cases for socket-mask unit test. 2019-10-18 04:16:06 +01:00
Kubernetes Prow Robot
017842d49d
Merge pull request #83492 from ConnorDoyle/topo-align-all-qos
Topology manager aligns pods of all QoS classes.
2019-10-11 03:03:40 -07:00
Louise Daly
a353247d44 Fixed bug in TopologyManager with SingleNUMANode Policy
This patch fixes an issue where best-effort pods were not admitted
to the node if the single-numa-node policy was set.

This was because the Admit policy in single-numa-node policy does
not admit any pod where the hint is anything but single NUMA node. The 'best hint' in this case is {<set bits for num. Numa Nodes on machine>, true}
So on a machine with 2 NUMA nodes the best hint for a best-effort pod is {11,true} as best-effort pods have no Topology preferences.

The single-numa-node policy fails any pod with a not preferred hint OR a hint where > 1 bits are set, thus the above example resulting in termintaed pods with a Topology Affinity Error.

This is a short term fix for the single-numa-node policy, as there will be code refactoring for the 1.17 release.
2019-10-11 07:00:37 +01:00
Kubernetes Prow Robot
4561b67971
Merge pull request #83697 from klueska/fix-single-numa-with-one-provider
Fixed bug in TopologyManager with SingleNUMANode Policy
2019-10-10 19:00:33 -07:00
Kubernetes Prow Robot
3db6d3abcf
Merge pull request #83551 from dims/move-external-facing-kubelet-apis-to-staging
Move external facing kubelet apis to staging
2019-10-10 13:41:36 -07:00
Connor Doyle
a598369e3c Gofmt. 2019-10-10 12:16:21 -07:00
Connor Doyle
a9203ebdcf Topology manager aligns pods of all QoS classes. 2019-10-10 12:16:21 -07:00
Kevin Klues
5501f542cd Fixed bug in TopologyManager with SingleNUMANode Policy
This patch fixes an issue in the TopologyManager that wouldn't allow
pods to be admitted if pods were launched with the SingleNUMANode policy
and any of the hint providers had no NUMA preferences.

This is due to 2 factors:

1) Any hint provider that passes back a `nil` as its hints, has its hint
automatically transformed into a single {11 true} hint before merging

2) We added a special casing for the SingleNumaNodePolicy() in the
TopologyManager that essentially turns these hints into a
{11 false} anytime a {11 true} is seen.

The current patch reworks this logic so the that TopologyManager can
tell the difference between a "don't care" hint and a true "{11 true}"
hint returned by the hint provider. Only true "{11 true}" hints will be
converted by the special casing for the SingleNumaNodePolicy(), while
"don't care" hints will not.

This is a short term fix for this issue until we do a larger refactoring
of this code for the 1.17 release.
2019-10-09 17:41:08 -07:00
mrobson
ad3dcb9fa0 Add podCgroup to process kill events to allow for correlation 2019-10-08 13:12:48 -04:00
Kubernetes Prow Robot
d70b2db1f2
Merge pull request #83296 from yutedz/kill-cgrp-proc
Only kill process where killing failed during previous iterations
2019-10-08 07:19:13 -07:00
Kubernetes Prow Robot
3f8f0a32fa
Merge pull request #83527 from odinuge/runc-rc9
Bump dependency opencontainers/runc@v1.0.0-rc9
2019-10-08 03:45:44 -07:00
Davanum Srinivas
f29d2272c8
fix gofmt and golint failures
Change-Id: I6535b506f50558b31663a13cd270b15023afa2c6
2019-10-06 18:43:17 -04:00
Kubernetes Prow Robot
48b90db9c3
Merge pull request #83495 from tanjunchen/fix-typo
remove the repeat word in documents
2019-10-06 15:05:08 -07:00
Davanum Srinivas
6ecc0f83af
update bazel BUILD files
Change-Id: Ia3917cec1453c0b22a958faf8c22bccd79242d14
2019-10-06 15:29:23 -04:00
Davanum Srinivas
d30c489c54
Move pkg/kubelet/pluginregistration and deviceplugin
Change-Id: I06adcb43bd278b430ffad2010869e1524c8cc4ff
2019-10-06 15:28:38 -04:00
tanjunchen
de3cf23414 remove the repeat word in documents 2019-10-06 23:32:01 +08:00
Odin Ugedal
b9cfb19321
Rename cgroupsystemd.Manager to LegacyManager 2019-10-05 14:22:35 +02:00
Kubernetes Prow Robot
d60bda1971
Merge pull request #83043 from ConnorDoyle/cleanup-cpumanger-topo-hints
Delegate topology hint gen to CPU manager policy
2019-10-05 00:59:39 -07:00
Kevin Klues
d2b53af7d7 Add klueska as reviewer for CPUManager and devicemanager 2019-10-03 13:01:41 -07:00
Ted Yu
6dbb533e3c Only kill process where killing failed during previous iterations 2019-09-29 19:53:43 -07:00
Connor Doyle
389853894d Delegate topology hint gen to CPU manager policy
- The previous implementation depended on a fixed set of policies.
2019-09-27 22:29:02 -07:00
zouyee
b1f6974f7b using online instead to fix kubelet service failed with wrong number of possible NUMA nodes
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-09-26 21:48:50 +08:00
zouyee
594fc0f4b9 fix cpumanager reconcileState without sourceready
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-09-25 10:39:06 +08:00
Connor Doyle
e35301c19f Rename package socketmask to bitmask.
- As discussed in reviews and other public channels,
  this abstraction is used to represent numa nodes, not sockets.
- There is nothing inherently related to sockets in this package anyway.
2019-09-23 17:08:45 -07:00
Kubernetes Prow Robot
07cc813956
Merge pull request #81793 from lmdaly/topology-manager-owners
Added OWNERS file for Topology Manager
2019-09-11 18:26:52 -07:00
Louise Daly
fbccf25e29 Added OWNERS file for Topology Manager 2019-09-11 06:40:24 +01:00
Kubernetes Prow Robot
887edd2273
Merge pull request #82099 from lmdaly/single-numa-node-policy
Topology Manager Policy: single-numa-node
2019-08-30 11:21:26 -07:00
Kubernetes Prow Robot
9165f7bf56
Merge pull request #82104 from klueska/upstream-fix-cpu-manager-topology-bug
Fix bug in CPUManager with setting topology for policies
2019-08-30 08:00:44 -07:00
Louise Daly
8ad1b5ba3b Single-numa-node Topology Manager bug fix
Added one off fix for single-numa-node policy to correctly
reject pod admission on a resource allocation that spans
NUMA nodes

Co-authored-by: Kevin Klues <kklues@nvidia.com>
2019-08-30 07:17:56 +01:00
Louise Daly
f6c085f60e Added Single NUMA Node Policy which ensure resource are
aligned on a single NUMA node

Co-authored-by: Kevin Klues <kklues@nvidia.com>
2019-08-30 07:17:17 +01:00
Kevin Klues
5ed80dadcf Update CanAdmitPodResult() in TopologyManager to take a TopologyHint
Previously it only took a bool, which limited the logic it could perform
to determine if a pod should be admitted or not based on the merged hint
from the policy.
2019-08-30 07:17:17 +01:00
Kevin Klues
eb0216e54e Update semantics to set Preferred field in TopologyHint generation
We now only set Preferred to true if resources can be allocated with a
size equal to the minimimum _possible_ mask when all resources are
available.
2019-08-29 14:32:10 -05:00
Kevin Klues
e0e8b3e4fd Update CPUManager topology helpers to accept multiple ids 2019-08-29 13:22:54 -05:00
Kevin Klues
dcc9f66311 Add devicemanager tests for TopologyHint consumption 2019-08-29 08:22:50 -05:00
Kevin Klues
cc567afaf0 Consume TopologyHints in the devicemanager 2019-08-29 08:22:50 -05:00
Kevin Klues
a3320f80d9 Add devicemanager tests for TopologyHint generation 2019-08-29 07:45:43 -05:00
Kevin Klues
d3d7a8f5d4 Generate TopologyHints from the devicemanager 2019-08-29 07:45:43 -05:00
Louise Daly
9a118ceac4 Added stub support for Topology Manager to Device Manager
Co-authored-by: Conor Nolan <conor.nolan@intel.com>
Co-authored-by: Sreemanti Ghosh <sreemanti.ghosh@intel.com>
Co-authored-by: Kevin Klues <kklues@nvidia.com>
2019-08-29 07:45:43 -05:00
Kevin Klues
ddfd9ac0ca Fix bug in CPUManager with setting topology for policies
Also add a check in the unit tests to avoid regressions
2019-08-28 17:32:25 -05:00
Kevin Klues
df1b54fc09 Fail fast with TopologyManager on machines with more than 8 NUMA Nodes 2019-08-28 11:04:52 -05:00
Kevin Klues
5660cd3cfb Add NUMA Node awareness to the TopologyManager 2019-08-28 11:04:52 -05:00
Kubernetes Prow Robot
35867b160a
Merge pull request #81951 from klueska/upstream-update-cpu-amanger-numa-mapping
Update the CPUManager to include NUMANodeID in its topology information
2019-08-28 08:55:40 -07:00
Kubernetes Prow Robot
de1cfa9bc1
Merge pull request #81787 from lmdaly/topology-manager-rename-strict-policy
Renaming strict policy to restricted policy
2019-08-28 01:38:04 -07:00
Kevin Klues
f4dbd29cdb Rename TopologyHint.SocketAffinity to TopologyHint.NUMANodeAffinity
As part of this, update the logic to use the NUMA information instead of
the Socket information when generating and consuming TopologyHints in
the CPUManager.
2019-08-27 16:51:05 -05:00
Kevin Klues
ecc14fe661 Update CPUManager to include NUMANodeID in CPUTopology
Unfortunately, the NUMA information is not readily available from
cadvisor, so we have to roll the logic to discover it by hand. In the
future, we should remove this custiom code to use the information
provided by cadvisor once it is made available.
2019-08-27 16:51:05 -05:00
Kevin Klues
869962fa48 Cache the discovered topology in the CPUManager instead of MachineInfo 2019-08-27 16:23:07 -05:00
Kubernetes Prow Robot
a3488b4cee
Merge pull request #81206 from tallclair/staticcheck-kubelet-push
Cleanup Kubelet static analysis issues
2019-08-22 15:09:43 -07:00
Kubernetes Prow Robot
6b47754740
Merge pull request #81627 from tallclair/copy
Delete duplicate resource.Quantity.Copy()
2019-08-22 11:13:13 -07:00
Louise Daly
2fb94231d0 Renaming strict policy to restricted policy
Restricted policy will fail admission of guaranteed pods where
all requested resources are not available on a single NUMA Node
2019-08-22 07:57:55 +01:00
Tim Allclair
a2c51674cf Cleanup more static check issues (S1*,ST*) 2019-08-21 10:40:21 -07:00
Tim Allclair
8a495cb5e4 Clean up error messages (ST1005) 2019-08-21 10:40:21 -07:00
Tim Allclair
6510d26b6a Fix misc static check issues 2019-08-21 10:40:21 -07:00
Tim Allclair
3f510c69f6 Remove dead code from pkg/kubelet/... 2019-08-21 10:40:21 -07:00
Tim Allclair
49f50484b8 Delete duplicate resource.Quantity.Copy() 2019-08-19 17:23:14 -07:00
Kevin Klues
4fdd52b058 Update GetTopologyHints() API to return a map
At present, there is no way for a hint provider to return distinct hints
for different resource types via a call to GetTopologyHints(). This
means that hint providers that govern multiple resource types (e.g. the
devicemanager) must do some sort of "pre-merge" on the hints it
generates for each resource type before passing them back to the
TopologyManager.

This patch changes the GetTopologyHints() interface to allow a hint
provider to pass back raw hints for each resource type, and allow the
TopologyManager to merge them using a single unified strategy.

This change also allows the TopologyManager to recognize which
resource type a set of hints originated from, should this information
become useful in the future.
2019-08-16 08:06:12 +02:00
Kubernetes Prow Robot
f2dd24820a
Merge pull request #73920 from nolancon/topology-manager-cpu-manager
Changes to make CPU Manager a Hint Provider for Topology Manager
2019-08-15 05:44:33 -07:00
Kevin Klues
b3f4bed97f Add CPUManager tests for TopologyHint consumption 2019-08-14 06:22:56 +02:00
Kevin Klues
8278d1134c Consume TopologyHints in the CPUManager
Co-Authored-By: Conor Nolan <conor.nolan@intel.com>
2019-08-14 06:22:56 +02:00
Sreemanti Ghosh
7c626a2a00 Add CPUManager tests for TopologyHint generation
Co-Authored-By: Conor Nolan <conor.nolan@intel.com>
Co-Authored-By: Kevin Klues <kklues@nvidia.com>
2019-08-14 06:22:56 +02:00
Kevin Klues
156b3f6af8 Generate TopologyHints from the CPUManager 2019-08-14 06:22:56 +02:00
Kevin Klues
9a6788cb13 Add IterateSocketMasks() function to socketmask abstraction 2019-08-14 06:22:56 +02:00
Kubernetes Prow Robot
ac2295a24d
Merge pull request #78587 from kad/socketmask-string
Use go standard library for common bit operations
2019-08-13 00:03:39 -07:00
Kubernetes Prow Robot
d47f9ff132
Merge pull request #81086 from dims/fix-incorrect-readlink-check-for-checking-kernel-pids
[TOB-K8S-027] Fix Incorrect isKernelPid check
2019-08-08 17:58:04 -07:00
Davanum Srinivas
bd925d6611 [TOB-K8S-027] Fix Incorrect isKernelPid check
isKernelPid should explicitly check the error returned from os.Readlink and return true
only if the error value is ENOENT. Without this fix, if Readlink
returned say ENAMETOOLONG or EACESS, we would still count the process as
a kernel process (which is not true).
2019-08-07 11:19:19 -04:00
Davanum Srinivas
bc71c23bee [TOB-K8S-025] Incorrect docker daemon process name in container manager
The container manager used in kubelet checks for docker daemon process either via pidfile
or process name. While the pidfile points to the docker daemon process PID, the
dockerProcessName constant stores a docker cli name ( docker ) instead of docker daemon
name ( dockerd ).
2019-08-07 10:59:37 -04:00
Conor Nolan
e33af11add Add stub support for TopologyManager to CPUManager
Co-Authored-By: Louise Daly <louise.m.daly@intel.com>
2019-08-07 15:56:05 +02:00
Jianfei Bai
5726b22fbc Move docker specific const to dockershim. 2019-08-05 10:28:08 +08:00
Kubernetes Prow Robot
c63000ef81
Merge pull request #78793 from mattjmcnaughton/mattjmcnaughton/78629-fix-reserved-cgroup-systemd
Fix reserved cgroup systemd
2019-08-02 17:23:52 -07:00
Kubernetes Prow Robot
93e6fb30f0
Merge pull request #74357 from lmdaly/topology-manager-container-manager
Updates to container manager and internal container lifecycle to accommodate TopologyManager
2019-08-01 11:52:17 -07:00
Kubernetes Prow Robot
1a8844cd03
Merge pull request #80683 from moshe010/rename_files
TopologyManager: Fix rename best-effort policy files
2019-07-31 00:25:00 -07:00
Kubernetes Prow Robot
320bc21dbe
Merge pull request #78762 from klueska/upstream-inherit-cpus-from-init-containers
Proactively remove init Containers in CPUManager static policy
2019-07-30 03:35:18 -07:00
Moshe Levi
3b83c5c7c6 TopologyManager: Fix rename best-effort policy files
PR https://github.com/kubernetes/kubernetes/pull/80301 rename
the preferred policy to best-effort, but the files names are
still policy_preferred.go and policy_preferred_test.go. This
PR fix that.
2019-07-28 19:35:16 +03:00
Kevin Klues
9f36f1a173 Add tests for proactive init Container removal in the CPUManager static policy 2019-07-26 14:34:51 +02:00
Kevin Klues
6a7db380de Add tests for new containertMap type in the CPUManager 2019-07-26 14:34:51 +02:00
Kevin Klues
c6d9bbcb74 Proactively remove init Containers in CPUManager static policy
This patch fixes a bug in the CPUManager, whereby it doesn't honor the
"effective requests/limits" of a Pod as defined by:

    https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#resources

The rule states that a Pod’s "effective request/limit" for a resource
should be the larger of:
    * The highest of any particular resource request or limit
      defined on all init Containers
    * The sum of all app Containers request/limit for a
      resource

Moreover, the rule states that:
    * The effective QoS tier is the same for init Containers
      and app containers alike

This means that the resource requests of init Containers and app
Containers should be able to overlap, such that the larger of the two
becomes the "effective resource request/limit" for the Pod. Likewise,
if a QoS tier of "Guaranteed" is determined for the Pod, then both init
Containers and app Containers should run in this tier.

In its current implementation, the CPU manager honors the effective QoS
tier for both init and app containers, but doesn't honor the "effective
request/limit" correctly.

Instead, it treats the "effective request/limit" as:
    * The sum of all init Containers plus the sum of all app
      Containers request/limit for a resource

It does this by not proactively removing the CPUs given to previous init
containers when new containers are being created. In the worst case,
this causes the CPUManager to give non-overlapping CPUs to all
containers (whether init or app) in the "Guaranteed" QoS tier before any
of the containers in the Pod actually start.

This effectively blocks these Pods from running if the total number of
CPUs being requested across init and app Containers goes beyond the
limits of the system.

This patch fixes this problem by updating the CPUManager static policy
so that it proactively removes any guaranteed CPUs it has granted to
init Containers before allocating CPUs to app containers. Since all init
container are run sequentially, it also makes sure this proactive
removal happens for previous init containers when allocating CPUs to
later ones.
2019-07-26 14:34:51 +02:00
Kevin Klues
7eccc71c9e Rename 'preferred' TopologyManager policy to 'best-effort' 2019-07-25 10:44:36 +02:00
Louise Daly
9f0081cc36 Updates to container manager and internal container lifecycle to accommodate Topology Manager
Co-authored-by: Conor Nolan <conor.nolan@intel.com>
2019-07-24 08:09:38 +01:00
Kubernetes Prow Robot
5b496fe8f5
Merge pull request #80315 from klueska/upstream-cleanup-socketmask
Cleanup the TopologyManager socketmask abstraction
2019-07-23 11:40:28 -07:00
Kevin Klues
65b07312b0 Cleanup comments in TopologyManager socketmask abstraction 2019-07-18 18:52:19 -07:00
Kevin Klues
0edfd4be35 Add package level And/Or calls to TopologyManager socketmask abstraction 2019-07-18 09:06:51 -07:00
Kevin Klues
434fd34e0b Add NewEmtpySocketMask() call to TopologyManager socketmask abstraction 2019-07-18 09:05:55 -07:00
Kevin Klues
4ee5d5409e Update the topologymanager to error out if an invalid policy is given
Previously, the topologymanager would simply fall back to the None() policy
if an invalid policy was specified. This patch updates this to return an
error when an invalid policy is passed, forcing the kubelet to fail
fast when this occurs.

These semantics should be preferable because an invalid policy likely
indicates operator error in setting the policy flag on the kubelet
correctly (e.g. misspelling 'strict' as 'striict'). In this case it is
better to fail fast so the operator can detect this and correct the
mistake, than to mask the error and essentially disable the
topologymanager unexpectedly.
2019-07-18 13:24:09 +02:00
Kevin Klues
5dc5f1de06 Update the cpumanager to error out if an invalid policy is given
Previously, the cpumanager would simply fall back to the None() policy
if an invalid policy was specified. This patch updates this to return an
error when an invalid policy is passed, forcing the kubelet to fail
fast when this occurs.

These semantics should be preferable because an invalid policy likely
indicates operator error in setting the policy flag on the kubelet
correctly (e.g. misspelling 'static' as 'statiic'). In this case it is
better to fail fast so the operator can detect this and correct the
mistake, than to mask the error and essentially disable the cpumanager
unexpectedly.
2019-07-18 13:24:09 +02:00
Kubernetes Prow Robot
1125054612
Merge pull request #80235 from moshe010/remove_string
Remove unnecessary string() from policy_none
2019-07-17 19:34:49 -07:00
Louise Daly
9d7e31e66e Topology Manager Implementation based on Interfaces
Co-authored-by: Kevin Klues <kklues@nvidia.com>
Co-authored-by: Conor Nolan <conor.nolan@intel.com>
Co-authored-by: Sreemanti Ghosh <sreemanti.ghosh@intel.com>
2019-07-17 02:30:21 +01:00
Moshe Levi
d52985d3a0 Remove unnecessary string() from policy_none
Signed-off-by: Moshe Levi <moshele@mellanox.com>
2019-07-17 01:58:43 +03:00
Kubernetes Prow Robot
4197adaf2d
Merge pull request #79343 from nolancon/topology-manager-none
Add Policy None for Topology Manager
2019-07-16 13:22:47 -07:00
Kubernetes Prow Robot
80537a9c5f
Merge pull request #77323 from tedyu/cgroup-mgr-linux
Check error return from Update
2019-07-15 14:53:24 -07:00
Kubernetes Prow Robot
923f08e29b
Merge pull request #79900 from mikebrow/todo-cleanup-container-manager-linux
update code documentation to reflect change in status
2019-07-11 18:33:35 -07:00
Kubernetes Prow Robot
920ac08361
Merge pull request #76518 from haiyanmeng/limit
Limit the read length of ioutil.ReadAll in `pkg/kubelet` and `pkg/probe`
2019-07-11 17:01:07 -07:00
Kubernetes Prow Robot
f0d1b10092
Merge pull request #77429 from tedyu/container-linux-err
Avoid unnecessary concatenation of errors
2019-07-11 14:33:08 -07:00
Haiyan Meng
1f270ef4e2
Limit the read length of ioutil.ReadAll in pkg/kubelet and pkg/probe
Signed-off-by: Haiyan Meng <haiyanmeng@google.com>
2019-07-11 13:18:06 -07:00
Kubernetes Prow Robot
d4d8daea73
Merge pull request #78558 from tedyu/policy-str
Remove unnecessary string()
2019-07-11 13:13:06 -07:00
Kubernetes Prow Robot
858fce1634
Merge pull request #79531 from odinuge/kubelet-dead-code
Remove unnecessary variable declaration
2019-07-08 14:28:01 -07:00
Mike Brown
6da266784a update code documentation to reflect change in status
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2019-07-08 16:15:59 -05:00
Odin Ugedal
4ee5fe23e8
Fix cgroup hugetlb size prefix for kB
Use the exported list from runc that uses "KB" and not "kB".

This issue breaks kubelet on AArch64 (arm 64).

var HugePageSizeUnitList = []string{"B", "KB", "MB", "GB", "TB", "PB"}

The hugetlb cgroup control files (introduced here in 2012:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abb8206cb0773)
use "KB" and not "kB"
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/hugetlb_cgroup.c?h=v5.0#n349).

The behavior in the kernel has not changed since the introduction, and
the current code using "kB" will therefore fail on devices with huge
pages smaller than 1MiB. This is the case for AArch64.

As seen from the code in "mem_fmt" inside hugetlb_cgroup.c, only "KB",
"MB" and "GB" are used, so the others may be removed as well.

Here is a real world example of the files inside the
"/sys/kernel/mm/hugepages/" directory:
- "hugepages-64kB"
- "hugepages-2048kB"
- "hugepages-32768kB"
- "hugepages-1048576kB"

And the corresponding cgroup files:
- "hugetlb.64KB._____"
- "hugetlb.2MB._____"
- "hugetlb.32MB._____"
- "hugetlb.1GB._____"

Signed-off-by: Odin Ugedal <odin@ugedal.com>
2019-06-28 21:28:26 +02:00
Odin Ugedal
2bcdb944f0
Update dependency opencontainer/runc 2019-06-28 21:23:05 +02:00
Odin Ugedal
9c2aa843bd Remove unnecessary variable declaration 2019-06-28 18:03:23 +02:00
Kubernetes Prow Robot
c64f81d082
Merge pull request #78653 from sjenning/add-sjenning-owners
kubelet: add sjenning to kubelet subdirectory owners files
2019-06-25 14:47:15 -07:00
nolancon
2d7ac702d6 Add Policy None for Topology Manager
Update naming of test functions.
2019-06-25 03:24:31 +01:00
rafatio
08c258add9 Ignore cgroup pid support if related feature gates are disabled 2019-06-15 18:45:27 -03:00
Kubernetes Prow Robot
d30fbab4b8
Merge pull request #77915 from SataQiu/fix-golint-util-20190515
Fix golint failures of pkg/util/parsers pkg/util/sysctl pkg/util/system
2019-06-14 00:29:00 -07:00
mattjmcnaughton
5539e61032
Fix reserved cgroup systemd
Fix an issue in which, when trying to specify the `--kube-reserved-cgroup`
(or `--system-reserved-cgroup`) with `--cgroup-driver=systemd`, we will
not properly convert the `systemd` cgroup name into the internal cgroup
name that k8s expects. Without this change, specifying
`--kube-reserved-cgroup=/test.slice --cgroup-driver=systemd` will fail,
and only `--kube-reserved-cgroup=/test --crgroup-driver=systemd` will succeed,
even if the actual cgroup existing on the host is `/test.slice`.

Additionally, add light unit testing of our process from converting to a
systemd cgroup name to kubernetes internal cgroup name.
2019-06-07 10:48:42 -04:00
Seth Jennings
89dc2c65e4 kubelet: add sjenning to kubelet subdirectory owners files 2019-06-03 08:26:24 -05:00
Alexander Kanevskiy
89481f8c27 Use go standard library for common bit operations
PR#72913 introduced own versions of the bit operations that are
less efficient than ones from standard library.
2019-06-01 19:54:38 +03:00
Kubernetes Prow Robot
9ac58bae56
Merge pull request #78515 from klueska/upstream-socketmask-updates
Updates to the SocketMask abstraction for the TopologyManager
2019-06-01 09:50:16 -07:00
Kubernetes Prow Robot
46c74629cf
Merge pull request #78516 from klueska/upstream-topology-manager-interface-updates
Update the TopologyManager interfaces
2019-06-01 08:00:19 -07:00
Kubernetes Prow Robot
fe37733a12
Merge pull request #73891 from taragu/plugin-manager
Add kubelet plugin manager
2019-05-31 07:12:29 -07:00
Kubernetes Prow Robot
f49fe2a750
Merge pull request #72787 from dashpole/cadvisor_prefix_whitelist
Only collect metrics for cgroups required by the summary API
2019-05-31 00:28:26 -07:00
Ted Yu
1a755d13a6 Remove unnecessary string() 2019-05-30 19:48:26 -07:00
Tara Gu
5e18554442 Implement plugin manager - a controller that manages plugin registration/unregistration 2019-05-30 19:00:59 -04:00
Kevin Klues
0a43d21c26 Add IsNarrowerThan() function to socketmask abstraction 2019-05-30 06:00:22 -07:00
Kevin Klues
617a1fa394 Update the TopologyManager interfaces
These updates are based on discussions had about the preferred semantics
of the TopologyManager and will be reflected in changes to an upcoming
PR that adds the actual TopologyManager implementation.
2019-05-30 05:52:11 -07:00
Kevin Klues
cdb59d3c7a Fix incorrect names for tests in socketmask 2019-05-30 04:16:53 -07:00
nolancon
0244c0e658 remove dependency on implementation from policy preferred and strict
update build
2019-05-30 05:57:39 +01:00
nolancon
ef9baf313d Update unit tests for TopologyHints - Topology Manager Policies 2019-05-30 05:44:01 +01:00
nolancon
e82fa41fb2 More Intuitive TopologyHints - topology manager policies 2019-05-30 05:44:01 +01:00
Sreemanti Ghosh
4e503597b8 Unit test for Topology Manager policy_strict and policy_preferred 2019-05-30 05:44:01 +01:00
nolancon
eff568e496 Add Policies Strict and Preferred for Topology Manager 2019-05-30 05:44:01 +01:00
Ted Yu
c46ec66a1f Avoid unnecessary concatenation of errors 2019-05-29 17:25:53 -07:00
lmdaly
c1a4457573 Update Bazel files to include SocketMask 2019-05-29 02:21:51 +01:00
Conor Nolan
d99bac12e6 Update Remove/AddPod to Container (#26)
More intuitive TopologyHints
2019-05-29 02:11:15 +01:00
lmdaly
e64c558a11 Added BUILD files and updates to Boilerplates 2019-05-29 02:11:15 +01:00
lmdaly
71bbc6d538 Add Topology Manager Interfaces
*Topology Manager
*Policy
2019-05-29 02:10:46 +01:00
Kubernetes Prow Robot
3b4473f45a
Merge pull request #72913 from nolancon/topology-manager-socket-mask
Add Socket Mask for Topology Manager
2019-05-28 10:58:41 -07:00
nolancon
b7f6b8f8f1 Updated unit test for socketmask 2019-05-28 05:00:04 +01:00
nolancon
283dff9335 Update SocketMask based on feedback
TODO: Unit tests to be updated
2019-05-27 07:19:03 +01:00
Richard Chen
c9f1b57b5b Reset extended resources only when node is recreated. 2019-05-21 14:16:54 -07:00
Kubernetes Prow Robot
e476a60ccb
Merge pull request #73241 from vikaschoudhary16/selinux-label
Add correct selinux label at plugin socket directory
2019-05-20 11:07:17 -07:00
vikaschoudhary16
58d1b4d564 Add correct selinux label at plugin socket directory 2019-05-18 12:35:17 +05:30
Kubernetes Prow Robot
3c02a38fdc
Merge pull request #77609 from tedyu/union-all-test
Add test for CPUSet#UnionAll
2019-05-16 20:39:26 -07:00
Kubernetes Prow Robot
b276043051
Merge pull request #77421 from tedyu/cpu-free-no-sort
Obtain unsorted slice in cpuAccumulator#freeCores
2019-05-16 16:26:53 -07:00
Ted Yu
52f797188f Add test for CPUSet#UnionAll
Signed-off-by: Ted Yu <yute@vmware.com>
2019-05-16 12:13:33 -07:00
SataQiu
b36d8d431f fix golint failures of pkg/util/parsers pkg/util/sysctl pkg/util/system 2019-05-15 23:19:47 +08:00
nolancon
e8566caa3f Update to unit test and comment bug fixed 2019-05-13 06:41:44 +01:00
David Ashpole
f8dff6bd5b only collect metrics for cgroups required by the summary API 2019-05-10 12:12:41 -07:00
Andrew Kim
c919139245 update import of generic featuregate code from k8s.io/apiserver/pkg/util/feature -> k8s.io/component-base/featuregate 2019-05-08 10:01:50 -04:00
nolancon
7c525ffaa8 More intuitive TopologyHints - socketmask.go 2019-05-08 04:22:39 +01:00
Kubernetes Prow Robot
b4211dea98
Merge pull request #77422 from tedyu/policy-set-union
Union all CPUSets in one round
2019-05-06 14:02:05 -07:00
Ted Yu
e967c37068 Union all CPUSets in one round 2019-05-03 14:40:33 -07:00
Ted Yu
f83bac61a4 Obtain unsorted slice in cpuAccumulator#freeCores 2019-05-03 14:07:47 -07:00
Ted Yu
89c8a91c0f Check error return from Update
Signed-off-by: Ted Yu <yute@vmware.com>
2019-05-02 09:56:40 -07:00
Kubernetes Prow Robot
98c4c1e2d8
Merge pull request #77291 from tedyu/cpu-pod-stat
Query pod status outside loop over containers
2019-05-01 23:28:56 -07:00
Kubernetes Prow Robot
a5a70b4de3
Merge pull request #74859 from ahadas/static_policy
kubelet/cm: code optimization for the static policy
2019-05-01 23:28:19 -07:00
Ted Yu
3fc16a7e82 Log pod name when pod status cannot be queried 2019-05-01 15:01:56 -07:00
Ted Yu
66ce52578a Query pod status outside loop over containers 2019-04-30 19:35:32 -07:00
Kevin Klues
ef27f5f1a5 Add ability to find init Container IDs in cpumanager reconcileState()
The cpumanager loops through all init Containers and app Containers when
reconciling its state. However, the current implementation of
findContainerIDByName(), which is call by the reconciler, does not
resolve for init Containers.

This patch updates findContainerIDByName() to account for init
Containers and adds a regression test that fails before the change and
succeeds after.
2019-04-27 06:18:55 -07:00
WanLinghao
62d8081eda Fix a log info error 2019-03-29 13:27:10 +08:00
Davanum Srinivas
33081c1f07
New staging repository for cri-api
Change-Id: I2160b0b0ec4b9870a2d4452b428e395bbe12afbb
2019-03-26 18:21:04 -04:00
Arik Hadas
4a47148afe kubelet/cm: fix test description
Signed-off-by: Arik Hadas <ahadas@redhat.com>
2019-03-07 21:23:15 +02:00
Arik Hadas
26e1c1cee7 kubelet/cm: code optimization for the static policy
Minor optimization in the code that attempts to assign whole
sockets/cores in case the number of CPUs requested is higher
than CPUs-per-socket/core: check if the number of requested
CPUs is higher than CPUs-per-socket/core before retrieving
and iterating the free sockets/cores, and break the loops
when that is no longer the case.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
2019-03-07 21:23:15 +02:00
Sreemanti-Ghosh
ce56956409 Socket mask unit test (#4) 2019-03-05 08:00:04 +00:00
nolancon
a273333f1f Add BUILD files and Boilerplates
Updates based on comments
* Export comments added
* glog changed to klog
* Other small edits
2019-03-05 07:59:51 +00:00
nolancon
f10e76962f Add Socket Mask for Topology Manager 2019-03-01 07:20:47 +00:00
Kubernetes Prow Robot
4b1282d925
Merge pull request #74016 from ahadas/topology_cleanup
Cleanup in topology.go
2019-02-27 22:49:24 -08:00
danielqsj
79a3eb816c rename latency to duration in metrics 2019-02-18 17:40:04 +08:00
danielqsj
9fd99a48f5 Change kubelet metrics to conform guideline 2019-02-18 14:01:58 +08:00
Kubernetes Prow Robot
c88dcee3e9
Merge pull request #73824 from jiayingz/reallocate
Checks whether we have cached runtime state before starting a container
2019-02-15 20:35:30 -08:00
Arik Hadas
c3a533e5b2 Cleanup in topology.go
1. Find the minimal thread number within a core using a
single loop rather than by sorting the thread numbers.

2. Inline getUniqueCoreID#err and Discover#numCPUs variables.

3. Narrow the scope of Discover#coreID and Discover#err variables.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
2019-02-14 16:55:37 +02:00
Kubernetes Prow Robot
888ff4097a
Merge pull request #73651 from RobertKrawitz/node_pids_limit
Support total process ID limiting for nodes
2019-02-13 17:31:18 -08:00
Robert Krawitz
2597a1d97e Implement SupportNodePidsLimit, hand-tested 2019-02-13 14:56:17 -05:00
Kubernetes Prow Robot
b50c643be0
Merge pull request #73540 from rlenferink/patch-5
Updated OWNERS files to include link to docs
2019-02-08 09:05:56 -08:00
Jiaying Zhang
00b88c14b0 Checks whether we have cached runtime state before starting a container
that requests any device plugin resource. If not, re-issue Allocate
grpc calls. This allows us to handle the edge case that a pod got
assigned to a node even before it populates its extended resource
capacity.
2019-02-07 11:12:36 -08:00
Kubernetes Prow Robot
dc1244c6cd
Merge pull request #72785 from derekwaynecarr/hugepages-ga
Graduate HugePages feature to GA
2019-02-05 13:56:51 -08:00
Roy Lenferink
b43c04452f Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
Kubernetes Prow Robot
03b434c9d4
Merge pull request #58122 from tianshapjq/nit-int-is-enough
Len() is already int
2019-02-03 12:02:24 -08:00
Derek Carr
deae071d78 Graduate HugePages feature to GA 2019-02-02 00:21:10 -05:00
Andrew Kim
84191eb99b replace pkg/util/file with k8s.io/utils/path 2019-01-29 15:20:13 -05:00
Bernhard Altendorfer
736f35ec29 Fix golint failures 2019-01-24 00:14:25 +01:00
David Ashpole
2b8bc85f75 fix panic in NodeAllocatable node e2e test 2019-01-17 10:57:09 -08:00
ailusazh
10995f661d clean containers in reconcileState of cpuManager 2019-01-15 16:09:28 +08:00
Kubernetes Prow Robot
0dbc99719a
Merge pull request #72076 from derekwaynecarr/pid-limiting
SupportPodPidsLimit feature beta with tests
2019-01-10 01:18:30 -08:00
Kubernetes Prow Robot
d88994cf9f
Merge pull request #71306 from ping035627/k8s-181121
fix some typos
2019-01-09 09:06:31 -08:00
Derek Carr
bce9d5f204 SupportPodPidsLimit feature beta with tests 2019-01-09 10:50:59 -05:00
Kubernetes Prow Robot
4e8bea4bb7
Merge pull request #71194 from yanghaichao12/dev1119-1
Fix comment error of 'cpuManagerStateFileName'
2018-12-17 20:28:19 -08:00
yuexiao-wang
7b6f60f085 modify BUILD
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-12-11 11:22:06 +08:00
yuexiao-wang
f3353c358d [scheduler cleanup phase 2]: Rename to
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-12-11 11:21:12 +08:00
k8s-ci-robot
79e5cb2cb7
Merge pull request #71302 from liggitt/verify-unit-test-feature-gates
Split mutable and read-only access to feature gates, limit tests to readonly access
2018-11-29 21:45:12 -08:00
saad-ali
a7c5582bba Permit use of deprecated dir in device plugin. 2018-11-21 18:37:31 -08:00
saad-ali
8f666d9e41 Modify kubelet watcher to support old versions
Modify kubelet plugin watcher to support older CSI drivers that use an
the old plugins directory for socket registration.
Also modify CSI plugin registration to support multiple versions of CSI
registering with the same name.
2018-11-21 18:37:31 -08:00
PingWang
9d541911bb fix some typos
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

fix typo

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2018-11-22 08:27:14 +08:00
Jordan Liggitt
70ad4dff48 Fix unit tests calling SetFeatureGateDuringTest incorrectly 2018-11-21 11:51:33 -05:00
yanghaichao12
982d1778f8 Fix comment error of 'cpuManagerStateFileName' 2018-11-19 08:07:04 -05:00
Vladimir Vivien
b195396154 Kubelet Plugin Registration v1 update fix 2018-11-15 17:40:35 -05:00
David Ashpole
630cb53f82 add kubelet grpc server for pod-resources service 2018-11-15 09:43:20 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
David Ashpole
d4f6ae3615 fix slice sharing bug in cgroup manager 2018-11-05 17:42:42 -08:00
Pengfei Ni
856c83e637 Enable allocatable support for Windows nodes 2018-10-30 11:17:23 +08:00
Christoph Blecker
97b2992dc1
Update gofmt for go1.11 2018-10-05 12:59:38 -07:00
k8s-ci-robot
3fe21e5433
Merge pull request #68922 from BenTheElder/version-staging
move pkg/util/version to staging
2018-09-26 22:59:42 -07:00
k8s-ci-robot
0ca25b8db7
Merge pull request #68816 from FengyunPan2/cgroup-info
Add helpful log for checking cgrop path
2018-09-26 18:10:46 -07:00
FengyunPan2
34a8b1fd9f Add helpful log for checking cgrop path
Currently I just get 'xxx cgroup does not exist', but I don't know
which path has missed. Let's add log for it.
2018-09-25 10:10:12 +08:00
k8s-ci-robot
8346631860
Merge pull request #68053 from Pingan2017/rmifblock
clean up unneeded else block
2018-09-24 17:17:29 -07:00
Benjamin Elder
8b56eb8588 hack/update-gofmt.sh 2018-09-24 12:21:29 -07:00
Benjamin Elder
f828c6f662 hack/update-bazel.sh 2018-09-24 12:03:24 -07:00
Benjamin Elder
088cf3c37b find & replace version import 2018-09-24 12:03:24 -07:00
Renaud Gaubert
8dd1d27c03 Updated the device manager pluginwatcher handler 2018-09-06 15:34:46 +02:00
Sandor Szücs
588d2808b7
fix #51135 make CFS quota period configurable, adds a cli flag and config option to kubelet to be able to set cpu.cfs_period and defaults to 100ms as before.
It requires to enable feature gate CustomCPUCFSQuotaPeriod.

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
2018-09-01 20:19:59 +02:00
Pingan2017
2f1284bc34 cleanup unneeded if block 2018-08-30 17:18:56 +08:00
Kubernetes Submit Queue
c491d48cde
Merge pull request #67430 from choury/cpumanager
Automatic merge from submit-queue (batch tested with PRs 67430, 67550). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

cpumanager: rollback state if updateContainerCPUSet failed

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63018

If `updateContainerCPUSet`  failed, the container will start failed. We should rollback the state to avoid CPU leak.
**Special notes for your reviewer**:

**Release note**:

```release-note
cpumanager: rollback state if updateContainerCPUSet failed
```
2018-08-21 23:20:58 -07:00
Ismo Puustinen
dd3eeb3f46 device manager: don't do operations on nil pointer.
If grpc.DialContext() fails, a nil connection is returned. Check the
error before calling conn.Close().
2018-08-21 15:20:36 +03:00
Kubernetes Submit Queue
d017bebf6b
Merge pull request #67145 from jiayingz/reboot-fix
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fail container start if its requested device plugin resource is unknown.

With the change, Kubelet device manager now checks whether it has cached option state for the requested device plugin resource to make sure the resource is in ready state when we start the container.



**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubernetes/issues/67107

**Special notes for your reviewer**:

**Release note**:

```release-note
Fail container start if its requested device plugin resource hasn't registered after Kubelet restart.
```
2018-08-21 01:48:54 -07:00
choury
36b92b9b29 cpumanager: rollback state if updateContainerCPUSet failed 2018-08-17 18:08:58 +08:00
tianshapjq
81081dc9e7 nits in manager.go 2018-08-15 08:16:04 +08:00
Jiaying Zhang
7b1ae66432 Fail container start if its requested device plugin resource doesn't
have cached option state to make sure the device plugin resource is
in ready state when we start the container.
2018-08-08 13:11:36 -07:00
Kubernetes Submit Queue
60ac433922
Merge pull request #66946 from LinEricYang/unused-variable
Automatic merge from submit-queue (batch tested with PRs 66512, 66946, 66083). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubelet/cm/cpumanager: Fix unused variable "skipIfPermissionsError"

The variable "skipIfPermissionsError" is not needed even when
permission error happened.
2018-08-06 19:44:04 -07:00
Kubernetes Submit Queue
d114692a58
Merge pull request #58058 from tianshapjq/cleanup-useless-var-deviceplugin/types.go
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

clean up useless variables in deviceplugin/types.go

**What this PR does / why we need it**:
some variables is useless for reasons, I think we need a clean up.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note

```NONE
2018-08-06 16:33:54 -07:00
Lin Yang
b7e1f0bf17 kubelet/cm/cpumanager: Fix unused variable "skipIfPermissionsError"
The variable "skipIfPermissionsError" is not needed even when
permission error happened.
2018-08-02 17:24:33 -07:00
Kubernetes Submit Queue
266cf70ac0
Merge pull request #66617 from pravisankar/fix-pod-cgroup-parent
Automatic merge from submit-queue (batch tested with PRs 66190, 66871, 66617, 66293, 66891). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Do not set cgroup parent when --cgroups-per-qos is disabled

When --cgroups-per-qos=false (default is true), kubelet sets pod
container management to podContainerManagerNoop implementation and
GetPodContainerName() returns '/' as cgroup parent (default cgroup root).

(1) In case of 'systemd' cgroup driver, '/' is invalid parent as
docker daemon expects '.slice' suffix and throws this error:
'cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"'
(5fc12449d8/daemon/daemon_unix.go (L618))
'/' corresponds to '-.slice' (root slice) in systemd but I don't think
we want to assign root slice instead of runtime specific default value.
In case of docker runtime, this will be 'system.slice'
(e2593239d9/daemon/oci_linux.go (L698))

(2) In case of 'cgroupfs' cgroup driver, '/' is valid parent but I don't
think we want to assign root instead of runtime specific default value.
In case of docker runtime, this will be '/docker'
(e2593239d9/daemon/oci_linux.go (L695))

Current fix will not set the cgroup parent when --cgroups-per-qos is disabled.

```release-note
Fix pod launch by kubelet when --cgroups-per-qos=false and --cgroup-driver="systemd"
```
2018-08-02 15:42:16 -07:00
Kubernetes Submit Queue
2f21394859
Merge pull request #66190 from linyouchong/issue-66189
Automatic merge from submit-queue (batch tested with PRs 66190, 66871, 66617, 66293, 66891). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix nil pointer dereference in node_container_manager#enforceExisting

**What this PR does / why we need it**:
fix nil pointer dereference in node_container_manager#enforceExisting

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66189

**Special notes for your reviewer**:
NONE

**Release note**:
```release-note
kubelet: fix nil pointer dereference while enforce-node-allocatable flag is not config properly
```
2018-08-02 15:42:09 -07:00
Kubernetes Submit Queue
c2536e2b0d
Merge pull request #61159 from linyouchong/linyouchong-20180314
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Skip checking when failSwapOn=false

**What this PR does / why we need it**:
Skip checking when failSwapOn=false

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
NONE
**Release note**:
```
NONE
```
2018-08-02 14:09:39 -07:00
Kubernetes Submit Queue
f2c6473e25
Merge pull request #66718 from ipuustin/cpu-manager-validate-offline
Automatic merge from submit-queue (batch tested with PRs 66623, 66718). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

cpumanager: validate topology in static policy

**What this PR does / why we need it**:

This patch adds a check for the static policy state validation. The check fails if the CPU topology obtained from cadvisor doesn't match with the current topology in the state file.

If the CPU topology has changed in a node, cpumanager static policy might try to assign non-present cores to containers.

For example in my test case, static policy had the default CPU set of `0-1,4-7`. Then kubelet was shut down and CPU 7 was offlined. After restarting the kubelet, CPU manager tries to assign the non-existent CPU 7 to containers which don't have exclusive allocations assigned to them:

    Error response from daemon: Requested CPUs are not available - requested 0-1,4-7, available: 0-6)

This breaks the exclusivity, since the CPUs from the shared pool don't get assigned to non-exclusive containers, meaning that they can execute on the exclusive CPUs.

**Release note**:

```release-note
Added CPU Manager state validation in case of changed CPU topology.
```
2018-07-31 08:05:06 -07:00
Ismo Puustinen
3bb5ca9257 cpumanager: add test for available CPUs in static policy.
Test the cases where the number of CPUs available in the system is
smaller or larger than the number of CPUs known in the state, which
should lead to a panic. This covers both CPU onlining and offlining. The
case where the number of CPUs matches is already covered by the
"non-corrupted state" test.
2018-07-31 10:20:37 +03:00
Ismo Puustinen
4f604eb73c cpumanager: validate topology in static policy.
This patch adds a check for the static policy state validation. The
check fails if the CPU topology obtained from cadvisor doesn't match
with the current topology in the state file.

If the CPU topology has changed in a node, cpu manager static policy
might try to assign non-present cores to containers.

For example in my test case, static policy had the default CPU set of
0-1,4-7. Then kubelet was shut down and CPU 7 was offlined. After
restarting the kubelet, CPU manager tries to assign the non-existent CPU
7 to containers which don't have exclusive allocations assigned to them:

 Error response from daemon: Requested CPUs are not available - requested 0-1,4-7, available: 0-6)

This breaks the exclusivity, since the CPUs from the shared pool don't
get assigned to non-exclusive containers, meaning that they can execute
on the exclusive CPUs.
2018-07-30 08:49:13 +03:00
hui luo
7101c17498 While reviewing devicemanager code, found
the caching layer on endpoint is redundant.

Here are the 3 related objects in picture:
devicemanager <-> endpoint <-> plugin

Plugin is the source of truth for devices
and device health status.

devicemanager maintain healthyDevices,
unhealthyDevices, allocatedDevices based on updates
from plugin.

So there is no point for endpoint caching devices,
this patch is removing this caching layer on endpoint,

Also removing the Manager.Devices() since i didn't
find any caller of this other than test, i am adding a
notification channel to facilitate testing,

If we need to get all devices from manager in future,
it just need to return healthyDevices + unhealthyDevices,
we don't have to call endpoint after all.

This patch makes code more readable, data model been simplified.
2018-07-29 21:07:14 -07:00
Kubernetes Submit Queue
32e38b6659
Merge pull request #58755 from vikaschoudhary16/probing-mode
Automatic merge from submit-queue (batch tested with PRs 58755, 66414). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use probe based plugin watcher mechanism in Device Manager

**What this PR does / why we need it**:
Uses this probe based utility in the device plugin manager.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #56944 

**Notes For Reviewers**:
Changes are backward compatible and existing device plugins will continue to work. At the same time, any new plugins that has required support for probing model (Identity service implementation), will also work. 


**Release note**
```release-note
Add support kubelet plugin watcher in device manager.
```
/sig node
/area hw-accelerators
/cc /cc @jiayingz @RenaudWasTaken @vishh @ScorpioCPH @sjenning @derekwaynecarr @jeremyeder @lichuqiang @tengqm @saad-ali @chakri-nelluri @ConnorDoyle
2018-07-27 15:20:06 -07:00
bingshen.wbs
b1bdd043c4 fix kubelet npe on device plugin return zero container
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2018-07-25 10:15:30 +08:00
Ravi Sankar Penta
0282720e29 Do not set cgroup parent when --cgroups-per-qos is disabled
When --cgroups-per-qos=false (default is true), kubelet sets pod
container management to podContainerManagerNoop implementation and
GetPodContainerName() returns '/' as cgroup parent (default cgroup root).

(1) In case of 'systemd' cgroup driver, '/' is invalid parent as
docker daemon expects '.slice' suffix and throws this error:
'cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"'
(5fc12449d8/daemon/daemon_unix.go (L618))
'/' corresponds to '-.slice' (root slice) in systemd but I don't think
we want to assign root slice instead of runtime specific default value.
In case of docker runtime, this will be 'system.slice'
(e2593239d9/daemon/oci_linux.go (L698))

(2) In case of 'cgroupfs' cgroup driver, '/' is valid parent but I don't
think we want to assign root instead of runtime specific default value.
In case of docker runtime, this will be '/docker'
(e2593239d9/daemon/oci_linux.go (L695))

Current fix will not set the cgroup parent when --cgroups-per-qos is disabled.
2018-07-20 10:25:50 -07:00
vikaschoudhary16
a5842503eb Use probe based plugin discovery mechanism in device manager 2018-07-17 04:02:31 -04:00
linyouchong
6ff285bce3 fix nil pointer dereference in node_container_manager#enforceExistingCgroup 2018-07-14 10:42:42 +08:00
choury
8e4b62a74b
Remove duplicate check line
There is a same [line](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cm/cpumanager/policy_static.go#L81).
2018-07-05 11:07:56 +08:00
Seth Jennings
3234b0fa5b feature gate LSI capacity calculation 2018-06-28 14:01:08 -05:00
Kubernetes Submit Queue
991a84758f
Merge pull request #59214 from kdembler/cpumanager-checkpointing
Automatic merge from submit-queue (batch tested with PRs 59214, 65330). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Migrate cpumanager to use checkpointing manager

**What this PR does / why we need it**:
This PR migrates `cpumanager` to use new kubelet level node checkpointing feature (#56040) to decrease code redundancy and improve consistency.

**Which issue(s) this PR fixes**:
Fixes #58339

**Notes**:
At point of submitting PR the most straightforward approach was used - `state_checkpoint` implementation of `State` interface was added. However, with checkpointing implementation there might be no point to keep `State` interface and just use single implementation with checkpoint backend and in case of different backend than filestore needed just supply `cpumanager` with custom `CheckpointManager` implementation.

/kind feature
/sig node
cc @flyingcougar @ConnorDoyle
2018-06-25 18:19:00 -07:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton
a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue
148350d3c4
Merge pull request #64426 from cofyc/remove_unnecessary_fakemounters
Automatic merge from submit-queue (batch tested with PRs 64142, 64426, 62910, 63942, 64548). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Clean up fake mounters.

**What this PR does / why we need it**:

Fixes https://github.com/kubernetes/kubernetes/issues/61502

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

list of fake mounters:

- (keep) pkg/util/mount.FakeMounter
- (removed) pkg/kubelet/cm.fakeMountInterface:
- (inherit from mount.FakeMounter) pkg/util/mount.fakeMounter
- (inherit from mount.FakeMounter) pkg/util/removeall.fakeMounter
- (removed) pkg/volume/host_path.fakeFileTypeChecker

**Release note**:

```release-note
NONE
```
2018-06-20 00:05:10 -07:00
Kubernetes Submit Queue
c399c306e2
Merge pull request #59174 from tianshapjq/todo-already-done
Automatic merge from submit-queue (batch tested with PRs 65230, 57355, 59174, 63698, 63659). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

TODO has already been implemented

**What this PR does / why we need it**:
TODO has already been implemented, remove the TODO tag.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note

```NONE
2018-06-19 20:19:17 -07:00
Klaudiusz Dembler
a9df2acc4b Typo fix 2018-06-07 12:08:48 +02:00
Yecheng Fu
40c3937320 Clean up fake mounters. 2018-06-02 15:55:19 +08:00
Kubernetes Submit Queue
d2495b8329
Merge pull request #63143 from jsafrane/containerized-subpath
Automatic merge from submit-queue (batch tested with PRs 63348, 63839, 63143, 64447, 64567). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Containerized subpath

**What this PR does / why we need it**:
Containerized kubelet needs a different implementation of `PrepareSafeSubpath` than kubelet running directly on the host.

On the host we safely open the subpath and then bind-mount `/proc/<pidof kubelet>/fd/<descriptor of opened subpath>`.

With kubelet running in a container, `/proc/xxx/fd/yy` on the host contains path that works only inside the container, i.e. `/rootfs/path/to/subpath` and thus any bind-mount on the host fails.

Solution:
- safely open the subpath and gets its device ID and inode number
- blindly bind-mount the subpath to `/var/lib/kubelet/pods/<uid>/volume-subpaths/<name of container>/<id of mount>`. This is potentially unsafe, because user can change the subpath source to a link to a bad place (say `/run/docker.sock`) just before the bind-mount.
- get device ID and inode number of the destination. Typical users can't modify this file, as it lies on /var/lib/kubelet on the host.
- compare these device IDs and inode numbers.

**Which issue(s) this PR fixes**
Fixes #61456

**Special notes for your reviewer**:

The PR contains some refactoring of `doBindSubPath` to extract the common code. New `doNsEnterBindSubPath` is added for the nsenter related parts.

**Release note**:

```release-note
NONE
```
2018-06-01 12:12:19 -07:00
Guoliang Wang
761cf41427 Move pkg/scheduler/schedulercache -> pkg/scheduler/cache 2018-05-31 22:55:34 +08:00
Jan Safranek
74ba0878a1 Enhance ExistsPath check
It should return error when the check fails (e.g. no permissions, symlink link
loop etc.)
2018-05-23 10:21:20 +02:00
Jan Safranek
97b5299cd7 Add GetMode to mounter interface.
Kubelet must not call os.Lstat on raw volume paths when it runs in a container.
Mounter knows where the file really is.
2018-05-23 10:17:59 +02:00
Klaudiusz Dembler
9384937f2f Update bazel 2018-05-21 17:39:51 +02:00
Klaudiusz Dembler
de1063bc7d Add compatibility tests 2018-05-21 14:50:31 +02:00
Klaudiusz Dembler
3d09101b6f Add docstrings 2018-05-21 11:40:04 +02:00
Jan Safranek
598ca5accc Add GetSELinuxSupport to mounter. 2018-05-17 13:36:37 +02:00
Klaudiusz Dembler
aa325ec2d9 Change JSON letter case in tests 2018-05-15 18:43:48 +02:00
Klaudiusz Dembler
7bb047ec75 Rebase and backward compatibility 2018-05-15 18:34:53 +02:00
Klaudiusz Dembler
ba8d82c96a
Update error indicating unexistent checkpoint 2018-05-14 09:51:27 +02:00
Klaudiusz Dembler
0b1a73e94b
Make cpuManagerCheckpoint exported 2018-05-14 09:51:27 +02:00
Klaudiusz Dembler
cc3fa67bda
Add comments to MockCheckpoint functions and gofmt 2018-05-14 09:51:27 +02:00
Klaudiusz Dembler
0fbd19bc06
Tweaks 2018-05-14 09:51:26 +02:00
Klaudiusz Dembler
3991ed5d2f
Add tests 2018-05-14 09:51:26 +02:00
Klaudiusz Dembler
6bfceed4ab
Migrate cpumanager to use checkpointing manager 2018-05-14 09:45:58 +02:00
Kubernetes Submit Queue
204520b029
Merge pull request #63344 from RobertKrawitz/fix-process-kill-algorithm
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Correct kill logic for pod processes

Correct the kill logic for processes in the pod's cgroup.  os.FindProcess() does not check whether the process exists on POSIX systems.
2018-05-11 11:41:19 -07:00
Kubernetes Submit Queue
321201f672
Merge pull request #63406 from derekwaynecarr/label-pod-cgroups
Automatic merge from submit-queue (batch tested with PRs 60200, 63623, 63406). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Apply pod name and namespace labels for pod cgroup for cadvisor metrics

**What this PR does / why we need it**:
1. Enable Prometheus users to determine usage by pod name and namespace for pod cgroup sandbox.
1. Label cAdvisor metrics for pod cgroups by pod name and namespace.
1. Aligns with kubelet stats summary endpoint pod cpu and memory stats.

**Special notes for your reviewer**:
This provides parity with the summary API enhancements done here:
https://github.com/kubernetes/kubernetes/pull/55969

**Release note**:
```release-note
Apply pod name and namespace labels to pod cgroup in cAdvisor metrics
```
2018-05-10 08:33:11 -07:00
Derek Carr
a09990cd43 Apply pod name and namespace labels for pod cgroup for cadvisor metrics 2018-05-07 14:51:12 -04:00