From b49cba7182aed91244f647bc828239e3c19e2bbb Mon Sep 17 00:00:00 2001 From: Marcin Wielgus Date: Tue, 26 Jan 2016 16:45:46 +0100 Subject: [PATCH] Update Heapster API in Godeps --- Godeps/Godeps.json | 4 +-- .../heapster/api/v1/types/model_types.go | 30 +++++++++++++++++++ .../podautoscaler/horizontal_test.go | 2 +- .../metrics/metrics_client_test.go | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 58ac1e16357..8354a108a8a 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -985,8 +985,8 @@ }, { "ImportPath": "k8s.io/heapster/api/v1/types", - "Comment": "v0.17.0-75-g0e1b652", - "Rev": "0e1b652781812dee2c51c75180fc590223e0b9c6" + "Comment": "v0.19.1", + "Rev": "0991ac528ea24aae194e45d6dcf01896cb42cbea" }, { "ImportPath": "speter.net/go/exp/math/dec/inf", diff --git a/Godeps/_workspace/src/k8s.io/heapster/api/v1/types/model_types.go b/Godeps/_workspace/src/k8s.io/heapster/api/v1/types/model_types.go index ed3d418e598..7eea8f21998 100644 --- a/Godeps/_workspace/src/k8s.io/heapster/api/v1/types/model_types.go +++ b/Godeps/_workspace/src/k8s.io/heapster/api/v1/types/model_types.go @@ -21,6 +21,10 @@ import ( type MetricPoint struct { Timestamp time.Time `json:"timestamp"` Value uint64 `json:"value"` + // This will be populated only for float custom metrics. In that case + // "value" will be zero. This is a temporary hack. Overall most likely + // we will need a new api versioned in the similar way as K8S api. + FloatValue *float64 `json:"floatValue,omitempty"` } type MetricResult struct { @@ -31,3 +35,29 @@ type MetricResult struct { type MetricResultList struct { Items []MetricResult `json:"items"` } + +type Stats struct { + Average uint64 `json:"average"` + NinetyFifth uint64 `json:"percentile"` + Max uint64 `json:"max"` +} + +type ExternalStatBundle struct { + Minute Stats `json:"minute"` + Hour Stats `json:"hour"` + Day Stats `json:"day"` +} + +type StatsResponse struct { + // Uptime is in seconds + Uptime uint64 `json:"uptime"` + Stats map[string]ExternalStatBundle `json:"stats"` +} + +// An ExternalEntityListEntry represents the latest CPU and Memory usage of a model entity. +// A model entity can be a Pod, a Container, a Namespace or a Node. +type ExternalEntityListEntry struct { + Name string `json:"name"` + CPUUsage uint64 `json:"cpuUsage"` + MemUsage uint64 `json:"memUsage"` +} diff --git a/pkg/controller/podautoscaler/horizontal_test.go b/pkg/controller/podautoscaler/horizontal_test.go index e754ee74364..bd0bd63b691 100644 --- a/pkg/controller/podautoscaler/horizontal_test.go +++ b/pkg/controller/podautoscaler/horizontal_test.go @@ -158,7 +158,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake { metrics := heapster.MetricResultList{} for _, level := range tc.reportedLevels { metric := heapster.MetricResult{ - Metrics: []heapster.MetricPoint{{timestamp, level}}, + Metrics: []heapster.MetricPoint{{timestamp, level, nil}}, LatestTimestamp: timestamp, } metrics.Items = append(metrics.Items, metric) diff --git a/pkg/controller/podautoscaler/metrics/metrics_client_test.go b/pkg/controller/podautoscaler/metrics/metrics_client_test.go index fcb14c74205..a472b198f25 100644 --- a/pkg/controller/podautoscaler/metrics/metrics_client_test.go +++ b/pkg/controller/podautoscaler/metrics/metrics_client_test.go @@ -119,7 +119,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *testclient.Fake { if latestTimestamp.Before(timestamp) { latestTimestamp = timestamp } - heapsterMetricPoint := heapster.MetricPoint{timestamp, reportedMetricPoint.level} + heapsterMetricPoint := heapster.MetricPoint{timestamp, reportedMetricPoint.level, nil} heapsterMetricPoints = append(heapsterMetricPoints, heapsterMetricPoint) } metric := heapster.MetricResult{