Perf optimization: Move away from GetPodQOS, using PodStatus.QOSClass instead
Kubernetes-commit: 5d4410b9601f27942fa1d1a4e65c2aa3a65637b1
This commit is contained in:
parent
507fbad069
commit
35d73b6cda
|
@ -871,11 +871,7 @@ func describePod(pod *corev1.Pod, events *corev1.EventList) (string, error) {
|
|||
}
|
||||
}
|
||||
describeVolumes(pod.Spec.Volumes, w, "")
|
||||
if pod.Status.QOSClass != "" {
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", pod.Status.QOSClass)
|
||||
} else {
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", qos.GetPodQOS(pod))
|
||||
}
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", qos.PodQOSClass(pod))
|
||||
printLabelsMultiline(w, "Node-Selectors", pod.Spec.NodeSelector)
|
||||
printPodTolerationsMultiline(w, "Tolerations", pod.Spec.Tolerations)
|
||||
describeTopologySpreadConstraints(pod.Spec.TopologySpreadConstraints, w, "")
|
||||
|
|
|
@ -28,6 +28,15 @@ func isSupportedQoSComputeResource(name core.ResourceName) bool {
|
|||
return supportedQoSComputeResources.Has(string(name))
|
||||
}
|
||||
|
||||
// PodQOSClass returns the QoS class of a pod persisted in the PodStatus.
|
||||
// If QOSClass is empty, it returns value of GetPodQOS() which computes pod's QoS class.
|
||||
func PodQOSClass(pod *core.Pod) core.PodQOSClass {
|
||||
if pod.Status.QOSClass != "" {
|
||||
return pod.Status.QOSClass
|
||||
}
|
||||
return GetPodQOS(pod)
|
||||
}
|
||||
|
||||
// GetPodQOS returns the QoS class of a pod.
|
||||
// A pod is besteffort if none of its containers have specified any requests or limits.
|
||||
// A pod is guaranteed only when requests and limits are specified for all the containers and they are equal.
|
||||
|
|
Loading…
Reference in New Issue