-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Which component are you using?:
/area cluster-autoscaler
/area core-autoscaler
/wg device-management
Is your feature request designed to solve a problem? If so describe the problem this feature should solve.:
A new method was added to the scheduler framework's SharedDRAManager as part of KEP-5004 (in kubernetes/kubernetes#134326):
// DeviceClassResolver resolves device class names from extended resource names.
type DeviceClassResolver interface {
// GetDeviceClass returns the device class name for the given extended resource name.
// Returns empty string if no mapping exists for the resource name or
// the DRAExtendedResource feature is disabled.
GetDeviceClass(resourceName v1.ResourceName) string
}
type SharedDRAManager interface {
...
DeviceClassResolver() DeviceClassResolver
}Cluster Autoscaler needs to adapt the DRA Snapshot to implement DeviceClassResolver() and GetDeviceClass() based on the tracked classes.
Describe the solution you'd like.:
Cluster Autoscaler internally tracks DeviceClasses similarly to ResourceClaims and ResourceSlices, so that scheduling simulations within a single CA loop operate on a consistent state of all DRA objects. DeviceClasses are however never modified by CA during the simulations, so we should be able to just compute and cache the resourceName->className mapping when creating the Snapshot in NewSnapshot(). The mapping is based on the DeviceClass.DeviceClassSpec.ExtendedResourceName field of the provided deviceClasses.