Merge pull request #5934 from vmarmol/update

Update cAdvisor dependency.
This commit is contained in:
Dawn Chen 2015-03-25 13:45:41 -07:00
commit b002b9e2e1
3 changed files with 56 additions and 52 deletions

64
Godeps/Godeps.json generated
View File

@ -212,83 +212,83 @@
}, },
{ {
"ImportPath": "github.com/google/cadvisor/api", "ImportPath": "github.com/google/cadvisor/api",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/container", "ImportPath": "github.com/google/cadvisor/container",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/events", "ImportPath": "github.com/google/cadvisor/events",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/fs", "ImportPath": "github.com/google/cadvisor/fs",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/healthz", "ImportPath": "github.com/google/cadvisor/healthz",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/http", "ImportPath": "github.com/google/cadvisor/http",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/info/v1", "ImportPath": "github.com/google/cadvisor/info/v1",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/info/v2", "ImportPath": "github.com/google/cadvisor/info/v2",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/manager", "ImportPath": "github.com/google/cadvisor/manager",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/metrics", "ImportPath": "github.com/google/cadvisor/metrics",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/pages", "ImportPath": "github.com/google/cadvisor/pages",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/storage", "ImportPath": "github.com/google/cadvisor/storage",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/summary", "ImportPath": "github.com/google/cadvisor/summary",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/utils", "ImportPath": "github.com/google/cadvisor/utils",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/validate", "ImportPath": "github.com/google/cadvisor/validate",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/cadvisor/version", "ImportPath": "github.com/google/cadvisor/version",
"Comment": "0.10.1-92-g41a0c30", "Comment": "0.10.1-103-gbfaf70b",
"Rev": "41a0c30fbf4df4d5d711b752785febb6ed5330a4" "Rev": "bfaf70b2555fcaba212130da04a21302344e38f5"
}, },
{ {
"ImportPath": "github.com/google/gofuzz", "ImportPath": "github.com/google/gofuzz",

View File

@ -73,7 +73,7 @@ const (
// TODO(jnagal): Infer schema through reflection. (See bigquery/client/example) // TODO(jnagal): Infer schema through reflection. (See bigquery/client/example)
func (self *bigqueryStorage) GetSchema() *bigquery.TableSchema { func (self *bigqueryStorage) GetSchema() *bigquery.TableSchema {
fields := make([]*bigquery.TableFieldSchema, 18) fields := make([]*bigquery.TableFieldSchema, 19)
i := 0 i := 0
fields[i] = &bigquery.TableFieldSchema{ fields[i] = &bigquery.TableFieldSchema{
Type: typeTimestamp, Type: typeTimestamp,

View File

@ -18,12 +18,11 @@ import (
"flag" "flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http"
"strings" "strings"
"code.google.com/p/goauth2/oauth"
"code.google.com/p/goauth2/oauth/jwt"
bigquery "code.google.com/p/google-api-go-client/bigquery/v2" bigquery "code.google.com/p/google-api-go-client/bigquery/v2"
"golang.org/x/oauth2"
"golang.org/x/oauth2/jwt"
) )
var ( var (
@ -42,13 +41,13 @@ const (
type Client struct { type Client struct {
service *bigquery.Service service *bigquery.Service
token *oauth.Token token *oauth2.Token
datasetId string datasetId string
tableId string tableId string
} }
// Helper method to create an authenticated connection. // Helper method to create an authenticated connection.
func connect() (*oauth.Token, *bigquery.Service, error) { func connect() (*oauth2.Token, *bigquery.Service, error) {
if *clientId == "" { if *clientId == "" {
return nil, nil, fmt.Errorf("no client id specified") return nil, nil, fmt.Errorf("no client id specified")
} }
@ -67,25 +66,30 @@ func connect() (*oauth.Token, *bigquery.Service, error) {
return nil, nil, fmt.Errorf("could not access credential file %v - %v", pemFile, err) return nil, nil, fmt.Errorf("could not access credential file %v - %v", pemFile, err)
} }
t := jwt.NewToken(*serviceAccount, authScope, pemBytes) jwtConfig := &jwt.Config{
token, err := t.Assert(&http.Client{}) Email: *serviceAccount,
if err != nil { Scopes: []string{authScope},
fmt.Printf("Invalid token: %v\n", err) PrivateKey: pemBytes,
return nil, nil, err
}
config := &oauth.Config{
ClientId: *clientId,
ClientSecret: *clientSecret,
Scope: authScope,
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://accounts.google.com/o/oauth2/token", TokenURL: "https://accounts.google.com/o/oauth2/token",
} }
token, err := jwtConfig.TokenSource(oauth2.NoContext).Token()
transport := &oauth.Transport{ if err != nil {
Token: token, return nil, nil, err
Config: config,
} }
client := transport.Client() if !token.Valid() {
return nil, nil, fmt.Errorf("invalid token for BigQuery oauth")
}
config := &oauth2.Config{
ClientID: *clientId,
ClientSecret: *clientSecret,
Scopes: []string{authScope},
Endpoint: oauth2.Endpoint{
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://accounts.google.com/o/oauth2/token",
},
}
client := config.Client(oauth2.NoContext, token)
service, err := bigquery.New(client) service, err := bigquery.New(client)
if err != nil { if err != nil {
@ -122,7 +126,7 @@ func (c *Client) getService() (*bigquery.Service, error) {
} }
// Refresh expired token. // Refresh expired token.
if c.token.Expired() { if !c.token.Valid() {
token, service, err := connect() token, service, err := connect()
if err != nil { if err != nil {
return nil, err return nil, err