From fda73c04ecdc2194050bb222b2330aeb9c5006e6 Mon Sep 17 00:00:00 2001 From: Yu-Ju Hong Date: Mon, 7 Dec 2015 13:24:31 -0800 Subject: [PATCH] Change to include UID by default in formatting --- pkg/kubelet/util/format/pod.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/kubelet/util/format/pod.go b/pkg/kubelet/util/format/pod.go index a37d6e6acec..506f2a78519 100644 --- a/pkg/kubelet/util/format/pod.go +++ b/pkg/kubelet/util/format/pod.go @@ -25,26 +25,18 @@ import ( type podHandler func(*api.Pod) string -// Pod returns a string representating a pod in a human readable -// format. This function currently is the same as GetPodFullName in -// kubelet/containers, but may differ in the future. As opposed to -// GetPodFullName, this function is mainly used for logging. +// Pod returns a string reprenetating a pod in a human readable format, +// with pod UID as part of the string. func Pod(pod *api.Pod) string { // Use underscore as the delimiter because it is not allowed in pod name // (DNS subdomain format), while allowed in the container name format. - return fmt.Sprintf("%s_%s", pod.Name, pod.Namespace) -} - -// PodWithUID returns a string reprenetating a pod in a human readable format, -// with pod UID as part of the string. -func PodWithUID(pod *api.Pod) string { - return fmt.Sprintf("%s(%s)", Pod(pod), pod.UID) + return fmt.Sprintf("%s_%s(%s)", pod.Name, pod.Namespace, pod.UID) } // Pods returns a string representating a list of pods in a human // readable format. func Pods(pods []*api.Pod) string { - return aggregatePods(pods, PodWithUID) + return aggregatePods(pods, Pod) } func aggregatePods(pods []*api.Pod, handler podHandler) string {