Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c7a28d70
Commit
c7a28d70
authored
Sep 20, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14198 from eparis/verify-godep
Auto commit by PR queue bot
parents
6dad530a
6766b732
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
269 additions
and
288 deletions
+269
-288
Godeps.json
Godeps/Godeps.json
+2
-1
metadata.go
...eCloudPlatform/gcloud-golang/compute/metadata/metadata.go
+0
-279
prometheus_metrics
...b.com/google/cadvisor/metrics/testdata/prometheus_metrics
+0
-0
cpuinfo
...github.com/google/cadvisor/utils/machine/testdata/cpuinfo
+251
-0
verify-godeps.sh
hack/verify-godeps.sh
+16
-8
No files found.
Godeps/Godeps.json
View file @
c7a28d70
...
...
@@ -154,7 +154,7 @@
},
{
"ImportPath"
:
"github.com/cpuguy83/go-md2man/md2man"
,
"Comment"
:
"v1.0.
3-2-g71acacd
"
,
"Comment"
:
"v1.0.
4
"
,
"Rev"
:
"71acacd42f85e5e82f70a55327789582a5200a90"
},
{
...
...
@@ -516,6 +516,7 @@
},
{
"ImportPath"
:
"github.com/spf13/pflag"
,
"Comment"
:
"v0.0.1-99-g8e7dc10"
,
"Rev"
:
"8e7dc108ab3a1ab6ce6d922bbaff5657b88e8e49"
},
{
...
...
Godeps/_workspace/src/github.com/GoogleCloudPlatform/gcloud-golang/compute/metadata/metadata.go
deleted
100644 → 0
View file @
6dad530a
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package metadata provides access to Google Compute Engine (GCE)
// metadata and API service accounts.
//
// This package is a wrapper around the GCE metadata service,
// as documented at https://developers.google.com/compute/docs/metadata.
package
metadata
import
(
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"strings"
"sync"
"time"
"google.golang.org/cloud/internal"
)
type
cachedValue
struct
{
k
string
trim
bool
mu
sync
.
Mutex
v
string
}
var
(
projID
=
&
cachedValue
{
k
:
"project/project-id"
,
trim
:
true
}
projNum
=
&
cachedValue
{
k
:
"project/numeric-project-id"
,
trim
:
true
}
instID
=
&
cachedValue
{
k
:
"instance/id"
,
trim
:
true
}
)
var
metaClient
=
&
http
.
Client
{
Transport
:
&
internal
.
Transport
{
Base
:
&
http
.
Transport
{
Dial
:
(
&
net
.
Dialer
{
Timeout
:
750
*
time
.
Millisecond
,
KeepAlive
:
30
*
time
.
Second
,
})
.
Dial
,
ResponseHeaderTimeout
:
750
*
time
.
Millisecond
,
},
},
}
// NotDefinedError is returned when requested metadata is not defined.
//
// The underlying string is the suffix after "/computeMetadata/v1/".
//
// This error is not returned if the value is defined to be the empty
// string.
type
NotDefinedError
string
func
(
suffix
NotDefinedError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"metadata: GCE metadata %q not defined"
,
string
(
suffix
))
}
// Get returns a value from the metadata service.
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
//
// If the GCE_METADATA_HOST environment variable is not defined, a default of
// 169.254.169.254 will be used instead.
//
// If the requested metadata is not defined, the returned error will
// be of type NotDefinedError.
func
Get
(
suffix
string
)
(
string
,
error
)
{
// Using a fixed IP makes it very difficult to spoof the metadata service in
// a container, which is an important use-case for local testing of cloud
// deployments. To enable spoofing of the metadata service, the environment
// variable GCE_METADATA_HOST is first inspected to decide where metadata
// requests shall go.
host
:=
os
.
Getenv
(
"GCE_METADATA_HOST"
)
if
host
==
""
{
// Using 169.254.169.254 instead of "metadata" here because Go
// binaries built with the "netgo" tag and without cgo won't
// know the search suffix for "metadata" is
// ".google.internal", and this IP address is documented as
// being stable anyway.
host
=
"169.254.169.254"
}
url
:=
"http://"
+
host
+
"/computeMetadata/v1/"
+
suffix
req
,
_
:=
http
.
NewRequest
(
"GET"
,
url
,
nil
)
req
.
Header
.
Set
(
"Metadata-Flavor"
,
"Google"
)
res
,
err
:=
metaClient
.
Do
(
req
)
if
err
!=
nil
{
return
""
,
err
}
defer
res
.
Body
.
Close
()
if
res
.
StatusCode
==
http
.
StatusNotFound
{
return
""
,
NotDefinedError
(
suffix
)
}
if
res
.
StatusCode
!=
200
{
return
""
,
fmt
.
Errorf
(
"status code %d trying to fetch %s"
,
res
.
StatusCode
,
url
)
}
all
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
if
err
!=
nil
{
return
""
,
err
}
return
string
(
all
),
nil
}
func
getTrimmed
(
suffix
string
)
(
s
string
,
err
error
)
{
s
,
err
=
Get
(
suffix
)
s
=
strings
.
TrimSpace
(
s
)
return
}
func
(
c
*
cachedValue
)
get
()
(
v
string
,
err
error
)
{
defer
c
.
mu
.
Unlock
()
c
.
mu
.
Lock
()
if
c
.
v
!=
""
{
return
c
.
v
,
nil
}
if
c
.
trim
{
v
,
err
=
getTrimmed
(
c
.
k
)
}
else
{
v
,
err
=
Get
(
c
.
k
)
}
if
err
==
nil
{
c
.
v
=
v
}
return
}
var
onGCE
struct
{
sync
.
Mutex
set
bool
v
bool
}
// OnGCE reports whether this process is running on Google Compute Engine.
func
OnGCE
()
bool
{
defer
onGCE
.
Unlock
()
onGCE
.
Lock
()
if
onGCE
.
set
{
return
onGCE
.
v
}
onGCE
.
set
=
true
// We use the DNS name of the metadata service here instead of the IP address
// because we expect that to fail faster in the not-on-GCE case.
res
,
err
:=
metaClient
.
Get
(
"http://metadata.google.internal"
)
if
err
!=
nil
{
return
false
}
onGCE
.
v
=
res
.
Header
.
Get
(
"Metadata-Flavor"
)
==
"Google"
return
onGCE
.
v
}
// ProjectID returns the current instance's project ID string.
func
ProjectID
()
(
string
,
error
)
{
return
projID
.
get
()
}
// NumericProjectID returns the current instance's numeric project ID.
func
NumericProjectID
()
(
string
,
error
)
{
return
projNum
.
get
()
}
// InternalIP returns the instance's primary internal IP address.
func
InternalIP
()
(
string
,
error
)
{
return
getTrimmed
(
"instance/network-interfaces/0/ip"
)
}
// ExternalIP returns the instance's primary external (public) IP address.
func
ExternalIP
()
(
string
,
error
)
{
return
getTrimmed
(
"instance/network-interfaces/0/access-configs/0/external-ip"
)
}
// Hostname returns the instance's hostname. This will be of the form
// "<instanceID>.c.<projID>.internal".
func
Hostname
()
(
string
,
error
)
{
return
getTrimmed
(
"instance/hostname"
)
}
// InstanceTags returns the list of user-defined instance tags,
// assigned when initially creating a GCE instance.
func
InstanceTags
()
([]
string
,
error
)
{
var
s
[]
string
j
,
err
:=
Get
(
"instance/tags"
)
if
err
!=
nil
{
return
nil
,
err
}
if
err
:=
json
.
NewDecoder
(
strings
.
NewReader
(
j
))
.
Decode
(
&
s
);
err
!=
nil
{
return
nil
,
err
}
return
s
,
nil
}
// InstanceID returns the current VM's numeric instance ID.
func
InstanceID
()
(
string
,
error
)
{
return
instID
.
get
()
}
// InstanceName returns the current VM's instance ID string.
func
InstanceName
()
(
string
,
error
)
{
host
,
err
:=
Hostname
()
if
err
!=
nil
{
return
""
,
err
}
return
strings
.
Split
(
host
,
"."
)[
0
],
nil
}
// Zone returns the current VM's zone, such as "us-central1-b".
func
Zone
()
(
string
,
error
)
{
zone
,
err
:=
getTrimmed
(
"instance/zone"
)
// zone is of the form "projects/<projNum>/zones/<zoneName>".
if
err
!=
nil
{
return
""
,
err
}
return
zone
[
strings
.
LastIndex
(
zone
,
"/"
)
+
1
:
],
nil
}
// InstanceAttributes returns the list of user-defined attributes,
// assigned when initially creating a GCE VM instance. The value of an
// attribute can be obtained with InstanceAttributeValue.
func
InstanceAttributes
()
([]
string
,
error
)
{
return
lines
(
"instance/attributes/"
)
}
// ProjectAttributes returns the list of user-defined attributes
// applying to the project as a whole, not just this VM. The value of
// an attribute can be obtained with ProjectAttributeValue.
func
ProjectAttributes
()
([]
string
,
error
)
{
return
lines
(
"project/attributes/"
)
}
func
lines
(
suffix
string
)
([]
string
,
error
)
{
j
,
err
:=
Get
(
suffix
)
if
err
!=
nil
{
return
nil
,
err
}
s
:=
strings
.
Split
(
strings
.
TrimSpace
(
j
),
"
\n
"
)
for
i
:=
range
s
{
s
[
i
]
=
strings
.
TrimSpace
(
s
[
i
])
}
return
s
,
nil
}
// InstanceAttributeValue returns the value of the provided VM
// instance attribute.
//
// If the requested attribute is not defined, the returned error will
// be of type NotDefinedError.
//
// InstanceAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
func
InstanceAttributeValue
(
attr
string
)
(
string
,
error
)
{
return
Get
(
"instance/attributes/"
+
attr
)
}
// ProjectAttributeValue returns the value of the provided
// project attribute.
//
// If the requested attribute is not defined, the returned error will
// be of type NotDefinedError.
//
// ProjectAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
func
ProjectAttributeValue
(
attr
string
)
(
string
,
error
)
{
return
Get
(
"project/attributes/"
+
attr
)
}
// Scopes returns the service account scopes for the given account.
// The account may be empty or the string "default" to use the instance's
// main account.
func
Scopes
(
serviceAccount
string
)
([]
string
,
error
)
{
if
serviceAccount
==
""
{
serviceAccount
=
"default"
}
return
lines
(
"instance/service-accounts/"
+
serviceAccount
+
"/scopes"
)
}
Godeps/_workspace/src/github.com/google/cadvisor/metrics/testdata/prometheus_metrics
0 → 100644
View file @
c7a28d70
This diff is collapsed.
Click to expand it.
Godeps/_workspace/src/github.com/google/cadvisor/utils/machine/testdata/cpuinfo
0 → 100644
View file @
c7a28d70
processor : 0
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 0
cpu cores : 6
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 1
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 1
cpu cores : 6
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 2
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 2
cpu cores : 6
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 3
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 3
cpu cores : 6
apicid : 16
initial apicid : 16
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 4
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 4
cpu cores : 6
apicid : 18
initial apicid : 18
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 5
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 5
cpu cores : 6
apicid : 20
initial apicid : 20
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 6
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 2661.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 0
cpu cores : 6
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 7
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 2661.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 1
cpu cores : 6
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 8
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 0
siblings : 6
core id : 2
cpu cores : 6
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 9
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 2661.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 3
cpu cores : 6
apicid : 17
initial apicid : 17
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 10
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 4
cpu cores : 6
apicid : 19
initial apicid : 19
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
processor : 11
cpu family : 6
stepping : 2
microcode : 0x10
cpu MHz : 2661.000
cache size : 12288 KB
physical id : 1
siblings : 6
core id : 5
cpu cores : 6
apicid : 21
initial apicid : 21
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
bogomips : 5333.60
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
hack/verify-godeps.sh
View file @
c7a28d70
...
...
@@ -70,7 +70,7 @@ preload-dep "github.com/prometheus" "client_golang" "692492e54b553a81013254cc1fb
echo
"Download finished"
# copy the contents of your kube directory into the nice clean place
_kubetmp
=
"
${
_tmpdir
}
/src/k8s.io
/
"
_kubetmp
=
"
${
_tmpdir
}
/src/k8s.io"
mkdir
-p
"
${
_kubetmp
}
"
#should create ${_kubectmp}/kubernetes
git archive
--format
=
tar
--prefix
=
kubernetes/
$(
git write-tree
)
|
(
cd
"
${
_kubetmp
}
"
&&
tar
xf -
)
...
...
@@ -78,17 +78,25 @@ _kubetmp="${_kubetmp}/kubernetes"
# destroy godeps in our COPY of the kube tree
pushd
"
${
_kubetmp
}
"
>
/dev/null
rm
-rf
./Godeps
rm
-rf
./Godeps
# for some reason the kube tree needs to be a git repo for the godep tool to run. Doesn't make sense
git init
>
/dev/null 2>&1
# for some reason the kube tree needs to be a git repo for the godep tool to run. Doesn't make sense
git init
>
/dev/null 2>&1
# recreate the Godeps using the nice clean set we just downloaded
"
${
GODEP
}
"
save
./...
# recreate the Godeps using the nice clean set we just downloaded
"
${
GODEP
}
"
save
-t
./...
popd
>
/dev/null
# Check for any (meaninful) differences between the godeps in the tree and this nice clean one we just built
if
!
_out
=
"
$(
diff
-NIaupr
--ignore-matching-lines
=
'^\s*\"GoVersion\":'
--ignore-matching-lines
=
'^\s*\"Comment\":'
${
KUBE_ROOT
}
/Godeps/
${
_kubetmp
}
/Godeps/
)
"
;
then
if
!
_out
=
"
$(
diff
-Naupr
--ignore-matching-lines
=
'^\s*\"GoVersion\":'
--ignore-matching-lines
=
'^\s*\"Comment\":'
${
KUBE_ROOT
}
/Godeps/Godeps.json
${
_kubetmp
}
/Godeps/Godeps.json
)
"
;
then
echo
"Your Godeps.json is different:"
echo
"
${
_out
}
"
exit
1
fi
# Godeps/_workstapces/src/github.com/fsouza/go-dockerclient/testing/data/symlink'
# is an intentionally broken symlink. Linux can use --no-dereference. OS X cannot.
# So we --exclude='symlink' so diff -r doesn't die following a bad symlink.
if
!
_out
=
"
$(
diff
-Naupr
--exclude
=
'symlink'
${
KUBE_ROOT
}
/Godeps/_workspace/src
${
_kubetmp
}
/Godeps/_workspace/src
)
"
;
then
echo
"Your godeps changes are not reproducable"
echo
"
${
_out
}
"
exit
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment