Add getting Storage Quantity to ResourceList

This commit is contained in:
yaqi 2019-11-29 10:55:57 +08:00
parent cf16e4988f
commit d146e1941d
2 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,14 @@ func (rl *ResourceList) Memory() *resource.Quantity {
return &resource.Quantity{Format: resource.BinarySI}
}
// Storage returns the Storage limit if specified.
func (rl *ResourceList) Storage() *resource.Quantity {
if val, ok := (*rl)[ResourceStorage]; ok {
return &val
}
return &resource.Quantity{Format: resource.BinarySI}
}
// Pods returns the list of pods
func (rl *ResourceList) Pods() *resource.Quantity {
if val, ok := (*rl)[ResourcePods]; ok {

View File

@ -41,6 +41,14 @@ func (self *ResourceList) Memory() *resource.Quantity {
return &resource.Quantity{Format: resource.BinarySI}
}
// Returns the Storage limit if specified.
func (self *ResourceList) Storage() *resource.Quantity {
if val, ok := (*self)[ResourceStorage]; ok {
return &val
}
return &resource.Quantity{Format: resource.BinarySI}
}
func (self *ResourceList) Pods() *resource.Quantity {
if val, ok := (*self)[ResourcePods]; ok {
return &val