mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Merge pull request #130790 from natasha41575/drop_fake_status_manager
remove kubelet fake status manager
This commit is contained in:
commit
a4739df381
@ -56,7 +56,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/metrics"
|
||||
"k8s.io/kubernetes/pkg/kubelet/prober/results"
|
||||
"k8s.io/kubernetes/pkg/kubelet/secret"
|
||||
"k8s.io/kubernetes/pkg/kubelet/status"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
netutils "k8s.io/utils/net"
|
||||
"k8s.io/utils/ptr"
|
||||
@ -3925,7 +3924,6 @@ func Test_generateAPIPodStatusForInPlaceVPAEnabled(t *testing.T) {
|
||||
kl := testKubelet.kubelet
|
||||
|
||||
oldStatus := test.pod.Status
|
||||
kl.statusManager = status.NewFakeManager()
|
||||
kl.statusManager.SetPodStatus(test.pod, oldStatus)
|
||||
actual := kl.generateAPIPodStatus(test.pod, &testKubecontainerPodStatus /* criStatus */, false /* test.isPodTerminal */)
|
||||
|
||||
@ -4727,7 +4725,6 @@ func TestConvertToAPIContainerStatusesForResources(t *testing.T) {
|
||||
testKubelet := newTestKubelet(t, false)
|
||||
defer testKubelet.Cleanup()
|
||||
kubelet := testKubelet.kubelet
|
||||
kubelet.statusManager = status.NewFakeManager()
|
||||
|
||||
idx := 0
|
||||
for tdesc, tc := range map[string]struct {
|
||||
@ -5181,7 +5178,6 @@ func TestConvertToAPIContainerStatusesForUser(t *testing.T) {
|
||||
testKubelet := newTestKubelet(t, false)
|
||||
defer testKubelet.Cleanup()
|
||||
kubelet := testKubelet.kubelet
|
||||
kubelet.statusManager = status.NewFakeManager()
|
||||
|
||||
for tdesc, tc := range map[string]struct {
|
||||
testPodStatus *kubecontainer.PodStatus
|
||||
|
@ -2403,7 +2403,6 @@ func TestPodResourceAllocationReset(t *testing.T) {
|
||||
testKubelet := newTestKubelet(t, false)
|
||||
defer testKubelet.Cleanup()
|
||||
kubelet := testKubelet.kubelet
|
||||
kubelet.statusManager = status.NewFakeManager()
|
||||
|
||||
// fakePodWorkers trigger syncPodFn synchronously on update, but entering
|
||||
// kubelet.SyncPod while holding the podResizeMutex can lead to deadlock.
|
||||
@ -2837,8 +2836,6 @@ func TestHandlePodResourcesResize(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
for _, isSidecarContainer := range []bool{false, true} {
|
||||
t.Run(fmt.Sprintf("%s/sidecar=%t", tt.name, isSidecarContainer), func(t *testing.T) {
|
||||
kubelet.statusManager = status.NewFakeManager()
|
||||
|
||||
var originalPod *v1.Pod
|
||||
var originalCtr *v1.Container
|
||||
if isSidecarContainer {
|
||||
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package status
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
)
|
||||
|
||||
type fakeManager struct {
|
||||
podResizeStatuses map[types.UID]v1.PodResizeStatus
|
||||
}
|
||||
|
||||
func (m *fakeManager) Start() {
|
||||
klog.InfoS("Start()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) GetPodStatus(uid types.UID) (v1.PodStatus, bool) {
|
||||
klog.InfoS("GetPodStatus()")
|
||||
return v1.PodStatus{}, false
|
||||
}
|
||||
|
||||
func (m *fakeManager) SetPodStatus(pod *v1.Pod, status v1.PodStatus) {
|
||||
klog.InfoS("SetPodStatus()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) SetContainerReadiness(podUID types.UID, containerID kubecontainer.ContainerID, ready bool) {
|
||||
klog.InfoS("SetContainerReadiness()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) SetContainerStartup(podUID types.UID, containerID kubecontainer.ContainerID, started bool) {
|
||||
klog.InfoS("SetContainerStartup()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) TerminatePod(pod *v1.Pod) {
|
||||
klog.InfoS("TerminatePod()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) RemoveOrphanedStatuses(podUIDs map[types.UID]bool) {
|
||||
klog.InfoS("RemoveOrphanedStatuses()")
|
||||
return
|
||||
}
|
||||
|
||||
func (m *fakeManager) GetPodResizeStatus(podUID types.UID) v1.PodResizeStatus {
|
||||
return m.podResizeStatuses[podUID]
|
||||
}
|
||||
|
||||
func (m *fakeManager) SetPodResizeStatus(podUID types.UID, resizeStatus v1.PodResizeStatus) {
|
||||
m.podResizeStatuses[podUID] = resizeStatus
|
||||
}
|
||||
|
||||
// NewFakeManager creates empty/fake memory manager
|
||||
func NewFakeManager() Manager {
|
||||
return &fakeManager{
|
||||
podResizeStatuses: make(map[types.UID]v1.PodResizeStatus),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user