mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Update resource quota for requests
This commit is contained in:
@@ -309,6 +309,14 @@ func (q *Quantity) Add(y Quantity) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (q *Quantity) Sub(y Quantity) error {
|
||||
if q.Format != y.Format {
|
||||
return fmt.Errorf("format mismatch: %v vs. %v", q.Format, y.Format)
|
||||
}
|
||||
q.Amount.Sub(q.Amount, y.Amount)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface.
|
||||
func (q Quantity) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"` + q.String() + `"`), nil
|
||||
|
||||
Reference in New Issue
Block a user