mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-27 13:15:36 +00:00
Prioritizing nodes based on volume capacity
This commit is contained in:
@@ -82,6 +82,28 @@ type BindingInfo struct {
|
||||
pv *v1.PersistentVolume
|
||||
}
|
||||
|
||||
// StorageClassName returns the name of the storage class.
|
||||
func (b *BindingInfo) StorageClassName() string {
|
||||
return b.pv.Spec.StorageClassName
|
||||
}
|
||||
|
||||
// VolumeResource represents volume resource.
|
||||
type VolumeResource struct {
|
||||
Requested int64
|
||||
Capacity int64
|
||||
}
|
||||
|
||||
// VolumeResource returns volume resource.
|
||||
func (b *BindingInfo) VolumeResource() *VolumeResource {
|
||||
// both fields are mandatory
|
||||
requestedQty := b.pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||
capacitQty := b.pv.Spec.Capacity[v1.ResourceName(v1.ResourceStorage)]
|
||||
return &VolumeResource{
|
||||
Requested: requestedQty.Value(),
|
||||
Capacity: capacitQty.Value(),
|
||||
}
|
||||
}
|
||||
|
||||
// PodVolumes holds pod's volumes information used in volume scheduling.
|
||||
type PodVolumes struct {
|
||||
// StaticBindings are binding decisions for PVCs which can be bound to
|
||||
|
Reference in New Issue
Block a user