Merge pull request #82968 from uzuku/fix-golint-failures

Fix golint failures of pkg/kubelet/status/...
This commit is contained in:
Kubernetes Prow Robot 2019-10-07 07:47:08 -07:00 committed by GitHub
commit 7c4ba5909f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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.

View File

@ -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,

View File

@ -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
}

View File

@ -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)