Skip to content

Commit a4c262b

Browse files
authored
Merge pull request kubernetes#127293 from hshiina/typecheck
kubelet/cm: Unite return value types of helper functions
2 parents d67e654 + 107bb17 commit a4c262b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pkg/kubelet/cm/helpers.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121

2222
"k8s.io/api/core/v1"
23+
"k8s.io/apimachinery/pkg/types"
2324
"k8s.io/apimachinery/pkg/util/sets"
2425
internalapi "k8s.io/cri-api/pkg/apis"
2526
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -28,6 +29,16 @@ import (
2829
evictionapi "k8s.io/kubernetes/pkg/kubelet/eviction/api"
2930
)
3031

32+
// for typecheck across platforms
33+
var _ func(int64, int64) int64 = MilliCPUToQuota
34+
var _ func(int64) uint64 = MilliCPUToShares
35+
var _ func(*v1.Pod, bool, uint64, bool) *ResourceConfig = ResourceConfigForPod
36+
var _ func() (*CgroupSubsystems, error) = GetCgroupSubsystems
37+
var _ func(string) ([]int, error) = getCgroupProcs
38+
var _ func(types.UID) string = GetPodCgroupNameSuffix
39+
var _ func(string, bool, string) string = NodeAllocatableRoot
40+
var _ func(string) (string, error) = GetKubeletContainer
41+
3142
// hardEvictionReservation returns a resourcelist that includes reservation of resources based on hard eviction thresholds.
3243
func hardEvictionReservation(thresholds []evictionapi.Threshold, capacity v1.ResourceList) v1.ResourceList {
3344
if len(thresholds) == 0 {

pkg/kubelet/cm/helpers_unsupported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func MilliCPUToQuota(milliCPU, period int64) int64 {
4141
}
4242

4343
// MilliCPUToShares converts the milliCPU to CFS shares.
44-
func MilliCPUToShares(milliCPU int64) int64 {
44+
func MilliCPUToShares(milliCPU int64) uint64 {
4545
return 0
4646
}
4747

0 commit comments

Comments
 (0)