mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Fix for API change in cadvisor
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
3992c8669f
commit
9006b2db69
@ -45,6 +45,7 @@ import (
|
||||
"github.com/google/cadvisor/manager"
|
||||
"github.com/google/cadvisor/utils/sysfs"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
type cadvisorClient struct {
|
||||
@ -99,8 +100,14 @@ func New(imageFsInfoProvider ImageFsInfoProvider, rootPath string, cgroupRoots [
|
||||
includedMetrics[cadvisormetrics.DiskUsageMetrics] = struct{}{}
|
||||
}
|
||||
|
||||
duration := maxHousekeepingInterval
|
||||
housekeepingConfig := manager.HouskeepingConfig{
|
||||
Interval: &duration,
|
||||
AllowDynamic: pointer.BoolPtr(allowDynamicHousekeeping),
|
||||
}
|
||||
|
||||
// Create the cAdvisor container manager.
|
||||
m, err := manager.New(memory.New(statsCacheDuration, nil), sysFs, maxHousekeepingInterval, allowDynamicHousekeeping, includedMetrics, http.DefaultClient, cgroupRoots)
|
||||
m, err := manager.New(memory.New(statsCacheDuration, nil), sysFs, housekeepingConfig, includedMetrics, http.DefaultClient, cgroupRoots, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/kubernetes/pkg/kubelet/metrics/collectors"
|
||||
"k8s.io/utils/clock"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -342,7 +343,7 @@ func (s *Server) InstallDefaultHandlers(enableCAdvisorJSONEndpoints bool) {
|
||||
cadvisormetrics.AppMetrics: struct{}{},
|
||||
cadvisormetrics.ProcessMetrics: struct{}{},
|
||||
}
|
||||
r.RawMustRegister(metrics.NewPrometheusCollector(prometheusHostAdapter{s.host}, containerPrometheusLabelsFunc(s.host), includedMetrics))
|
||||
r.RawMustRegister(metrics.NewPrometheusCollector(prometheusHostAdapter{s.host}, containerPrometheusLabelsFunc(s.host), includedMetrics, clock.RealClock{}))
|
||||
s.restfulCont.Handle(cadvisorMetricsPath,
|
||||
compbasemetrics.HandlerFor(r, compbasemetrics.HandlerOpts{ErrorHandling: compbasemetrics.ContinueOnError}),
|
||||
)
|
||||
|
@ -557,7 +557,7 @@ func generateCustomMetricSpec() []cadvisorapiv1.MetricSpec {
|
||||
case 1:
|
||||
e.Type = cadvisorapiv1.MetricCumulative
|
||||
case 2:
|
||||
e.Type = cadvisorapiv1.MetricDelta
|
||||
e.Type = cadvisorapiv1.MetricType("delta")
|
||||
}
|
||||
switch c.Intn(2) {
|
||||
case 0:
|
||||
|
Loading…
Reference in New Issue
Block a user