MCPcopy
hub / github.com/kubewall/kubewall / TransformPodListItem

Function TransformPodListItem

backend/handlers/workloads/pods/transformer.go:82–98  ·  view source on GitHub ↗
(pod coreV1.Pod)

Source from the content-addressed store, hash-verified

80}
81
82func TransformPodListItem(pod coreV1.Pod) PodList {
83 status, _ := GetPodStatusReason(&pod)
84 return PodList{
85 UID: pod.GetUID(),
86 Namespace: pod.GetNamespace(),
87 Name: pod.GetName(),
88 Node: pod.Spec.NodeName,
89 Ready: getPodReadyStatus(pod),
90 Status: status,
91 Restarts: fmt.Sprintf("%d", restartCount(pod)),
92 LastRestartAt: lastRestartTime(pod),
93 Qos: string(pod.Status.QOSClass),
94 PodIP: pod.Status.PodIP,
95 Age: pod.CreationTimestamp.Time,
96 HasUpdated: hasUpdated(pod),
97 }
98}
99
100func lastRestartTime(pod coreV1.Pod) string {
101 for _, containerStatus := range pod.Status.ContainerStatuses {

Callers 1

TransformPodListFunction · 0.85

Calls 7

GetPodStatusReasonFunction · 0.85
getPodReadyStatusFunction · 0.85
restartCountFunction · 0.85
lastRestartTimeFunction · 0.85
hasUpdatedFunction · 0.85
GetNamespaceMethod · 0.80
GetNameMethod · 0.80

Tested by

no test coverage detected