mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Kubelet: node allocatable resources: negative quantities should not be allowed
When setting kube/system-resources for a node, negative quantities can result in node's allocatable being higher then node's capacity. Let's check the quantity and return error if it is negative.
This commit is contained in:
parent
050980b472
commit
663fbce3a0
@ -902,6 +902,9 @@ func parseResourceList(m utilconfig.ConfigurationMap) (api.ResourceList, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if q.Amount.Sign() == -1 {
|
||||
return nil, fmt.Errorf("resource quantity for %q cannot be negative: %v", k, v)
|
||||
}
|
||||
rl[api.ResourceName(k)] = *q
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot reserve %q resource", k)
|
||||
|
Loading…
Reference in New Issue
Block a user