Commit Graph

1974 Commits

Author SHA1 Message Date
Davanum Srinivas
5692926914
Move packages for slightly better UX for consumers
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-20 10:57:46 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
mattjmcnaughton
29fa1f4566
Fix the verify job
Small changes to fix the verify job. Add the proper headers, fix lint
errors, etc...
2020-05-07 17:18:50 -04:00
mattjmcnaughton
7fb6c51822
Move DockerLegacyService interface out of pkg/kubelet/dockershim
DockerLegacyService interface is used throughout `pkg/kubelet`.
It used to live in the `pkg/kubelet/dockershim` package. While we
would eventually like to remove it entirely, we need to give users some form
of warning.

By including the interface in
`pkg/kubelet/legacy/logs.go`, we ensure the interface is
available to `pkg/kubelet`, even when we are building with the `dockerless`
tag (i.e. not compiling the dockershim).
While the interface always exists, there will be no implementations of the
interface when building with the `dockerless` tag. The lack of
implementations should not be an issue, as we only expect `pkg/kubelet` code
to need an implementation of the `DockerLegacyService` when we are using
docker. If we are using docker, but building with the `dockerless` tag, than
this will be just one of many things that breaks.

`pkg/kubelet/legacy` might not be the best name for the package... I'm
very open to finding a different package name or even an already
existing package.
2020-05-07 17:18:49 -04:00
mattjmcnaughton
34c8f51dcb
Remove all uses of dockershim from cmd/kubelet
We can remove all uses of `dockershim` from `cmd/kubelet`, by just
passing the docker options to the kubelet in their pure form, instead of
using them to create a `dockerClientConfig` (which is defined in
dockershim). We can then construct the `dockerClientConfig` only when we
actually need it.
2020-05-07 17:18:49 -04:00
mattjmcnaughton
e0e6d54cdf
Extract running Dockershim into own file
Extract a `runDockershim` function into a file outside of `kubelet.go`.
We can use build tags to compile two separate functions... one which
actually runs dockershim and one that is a no-op.
2020-05-07 17:18:48 -04:00
wawa0210
40da2c521a
Remove duplicate calculation nodename 、hostname 、hostnameOverridden 2020-04-24 07:49:33 +08:00
Tim Hockin
9551ecb7c3 Cleanup: Change "Ip" to "IP" in func and var names 2020-04-10 15:29:50 -07:00
mattjmcnaughton
6b5b8bb186
Delete unused Builder type from kubelet.go
As far as I can tell, nothing uses this type. As a result, it doesn't
really provide any benefit, and just clutters `kubelet.go`.

There's also the risk of it falling out of date with `NewMainKubelet`,
as nothing enforces `NewMainKubelet` being of the `Builder` type.
2020-03-28 20:04:58 -04:00
Kubernetes Prow Robot
7a513b575a
Merge pull request #88440 from smarterclayton/container_success_fix
Ensure Kubelet always reports terminating pod container status
2020-03-04 20:13:04 -08:00
Yu-Ju Hong
2364c10e2e
kubelet: Don't delete pod until all container status is available
After a pod reaches a terminal state and all containers are complete
we can delete the pod from the API server. The dispatchWork method
needs to wait for all container status to be available before invoking
delete. Even after the worker stops, status updates will continue to
be delivered and the sync handler will continue to sync the pods, so
dispatchWork gets multiple opportunities to see status.

The previous code assumed that a pod in Failed or Succeeded had no
running containers, but eviction or deletion of running pods could
still have running containers whose status needed to be reported.

This modifies earlier test to guarantee that the "fallback" exit
code 137 is never reported to match the expectation that all pods
exit with valid status for all containers (unless some exceptional
failure like eviction were to occur while the test is running).
2020-03-04 13:34:25 -05:00
Clayton Coleman
ad3d8949f0
kubelet: Preserve existing container status when pod terminated
The kubelet must not allow a container that was reported failed in a
restartPolicy=Never pod to be reported to the apiserver as success.
If a client deletes a restartPolicy=Never pod, the dispatchWork and
status manager race to update the container status. When dispatchWork
(specifically podIsTerminated) returns true, it means all containers
are stopped, which means status in the container is accurate. However,
the TerminatePod method then clears this status. This results in a
pod that has been reported with status.phase=Failed getting reset to
status.phase.Succeeded, which is a violation of the guarantees around
terminal phase.

Ensure the Kubelet never reports that a container succeeded when it
hasn't run or been executed by guarding the terminate pod loop from
ever reporting 0 in the absence of container status.
2020-03-04 13:34:24 -05:00
Kevin Klues
2327934a86 Rename GetTopologyPodAmitHandler() as
GetAllocateResourcesPodAdmitHandler(). It is named as such to reflect its
new function. Also remove the Topology Manager feature gate check at higher level
kubelet.go, as it is now done in GetAllocateResourcesPodAdmitHandler().
2020-02-27 07:52:43 +00:00
mattjmcnaughton
9e1c99c4e2
Delete the sysctl runtime admit handler
As of https://github.com/kubernetes/kubernetes/pull/72831, the minimum
docker version is 1.13.1. (and the minimum API version is 1.26). The
only time the `RuntimeAdmitHandler` returns anything other than accept
is when the Docker API version < 1.24. In other words, we can be
confident that Docker will always support sysctl.

As a result, we can delete this unnecessary and docker-specific code.
2020-01-22 08:51:39 -05:00
Kubernetes Prow Robot
f4db8212be
Merge pull request #76496 from danielqsj/metrics-2
Clean deprecated metrics
2020-01-13 20:53:09 -08:00
Kubernetes Prow Robot
befc371364
Merge pull request #86702 from mattjmcnaughton/mattjmcnaughton/refactor-oom-watcher-to-allow-greater-test-coverage
Refactor oom watcher to allow greater test coverage
2020-01-10 15:43:37 -08:00
danielqsj
1a9b121764 remove deprecated metrics of kubelet 2020-01-10 16:46:52 +08:00
mattjmcnaughton
8897c435ad
Refactor oom watcher to allow greater test coverage
This diff contains a strict refactor; there are no behavioral changes.

Address a long standing TODO in `oom_watcher_linux_test.go` around test
coverage. We refactor our `oom.Watcher` so it takes in a struct
fulfulling the `streamer` interface (i.e. defines `StreamOoms` method).
In production, we will continue to use the `oomparser` from `cadvisor`.
However, for testing purposes, we can now create our own `fakeStreamer`,
and control how it streams `oomparser.OomInstance`. With this fake, we
can implement richer unit testing for the `oom.Watcher` itself.

Actually adding the additional unit tests will come in a later commit.
2020-01-07 21:48:14 -05:00
louisgong
324e5ce7e3 hollow-node use remote CRI 2020-01-07 11:00:45 +08:00
Jacek Kaniuk
4303be3d9f Revert pull request #85879 "hollow-node use remote CRI" 2019-12-19 10:52:35 +01:00
louisgong
e8e1cc9ee0 extract PreInitRuntimeService from NewMainKubelet 2019-12-18 11:48:29 +08:00
louisgong
0dd468039d inject remoteRuntime to kubelet dependency 2019-12-06 14:12:08 +08:00
louisgong
b469404d97 hollow-node use remote CRI 2019-12-04 17:07:04 +08:00
Travis Rhoden
0c5c3d8bb9
Remove pkg/util/mount (moved out of tree)
This patch removes pkg/util/mount completely, and replaces it with the
mount package now located at k8s.io/utils/mount. The code found at
k8s.io/utils/mount was moved there from pkg/util/mount, so the code is
identical, just no longer in-tree to k/k.
2019-11-15 08:29:12 -07:00
Kubernetes Prow Robot
a08b09d52f
Merge pull request #84279 from matthyx/kuberuntime-startupprobe
Add startupProbe result handling to kuberuntime
2019-11-13 13:01:53 -08:00
Matthias Bertschy
66595d54a0 Add startupProbe result handling to kuberuntime 2019-11-13 08:12:54 +01:00
Kubernetes Prow Robot
897ce3073c
Merge pull request #84533 from davidz627/fix/deprecatedPath
Remove plugin watching of deprecated directory and CSI v0 support in accordance with deprecation policy
2019-11-12 04:48:20 -08:00
David Zhu
802fe12803 Remove plugin watching of deprecated directory {kubelet_root_dir}/plugins and support for CSI V0 in accordance with deprecation announcement in https://v1-13.docs.kubernetes.io/docs/setup/release/notes/ 2019-11-11 11:42:58 -08:00
Kubernetes Prow Robot
0155d18fbc
Merge pull request #84485 from tallclair/mirror-owner
Mirror owner
2019-11-09 20:19:39 -08:00
Kubernetes Prow Robot
ae15368355
Merge pull request #84351 from wojtek-t/promote_node_lease_to_GA
Promote node lease to GA
2019-11-08 09:00:15 -08:00
wojtekt
ffad401b4e Promote NodeLease feature to GA 2019-11-05 09:01:12 +01:00
chendotjs
5381c9afe1 simplify check for IPv6 in kubelet. 2019-11-04 22:01:51 +08:00
Kubernetes Prow Robot
b1ac4cda11
Merge pull request #84253 from yutedz/kube-solve-check
Move CheckLimitsForResolvConf to Kubelet#syncLoop
2019-10-31 18:04:54 -07:00
Tim Allclair
bbb939357e Fix rebase issue 2019-10-30 17:50:13 -07:00
Tim Allclair
f827863128 Inject owner references into mirror pods 2019-10-29 16:14:06 -07:00
Alex Wang
b1a3fb4988 change kubelte nodeInfo to nodeLister 2019-10-24 22:46:59 +08:00
Ted Yu
ae9e93d784 Move CheckLimitsForResolvConf to Kubelet#syncLoop 2019-10-23 17:16:23 -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
Kubernetes Prow Robot
cc8bfd1cdd
Merge pull request #78720 from goodluckbot/fix-kubelet-runtime-error-log-level
Fix log level for runtime error in kubelet.go
2019-10-08 10:57:10 -07:00
Davanum Srinivas
f29d2272c8
fix gofmt and golint failures
Change-Id: I6535b506f50558b31663a13cd270b15023afa2c6
2019-10-06 18:43:17 -04:00
Davanum Srinivas
d30c489c54
Move pkg/kubelet/pluginregistration and deviceplugin
Change-Id: I06adcb43bd278b430ffad2010869e1524c8cc4ff
2019-10-06 15:28:38 -04:00
Ted Yu
0939f90103 Check whether mirror pod is ciritical in managerImpl#evictPod 2019-10-01 11:12:18 -07:00
Dan Winship
3948f16ff4 Add iptables.Monitor, use it from kubelet and kube-proxy
Kubelet and kube-proxy both had loops to ensure that their iptables
rules didn't get deleted, by repeatedly recreating them. But on
systems with lots of iptables rules (ie, thousands of services), this
can be very slow (and thus might end up holding the iptables lock for
several seconds, blocking other operations, etc).

The specific threat that they need to worry about is
firewall-management commands that flush *all* dynamic iptables rules.
So add a new iptables.Monitor() function that handles this by creating
iptables-flush canaries and only triggering a full rule reload after
noticing that someone has deleted those chains.
2019-09-17 10:19:26 -04:00
Dan Winship
b6c3d5416a Drop iptables firewalld monitoring support
The firewalld monitoring code was not well tested (and not easily
testable), would never be triggered on most platforms, and was only
being taken advantage of from one place (kube-proxy), which didn't
need it anyway since it already has its own resync loop.

Since the firewalld monitoring was the only consumer of pkg/util/dbus,
we can also now delete that.
2019-09-15 15:35:40 -04:00
Travis Rhoden
935c23f2ad
Move HostUtil to pkg/volume/util/hostutil
This patch moves the HostUtil functionality from the util/mount package
to the volume/util/hostutil package.

All `*NewHostUtil*` calls are changed to return concrete types instead
of interfaces.

All callers are changed to use the `*NewHostUtil*` methods instead of
directly instantiating the concrete types.
2019-08-30 10:14:42 -06:00
Kubernetes Prow Robot
d5f9a81d0f
Merge pull request #79873 from tedyu/kube-runtime
Set runtimeState when RuntimeReady is not set or false
2019-08-23 17:58:37 -07:00
Jan Safranek
5b69362ff0 Skip unused volumes in VolumeManager
DesiredStateOfWorldPopulator should skip a volume that is not used in any
pod. "Used" means either mounted (via volumeMounts) or used as raw block
device (via volumeDevices).

Especially when block feature is disabled, a block volume must not get into
DesiredStateOfWorld, because it would be formatted and mounted there.
2019-08-15 10:48:38 +02:00
Kubernetes Prow Robot
56b5f8b47c
Merge pull request #80519 from ethan-daocloud/patch-1
fix typos in kubelet.go
2019-08-12 20:11:51 -07:00
Ted Yu
3865e2b956 Set runtimeState when RuntimeReady is not set or false 2019-08-09 18:52:27 -07:00
Himanshu Pandey
c05d506019 changed IsCriticalPod to return true in case of static pods 2019-08-07 15:47:43 -07:00