Merge pull request #22803 from derekwaynecarr/update_cadvisor

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-03-11 21:52:21 -08:00
commit afba2f75d1
4 changed files with 51 additions and 43 deletions

72
Godeps/Godeps.json generated
View File

@ -578,93 +578,93 @@
}, },
{ {
"ImportPath": "github.com/google/cadvisor/api", "ImportPath": "github.com/google/cadvisor/api",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/cache/memory", "ImportPath": "github.com/google/cadvisor/cache/memory",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/collector", "ImportPath": "github.com/google/cadvisor/collector",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/container", "ImportPath": "github.com/google/cadvisor/container",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/events", "ImportPath": "github.com/google/cadvisor/events",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/fs", "ImportPath": "github.com/google/cadvisor/fs",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/healthz", "ImportPath": "github.com/google/cadvisor/healthz",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/http", "ImportPath": "github.com/google/cadvisor/http",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/info/v1", "ImportPath": "github.com/google/cadvisor/info/v1",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/info/v2", "ImportPath": "github.com/google/cadvisor/info/v2",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/manager", "ImportPath": "github.com/google/cadvisor/manager",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/metrics", "ImportPath": "github.com/google/cadvisor/metrics",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/pages", "ImportPath": "github.com/google/cadvisor/pages",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/storage", "ImportPath": "github.com/google/cadvisor/storage",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/summary", "ImportPath": "github.com/google/cadvisor/summary",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/utils", "ImportPath": "github.com/google/cadvisor/utils",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/validate", "ImportPath": "github.com/google/cadvisor/validate",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/version", "ImportPath": "github.com/google/cadvisor/version",
"Comment": "v0.22.0", "Comment": "v0.22.1",
"Rev": "e39fb02c89f2b39808bc1723108cde5bb510e102" "Rev": "b344feb952c13e0730fa52eb5e5cf1cf7130ee9c"
}, },
{ {
"ImportPath": "github.com/google/gofuzz", "ImportPath": "github.com/google/gofuzz",

View File

@ -121,11 +121,11 @@ type NetInfo struct {
type CloudProvider string type CloudProvider string
const ( const (
GCE CloudProvider = "GCE" GCE CloudProvider = "GCE"
AWS = "AWS" AWS = "AWS"
Azure = "Azure" Azure = "Azure"
Baremetal = "Baremetal" Baremetal = "Baremetal"
UnkownProvider = "Unknown" UnknownProvider = "Unknown"
) )
type InstanceType string type InstanceType string

View File

@ -15,6 +15,8 @@
package cloudinfo package cloudinfo
import ( import (
"time"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
@ -23,7 +25,13 @@ import (
) )
func onAWS() bool { func onAWS() bool {
client := ec2metadata.New(session.New(&aws.Config{})) // the default client behavior retried the operation multiple times with a 5s timeout per attempt.
// if you were not on aws, you would block for 20s when invoking this operation.
// we reduce retries to 0 and set the timeout to 2s to reduce the time this blocks when not on aws.
client := ec2metadata.New(session.New(&aws.Config{MaxRetries: aws.Int(0)}))
if client.Config.HTTPClient != nil {
client.Config.HTTPClient.Timeout = time.Duration(2 * time.Second)
}
return client.Available() return client.Available()
} }

View File

@ -66,7 +66,7 @@ func detectCloudProvider() info.CloudProvider {
case onBaremetal(): case onBaremetal():
return info.Baremetal return info.Baremetal
} }
return info.UnkownProvider return info.UnknownProvider
} }
func detectInstanceType(cloudProvider info.CloudProvider) info.InstanceType { func detectInstanceType(cloudProvider info.CloudProvider) info.InstanceType {