Merge pull request #1388 from Garrybest/pr_resource
fix bugs of resource computing
This commit is contained in:
commit
1670f449dd
|
@ -105,7 +105,7 @@ func (r *Resource) Sub(rl corev1.ResourceList) error {
|
||||||
if resourcehelper.IsScalarResourceName(rName) {
|
if resourcehelper.IsScalarResourceName(rName) {
|
||||||
rScalar, ok := r.ScalarResources[rName]
|
rScalar, ok := r.ScalarResources[rName]
|
||||||
scalar := rQuant.Value()
|
scalar := rQuant.Value()
|
||||||
if !ok {
|
if !ok && scalar > 0 {
|
||||||
return fmt.Errorf("scalar resources %s does not exist, got %d", rName, scalar)
|
return fmt.Errorf("scalar resources %s does not exist, got %d", rName, scalar)
|
||||||
}
|
}
|
||||||
if rScalar < scalar {
|
if rScalar < scalar {
|
||||||
|
|
Loading…
Reference in New Issue