Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use Capacity instead of Allocatable? #22

Open
fighterhit opened this issue Nov 25, 2021 · 1 comment
Open

Why use Capacity instead of Allocatable? #22

fighterhit opened this issue Nov 25, 2021 · 1 comment

Comments

@fighterhit
Copy link

Why use node.Status.Capacity instead of node.Status.Allocatable? Doesn't the number of Allocatable determine whether it is schedulable? In this case, I feel that there will be a problem when node.Status.Allocatable is less than node.Status.Capacity((perhaps due to health check by device plugin),), because at this time gpu-admission thinks that there is still a GPU that can be scheduled, but in fact there is no GPU. Maybe there will be problems when the container is allocated GPU on the node?

func GetCapacityOfNode(node *v1.Node, resourceName string) int {
val, ok := node.Status.Capacity[v1.ResourceName(resourceName)]
if !ok {
return 0
}
return int(val.Value())
}
// GetGPUDeviceCountOfNode returns the number of GPU devices
func GetGPUDeviceCountOfNode(node *v1.Node) int {
val, ok := node.Status.Capacity[VCoreAnnotation]
if !ok {
return 0
}
return int(val.Value()) / HundredCore
}

@cc1416619381
Copy link

I think it uses capacity as total resources, and it will update the used resources with AddUsedResources interface while the correspondings resources are allocated in AllocateOne interface. Thus, we can maintain the infomation about the remaining resources on each node and each device.

If uses node.Status.Allocatable , we can not know about how many resources each device has on each node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants