synchronization

This commit is contained in:
2025-08-25 16:04:00 +08:00
commit 33f9b3ce46
1951 changed files with 854396 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package utils
import "k8s.io/api/core/v1"
// Is the Node for GPU sharing
func IsGPUSharingNode(node *v1.Node) bool {
return GetTotalGPUMemory(node) > 0
}
// Get the total GPU memory of the Node
func GetTotalGPUMemory(node *v1.Node) int {
val, ok := node.Status.Capacity[ResourceName]
if !ok {
return 0
}
return int(val.Value())
}
// Get the GPU count of the node
func GetGPUCountInNode(node *v1.Node) int {
val, ok := node.Status.Capacity[CountName]
if !ok {
return int(0)
}
return int(val.Value())
}