Commit Graph

40 Commits

Author SHA1 Message Date
Stephen Kitt
3f36c83c68
Switch to stretchr/testify / mockery for mocks
testify is used throughout the codebase; this switches mocks from
gomock to testify with the help of mockery for code generation.

Handlers and mocks in test/utils/oidc are moved to a new package:
mockery operates package by package, and requires packages to build
correctly; test/utils/oidc/testserver.go relies on the mocks and fails
to build when they are removed. Moving the interface and mocks to a
different package allows mockery to process that package without
having to build testserver.go.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-06-20 19:42:53 +02:00
Tim Hockin
b725fd20c2
Fix update/verify-mocks.sh
There appears to be a bug in `go generate` for workspaces which will be
fixed in the 1.22.1 release.
2024-02-29 22:06:00 -08:00
Clayton Coleman
1f16d71185
kubelet: Rename PodManager DeletePod to RemovePod
RemovePod is more consistent within the kubelet to be the opposite
of AddPod, and the pod is not being deleted just "removed" from
tracking.
2023-05-12 12:57:27 -04:00
Clayton Coleman
8bd94dfa76
kubelet: Organize and document kubelet pod-related members
Clearly describe core pod related component responsibilities in
the kubelet members. Organize the PodManager interface for clarity.
2023-05-12 12:57:27 -04:00
Clayton Coleman
bb568844b6
kubelet: Separate the MirrorClient from the PodManager
The two are not coupled except accidentally. Separate them and
update callsites. This will reduce the scope of PodManager interface
to make exposing the pod worker cleaner.
2023-05-12 12:57:26 -04:00
Clayton Coleman
80b1aca580
kubelet: Remove dispatchWork and inline calls to UpdatePod
The HandlePod* methods are all structurally similar, but accrued
subtle differences. In general the only point for Handle is to
process admission and to update the pod worker with the desired
state of the kubelet's config (so that pod worker can make it
the actual state).

Add a new GetPodAndMirrorPod() method that handles when the config
pod is ambiguous (pod or mirror pod) and inline the structure.
Add comments on questionable additions in the config methods for
future improvement.

Move the metric observation of container count closer to where
pods are actually started (in the pod worker). A future change
can likely move it to syncPod.
2023-05-12 12:57:26 -04:00
Clayton Coleman
e7207c8546
kubelet: Merge orphaned mirror pod names into GetPodsAndMirrorPods
There is only one caller and both sets of data are part of the
resync operation between kubelet's desired state and the actual
state of the pod workers. Reduces the size of the interface so
that it is easier to create another pod manager.
2023-05-12 12:57:26 -04:00
Clayton Coleman
f8086f2dac
kubelet: Convert IsMirrorOf to a function
Shrinks the PodManager interface by one method, no abstraction is
necessary here.
2023-05-12 12:57:26 -04:00
arrowfeng
6a57404e28 kubelet: cleanup secretManager and configManager in podManager
Signed-off-by: arrowfeng <289716347@qq.com>
2022-11-14 23:05:32 +08:00
Lee Verberne
d238e67ba6 Remove EphemeralContainers feature-gate checks 2022-07-26 02:55:30 +02:00
Jordan Liggitt
085693eff2 Move kubelet secret and configmap manager calls to sync_Pod functions 2022-01-27 10:09:13 -05:00
vikram Jadhav
0de4397490 mockery to mockgen conversion 2021-09-25 16:15:08 +00:00
Lee Verberne
30d2ad576a Remove ManagedPod,ManagedContainer metrics
This replaces the generic ManagedPod and ManagedContainer kubelet
metrics with a gauge to track only ephemeral container usage.
2021-06-15 19:02:07 +02:00
Lee Verberne
29178fff1c Add kubelet managed pod metrics 2021-04-13 14:13:30 +02:00
Kubernetes Prow Robot
93e76f5081
Merge pull request #92442 from tedyu/grace-period-with-map
Respect grace period when removing mirror pod
2020-07-10 17:49:23 -07:00
Ted Yu
a76a959294 Respect grace period when removing mirror pod
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
2020-07-08 13:38:24 -07:00
Amim Knabben
0ed41c3f10 Deprecating --bootstrap-checkpoint-path flag 2020-06-09 15:27:01 -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
yuxiaobo
81e9f21f83 Correct spelling mistakes
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-11-06 20:25:19 +08:00
Ted Yu
0939f90103 Check whether mirror pod is ciritical in managerImpl#evictPod 2019-10-01 11:12:18 -07:00
Himanshu Pandey
c05d506019 changed IsCriticalPod to return true in case of static pods 2019-08-07 15:47:43 -07:00
Robert Krawitz
12713b3ee4 Do not delete an incorrect pod when replacing a mirror pod 2019-06-20 23:02:16 -04:00
wojtekt
6dce4d87a3 Fix secret/configmap management for terminated pods 2019-02-28 18:59:53 +01: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
vikaschoudhary16
cedbd93255 Make 'pod' package to use unified checkpointManager
Signed-off-by: vikaschoudhary16 <choudharyvikas16@gmail.com>
2018-04-16 01:30:20 -04:00
Timothy St. Clair
ed4401c126 Addition of bootstrap checkpointing 2017-11-20 21:54:15 -06:00
Ebbe Elsborg
a286f25ff4 Typed static/mirror pod UID translation 2017-08-14 14:51:26 +02:00
Chao Xu
60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu
f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Shyam Jeedigunta
4425864707 Migrate kubelet configmap management logic to an interface 2017-05-31 10:39:36 +02:00
gmarek
3c0d2bb1f0 Add SecretManager to Kubelet 2017-01-19 20:12:04 +01:00
Wojciech Tyczynski
09e4de385c Enable nontrivial secret manager 2017-01-19 19:47:33 +01:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Dawn Chen
b03fca9783 Fixed an import cycle issue:
import cycle not allowed in test
package k8s.io/kubernetes/pkg/client/restclient (test)
	imports k8s.io/kubernetes/pkg/api/testapi
	imports k8s.io/kubernetes/pkg/apis/componentconfig/install
	imports k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1
	imports k8s.io/kubernetes/pkg/kubelet/qos
	imports k8s.io/kubernetes/pkg/kubelet/pod
	imports k8s.io/kubernetes/pkg/client/clientset_generated/clientset
	imports k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/apps/v1beta1
	imports k8s.io/kubernetes/pkg/client/restclient
2016-12-21 16:34:24 -08:00
bprashanth
afd676d94c Kubelet admits critical pods even under memory pressure 2016-12-15 18:58:09 -08:00
Chao Xu
5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -08:00
Random-Liu
1b1f2766ed Avoid StatusManager.syncPod when there is no corresponding mirror pod for static pod. 2016-09-07 17:03:15 -07:00
Euan Kemp
eeee8b54ea kubelet: delete unused pod manager method 2016-07-08 15:15:54 -07:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Tim St. Clair
f2f3caf744 Rename **/manager.go 2016-06-21 15:11:31 -07:00