use build-in max and min func to instead of k8s.io/utils/integer funcs

Kubernetes-commit: eb8f3f194fed16484162aebdaab69168e02f8cb4
This commit is contained in:
weilaaa 2023-12-15 15:09:11 +08:00 committed by Kubernetes Publisher
parent c64d77d39d
commit b84e274c59
2 changed files with 2 additions and 4 deletions

View File

@ -32,7 +32,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/client-go/util/jsonpath"
"k8s.io/utils/integer"
"github.com/fvbommel/sortorder"
)
@ -206,7 +205,7 @@ func isLess(i, j reflect.Value) (bool, error) {
return true, nil
case reflect.Array, reflect.Slice:
// note: the length of i and j may be different
for idx := 0; idx < integer.IntMin(i.Len(), j.Len()); idx++ {
for idx := 0; idx < min(i.Len(), j.Len()); idx++ {
less, err := isLess(i.Index(idx), j.Index(idx))
if err != nil || !less {
return less, err

View File

@ -21,7 +21,6 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/integer"
)
// IsPodAvailable returns true if a pod is available; false otherwise.
@ -194,7 +193,7 @@ func podReadyTime(pod *corev1.Pod) *metav1.Time {
func maxContainerRestarts(pod *corev1.Pod) int {
maxRestarts := 0
for _, c := range pod.Status.ContainerStatuses {
maxRestarts = integer.IntMax(maxRestarts, int(c.RestartCount))
maxRestarts = max(maxRestarts, int(c.RestartCount))
}
return maxRestarts
}