mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #82968 from uzuku/fix-golint-failures
Fix golint failures of pkg/kubelet/status/...
This commit is contained in:
commit
7c4ba5909f
@ -132,8 +132,6 @@ pkg/kubelet/pod/testing
|
||||
pkg/kubelet/preemption
|
||||
pkg/kubelet/remote
|
||||
pkg/kubelet/stats
|
||||
pkg/kubelet/status
|
||||
pkg/kubelet/status/testing
|
||||
pkg/kubelet/sysctl
|
||||
pkg/kubelet/types
|
||||
pkg/kubemark
|
||||
|
@ -25,11 +25,16 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// UnknownContainerStatuses says that all container statuses are unknown.
|
||||
UnknownContainerStatuses = "UnknownContainerStatuses"
|
||||
PodCompleted = "PodCompleted"
|
||||
ContainersNotReady = "ContainersNotReady"
|
||||
// PodCompleted says that all related containers have succeeded.
|
||||
PodCompleted = "PodCompleted"
|
||||
// ContainersNotReady says that one or more containers are not ready.
|
||||
ContainersNotReady = "ContainersNotReady"
|
||||
// ContainersNotInitialized says that one or more init containers have not succeeded.
|
||||
ContainersNotInitialized = "ContainersNotInitialized"
|
||||
ReadinessGatesNotReady = "ReadinessGatesNotReady"
|
||||
// ReadinessGatesNotReady says that one or more pod readiness gates are not ready.
|
||||
ReadinessGatesNotReady = "ReadinessGatesNotReady"
|
||||
)
|
||||
|
||||
// GenerateContainersReadyCondition returns the status of "ContainersReady" condition.
|
||||
|
@ -79,7 +79,7 @@ type PodStatusProvider interface {
|
||||
GetPodStatus(uid types.UID) (v1.PodStatus, bool)
|
||||
}
|
||||
|
||||
// An object which provides guarantees that a pod can be safely deleted.
|
||||
// PodDeletionSafetyProvider provides guarantees that a pod can be safely deleted.
|
||||
type PodDeletionSafetyProvider interface {
|
||||
// A function which returns true if the pod can safely be deleted
|
||||
PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bool
|
||||
@ -115,6 +115,7 @@ type Manager interface {
|
||||
|
||||
const syncPeriod = 10 * time.Second
|
||||
|
||||
// NewManager returns a functional Manager.
|
||||
func NewManager(kubeClient clientset.Interface, podManager kubepod.Manager, podDeletionSafety PodDeletionSafetyProvider) Manager {
|
||||
return &manager{
|
||||
kubeClient: kubeClient,
|
||||
|
@ -18,8 +18,11 @@ package testing
|
||||
|
||||
import "k8s.io/api/core/v1"
|
||||
|
||||
// FakePodDeletionSafetyProvider is a fake PodDeletionSafetyProvider for test.
|
||||
type FakePodDeletionSafetyProvider struct{}
|
||||
|
||||
// PodResourcesAreReclaimed implements PodDeletionSafetyProvider.
|
||||
// Always reports that all pod resources are reclaimed.
|
||||
func (f *FakePodDeletionSafetyProvider) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bool {
|
||||
return true
|
||||
}
|
||||
|
@ -23,10 +23,12 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// MockStatusProvider mocks a PodStatusProvider.
|
||||
type MockStatusProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// GetPodStatus implements PodStatusProvider.
|
||||
func (m *MockStatusProvider) GetPodStatus(uid types.UID) (v1.PodStatus, bool) {
|
||||
args := m.Called(uid)
|
||||
return args.Get(0).(v1.PodStatus), args.Bool(1)
|
||||
|
Loading…
Reference in New Issue
Block a user