Make kubectl describe node include allocated resource

This commit is contained in:
Janet Kuo
2015-07-29 19:19:17 -07:00
parent 531d3def98
commit 0ac6dba3f4
3 changed files with 140 additions and 0 deletions

View File

@@ -301,6 +301,14 @@ func (q *Quantity) String() string {
return number + string(suffix)
}
func (q *Quantity) Add(y Quantity) error {
if q.Format != y.Format {
return fmt.Errorf("format mismatch: %v vs. %v", q.Format, y.Format)
}
q.Amount.Add(q.Amount, y.Amount)
return nil
}
// MarshalJSON implements the json.Marshaller interface.
func (q Quantity) MarshalJSON() ([]byte, error) {
return []byte(`"` + q.String() + `"`), nil