Skip to content

Commit 133d258

Browse files
lauralorenzk8s-publishing-bot
authored andcommitted
Use a better util
Signed-off-by: Laura Lorenz <[email protected]> Kubernetes-commit: 8e7b2af712a79db423b7bfdf2a7bf35f75542c13
1 parent 1811eba commit 133d258

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg/util/podutils/podutils.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ func podReadyTime(pod *corev1.Pod) *metav1.Time {
191191
return &metav1.Time{}
192192
}
193193

194-
// MaxContainerRestarts iterates through all the normal containers and sidecar
195-
// containers in a Pod object and reports the highest restart count observed per
196-
// category.
197-
func MaxContainerRestarts(pod *corev1.Pod) (regularRestarts, sidecarRestarts int) {
194+
func maxContainerRestarts(pod *corev1.Pod) (regularRestarts, sidecarRestarts int) {
198195
for _, c := range pod.Status.ContainerStatuses {
199196
regularRestarts = max(regularRestarts, int(c.RestartCount))
200197
}
@@ -217,8 +214,8 @@ func MaxContainerRestarts(pod *corev1.Pod) (regularRestarts, sidecarRestarts int
217214
// false: pj has a higher container restart count.
218215
// nil: Both have the same container restart count.
219216
func compareMaxContainerRestarts(pi *corev1.Pod, pj *corev1.Pod) *bool {
220-
regularRestartsI, sidecarRestartsI := MaxContainerRestarts(pi)
221-
regularRestartsJ, sidecarRestartsJ := MaxContainerRestarts(pj)
217+
regularRestartsI, sidecarRestartsI := maxContainerRestarts(pi)
218+
regularRestartsJ, sidecarRestartsJ := maxContainerRestarts(pj)
222219
if regularRestartsI != regularRestartsJ {
223220
res := regularRestartsI > regularRestartsJ
224221
return &res

0 commit comments

Comments
 (0)