mirror of
https://github.com/kubernetes/kubectl.git
synced 2026-06-09 08:51:18 -04:00
Code review fix: Move GetPodQOS code to ComputePodQOS. If set, return PodStatus.QOSClass from GetPodQOS.
Kubernetes-commit: 4063ca40501ce589b4de1ffa5cc814cd9e03e0ac
This commit is contained in:
parent
35d73b6cda
commit
cacd4f8556
2 changed files with 7 additions and 7 deletions
|
|
@ -871,7 +871,7 @@ func describePod(pod *corev1.Pod, events *corev1.EventList) (string, error) {
|
|||
}
|
||||
}
|
||||
describeVolumes(pod.Spec.Volumes, w, "")
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", qos.PodQOSClass(pod))
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", qos.GetPodQOS(pod))
|
||||
printLabelsMultiline(w, "Node-Selectors", pod.Spec.NodeSelector)
|
||||
printPodTolerationsMultiline(w, "Tolerations", pod.Spec.Tolerations)
|
||||
describeTopologySpreadConstraints(pod.Spec.TopologySpreadConstraints, w, "")
|
||||
|
|
|
|||
|
|
@ -28,20 +28,20 @@ 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 {
|
||||
// GetPodQOS returns the QoS class of a pod persisted in the PodStatus.QOSClass field.
|
||||
// If PodStatus.QOSClass is empty, it returns value of ComputePodQOS() which evaluates pod's QoS class.
|
||||
func GetPodQOS(pod *core.Pod) core.PodQOSClass {
|
||||
if pod.Status.QOSClass != "" {
|
||||
return pod.Status.QOSClass
|
||||
}
|
||||
return GetPodQOS(pod)
|
||||
return ComputePodQOS(pod)
|
||||
}
|
||||
|
||||
// GetPodQOS returns the QoS class of a pod.
|
||||
// ComputePodQOS evaluates the list of containers to determine a pod's QoS class. This function is expensive.
|
||||
// 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.
|
||||
// A pod is burstable if limits and requests do not match across all containers.
|
||||
func GetPodQOS(pod *core.Pod) core.PodQOSClass {
|
||||
func ComputePodQOS(pod *core.Pod) core.PodQOSClass {
|
||||
requests := core.ResourceList{}
|
||||
limits := core.ResourceList{}
|
||||
zeroQuantity := resource.MustParse("0")
|
||||
|
|
|
|||
Loading…
Reference in a new issue