You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently only report QOS for pods which have a QosClass in their status (Pod.status.qosClass). If this is missing, we're reporting <none>.
A Qos can still be reported by looking at the containers and compute the findings though. kubectl does this with the following code:
// ComputePodQOS evaluates the list of containers to determine a pod's QoS class. This function is more// expensive than GetPodQOS which should be used for pods having a non-empty .Status.QOSClass.// 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.funcComputePodQOS(pod*core.Pod) core.PodQOSClass {
requests:= core.ResourceList{}
limits:= core.ResourceList{}
zeroQuantity:=resource.MustParse("0")
isGuaranteed:=true// note, ephemeral containers are not considered for QoS as they cannot define resourcesallContainers:= []core.Container{}
allContainers=append(allContainers, pod.Spec.Containers...)
allContainers=append(allContainers, pod.Spec.InitContainers...)
for_, container:=rangeallContainers {
// process requestsforname, quantity:=rangecontainer.Resources.Requests {
if!isSupportedQoSComputeResource(name) {
continue
}
ifquantity.Cmp(zeroQuantity) ==1 {
delta:=quantity.DeepCopy()
if_, exists:=requests[name]; !exists {
requests[name] =delta
} else {
delta.Add(requests[name])
requests[name] =delta
}
}
}
// process limitsqosLimitsFound:=sets.NewString()
forname, quantity:=rangecontainer.Resources.Limits {
if!isSupportedQoSComputeResource(name) {
continue
}
ifquantity.Cmp(zeroQuantity) ==1 {
qosLimitsFound.Insert(string(name))
delta:=quantity.DeepCopy()
if_, exists:=limits[name]; !exists {
limits[name] =delta
} else {
delta.Add(limits[name])
limits[name] =delta
}
}
}
if!qosLimitsFound.HasAll(string(core.ResourceMemory), string(core.ResourceCPU)) {
isGuaranteed=false
}
}
iflen(requests) ==0&&len(limits) ==0 {
returncore.PodQOSBestEffort
}
// Check is requests match limits for all resources.ifisGuaranteed {
forname, req:=rangerequests {
iflim, exists:=limits[name]; !exists||lim.Cmp(req) !=0 {
isGuaranteed=falsebreak
}
}
}
ifisGuaranteed&&len(requests) ==len(limits) {
returncore.PodQOSGuaranteed
}
returncore.PodQOSBurstable
}
The text was updated successfully, but these errors were encountered:
related to #553
We currently only report QOS for pods which have a
QosClass
in their status (Pod.status.qosClass
). If this is missing, we're reporting<none>
.A Qos can still be reported by looking at the containers and compute the findings though.
kubectl
does this with the following code:https://github.com/kubernetes/kubectl/blob/b315eb8455a7d5c11ed788d1592b4afeca85771d/pkg/util/qos/qos.go#L45
The text was updated successfully, but these errors were encountered: