Merge pull request #1388 from Garrybest/pr_resource

fix bugs of resource computing
This commit is contained in:
karmada-bot 2022-02-22 17:49:02 +08:00 committed by GitHub
commit 1670f449dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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 {