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
a12c6617
Commit
a12c6617
authored
Jan 24, 2017
by
Dr. Stefan Schimanski
Committed by
Dr. Stefan Schimanski
Jan 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg/util: move trace.go to k8s.io/apiserver/pkg/util/trace
parent
a3f8ee65
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
40 deletions
+40
-40
replication_controller.go
pkg/controller/replication/replication_controller.go
+2
-2
rest.go
pkg/genericapiserver/endpoints/handlers/rest.go
+9
-9
cacher.go
pkg/storage/cacher.go
+6
-6
etcd_helper.go
pkg/storage/etcd/etcd_helper.go
+9
-9
store.go
pkg/storage/etcd3/store.go
+6
-6
watch_cache.go
pkg/storage/watch_cache.go
+4
-4
generic_scheduler.go
plugin/pkg/scheduler/generic_scheduler.go
+2
-2
trace.go
staging/src/k8s.io/apiserver/pkg/util/trace/trace.go
+2
-2
No files found.
pkg/controller/replication/replication_controller.go
View file @
a12c6617
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/cache"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
...
@@ -40,7 +41,6 @@ import (
...
@@ -40,7 +41,6 @@ import (
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller/informers"
"k8s.io/kubernetes/pkg/controller/informers"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/metrics"
"k8s.io/kubernetes/pkg/util/metrics"
"k8s.io/kubernetes/pkg/util/workqueue"
"k8s.io/kubernetes/pkg/util/workqueue"
)
)
...
@@ -596,7 +596,7 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*v1.Pod, rc *v1.Repl
...
@@ -596,7 +596,7 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*v1.Pod, rc *v1.Repl
// it did not expect to see any more of its pods created or deleted. This function is not meant to be invoked
// it did not expect to see any more of its pods created or deleted. This function is not meant to be invoked
// concurrently with the same key.
// concurrently with the same key.
func
(
rm
*
ReplicationManager
)
syncReplicationController
(
key
string
)
error
{
func
(
rm
*
ReplicationManager
)
syncReplicationController
(
key
string
)
error
{
trace
:=
util
.
NewTrace
(
"syncReplicationController: "
+
key
)
trace
:=
util
trace
.
New
(
"syncReplicationController: "
+
key
)
defer
trace
.
LogIfLong
(
250
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
250
*
time
.
Millisecond
)
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
...
...
pkg/genericapiserver/endpoints/handlers/rest.go
View file @
a12c6617
...
@@ -27,6 +27,9 @@ import (
...
@@ -27,6 +27,9 @@ import (
"strings"
"strings"
"time"
"time"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
metainternalversion
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
metainternalversion
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
...
@@ -40,12 +43,9 @@ import (
...
@@ -40,12 +43,9 @@ import (
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
"k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
"k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/endpoints/request"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/kubernetes/pkg/genericapiserver/endpoints/handlers/responsewriters"
"k8s.io/kubernetes/pkg/genericapiserver/endpoints/handlers/responsewriters"
"k8s.io/kubernetes/pkg/genericapiserver/registry/rest"
"k8s.io/kubernetes/pkg/genericapiserver/registry/rest"
"k8s.io/kubernetes/pkg/util"
"github.com/emicklei/go-restful"
"github.com/golang/glog"
)
)
// ContextFunc returns a Context given a request - a context must be returned
// ContextFunc returns a Context given a request - a context must be returned
...
@@ -133,7 +133,7 @@ func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) restful.Rou
...
@@ -133,7 +133,7 @@ func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) restful.Rou
return
getResourceHandler
(
scope
,
return
getResourceHandler
(
scope
,
func
(
ctx
request
.
Context
,
name
string
,
req
*
restful
.
Request
)
(
runtime
.
Object
,
error
)
{
func
(
ctx
request
.
Context
,
name
string
,
req
*
restful
.
Request
)
(
runtime
.
Object
,
error
)
{
// For performance tracking purposes.
// For performance tracking purposes.
trace
:=
util
.
NewTrace
(
"Get "
+
req
.
Request
.
URL
.
Path
)
trace
:=
util
trace
.
New
(
"Get "
+
req
.
Request
.
URL
.
Path
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
// check for export
// check for export
...
@@ -245,7 +245,7 @@ func (r *responder) Error(err error) {
...
@@ -245,7 +245,7 @@ func (r *responder) Error(err error) {
func
ListResource
(
r
rest
.
Lister
,
rw
rest
.
Watcher
,
scope
RequestScope
,
forceWatch
bool
,
minRequestTimeout
time
.
Duration
)
restful
.
RouteFunction
{
func
ListResource
(
r
rest
.
Lister
,
rw
rest
.
Watcher
,
scope
RequestScope
,
forceWatch
bool
,
minRequestTimeout
time
.
Duration
)
restful
.
RouteFunction
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
// For performance tracking purposes.
// For performance tracking purposes.
trace
:=
util
.
NewTrace
(
"List "
+
req
.
Request
.
URL
.
Path
)
trace
:=
util
trace
.
New
(
"List "
+
req
.
Request
.
URL
.
Path
)
w
:=
res
.
ResponseWriter
w
:=
res
.
ResponseWriter
...
@@ -352,7 +352,7 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch
...
@@ -352,7 +352,7 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch
func
createHandler
(
r
rest
.
NamedCreater
,
scope
RequestScope
,
typer
runtime
.
ObjectTyper
,
admit
admission
.
Interface
,
includeName
bool
)
restful
.
RouteFunction
{
func
createHandler
(
r
rest
.
NamedCreater
,
scope
RequestScope
,
typer
runtime
.
ObjectTyper
,
admit
admission
.
Interface
,
includeName
bool
)
restful
.
RouteFunction
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
// For performance tracking purposes.
// For performance tracking purposes.
trace
:=
util
.
NewTrace
(
"Create "
+
req
.
Request
.
URL
.
Path
)
trace
:=
util
trace
.
New
(
"Create "
+
req
.
Request
.
URL
.
Path
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
w
:=
res
.
ResponseWriter
w
:=
res
.
ResponseWriter
...
@@ -707,7 +707,7 @@ func patchResource(
...
@@ -707,7 +707,7 @@ func patchResource(
func
UpdateResource
(
r
rest
.
Updater
,
scope
RequestScope
,
typer
runtime
.
ObjectTyper
,
admit
admission
.
Interface
)
restful
.
RouteFunction
{
func
UpdateResource
(
r
rest
.
Updater
,
scope
RequestScope
,
typer
runtime
.
ObjectTyper
,
admit
admission
.
Interface
)
restful
.
RouteFunction
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
// For performance tracking purposes.
// For performance tracking purposes.
trace
:=
util
.
NewTrace
(
"Update "
+
req
.
Request
.
URL
.
Path
)
trace
:=
util
trace
.
New
(
"Update "
+
req
.
Request
.
URL
.
Path
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
w
:=
res
.
ResponseWriter
w
:=
res
.
ResponseWriter
...
@@ -794,7 +794,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
...
@@ -794,7 +794,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
func
DeleteResource
(
r
rest
.
GracefulDeleter
,
allowsOptions
bool
,
scope
RequestScope
,
admit
admission
.
Interface
)
restful
.
RouteFunction
{
func
DeleteResource
(
r
rest
.
GracefulDeleter
,
allowsOptions
bool
,
scope
RequestScope
,
admit
admission
.
Interface
)
restful
.
RouteFunction
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
return
func
(
req
*
restful
.
Request
,
res
*
restful
.
Response
)
{
// For performance tracking purposes.
// For performance tracking purposes.
trace
:=
util
.
NewTrace
(
"Delete "
+
req
.
Request
.
URL
.
Path
)
trace
:=
util
trace
.
New
(
"Delete "
+
req
.
Request
.
URL
.
Path
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
w
:=
res
.
ResponseWriter
w
:=
res
.
ResponseWriter
...
...
pkg/storage/cacher.go
View file @
a12c6617
...
@@ -24,6 +24,9 @@ import (
...
@@ -24,6 +24,9 @@ import (
"sync"
"sync"
"time"
"time"
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -34,11 +37,8 @@ import (
...
@@ -34,11 +37,8 @@ import (
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/cache"
"k8s.io/kubernetes/pkg/util"
"github.com/golang/glog"
"golang.org/x/net/context"
)
)
// CacherConfig contains the configuration for a given Cache.
// CacherConfig contains the configuration for a given Cache.
...
@@ -413,7 +413,7 @@ func (c *Cacher) GetToList(ctx context.Context, key string, resourceVersion stri
...
@@ -413,7 +413,7 @@ func (c *Cacher) GetToList(ctx context.Context, key string, resourceVersion stri
return
err
return
err
}
}
trace
:=
util
.
NewTrace
(
fmt
.
Sprintf
(
"cacher %v: List"
,
c
.
objectType
.
String
()))
trace
:=
util
trace
.
New
(
fmt
.
Sprintf
(
"cacher %v: List"
,
c
.
objectType
.
String
()))
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
c
.
ready
.
wait
()
c
.
ready
.
wait
()
...
@@ -469,7 +469,7 @@ func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, p
...
@@ -469,7 +469,7 @@ func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, p
return
err
return
err
}
}
trace
:=
util
.
NewTrace
(
fmt
.
Sprintf
(
"cacher %v: List"
,
c
.
objectType
.
String
()))
trace
:=
util
trace
.
New
(
fmt
.
Sprintf
(
"cacher %v: List"
,
c
.
objectType
.
String
()))
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
c
.
ready
.
wait
()
c
.
ready
.
wait
()
...
...
pkg/storage/etcd/etcd_helper.go
View file @
a12c6617
...
@@ -23,6 +23,10 @@ import (
...
@@ -23,6 +23,10 @@ import (
"reflect"
"reflect"
"time"
"time"
etcd
"github.com/coreos/etcd/client"
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/conversion"
...
@@ -30,14 +34,10 @@ import (
...
@@ -30,14 +34,10 @@ import (
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apiserver/pkg/storage/etcd/metrics"
"k8s.io/apiserver/pkg/storage/etcd/metrics"
utilcache
"k8s.io/apiserver/pkg/util/cache"
utilcache
"k8s.io/apiserver/pkg/util/cache"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
etcdutil
"k8s.io/kubernetes/pkg/storage/etcd/util"
etcdutil
"k8s.io/kubernetes/pkg/storage/etcd/util"
"k8s.io/kubernetes/pkg/util"
etcd
"github.com/coreos/etcd/client"
"github.com/golang/glog"
"golang.org/x/net/context"
)
)
// Creates a new storage interface from the client
// Creates a new storage interface from the client
...
@@ -92,7 +92,7 @@ func (h *etcdHelper) Versioner() storage.Versioner {
...
@@ -92,7 +92,7 @@ func (h *etcdHelper) Versioner() storage.Versioner {
// Implements storage.Interface.
// Implements storage.Interface.
func
(
h
*
etcdHelper
)
Create
(
ctx
context
.
Context
,
key
string
,
obj
,
out
runtime
.
Object
,
ttl
uint64
)
error
{
func
(
h
*
etcdHelper
)
Create
(
ctx
context
.
Context
,
key
string
,
obj
,
out
runtime
.
Object
,
ttl
uint64
)
error
{
trace
:=
util
.
NewTrace
(
"etcdHelper::Create "
+
getTypeName
(
obj
))
trace
:=
util
trace
.
New
(
"etcdHelper::Create "
+
getTypeName
(
obj
))
defer
trace
.
LogIfLong
(
250
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
250
*
time
.
Millisecond
)
if
ctx
==
nil
{
if
ctx
==
nil
{
glog
.
Errorf
(
"Context is nil"
)
glog
.
Errorf
(
"Context is nil"
)
...
@@ -301,7 +301,7 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, resourceVersion
...
@@ -301,7 +301,7 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, resourceVersion
if
ctx
==
nil
{
if
ctx
==
nil
{
glog
.
Errorf
(
"Context is nil"
)
glog
.
Errorf
(
"Context is nil"
)
}
}
trace
:=
util
.
NewTrace
(
"GetToList "
+
getTypeName
(
listObj
))
trace
:=
util
trace
.
New
(
"GetToList "
+
getTypeName
(
listObj
))
listPtr
,
err
:=
meta
.
GetItemsPtr
(
listObj
)
listPtr
,
err
:=
meta
.
GetItemsPtr
(
listObj
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -338,7 +338,7 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, resourceVersion
...
@@ -338,7 +338,7 @@ func (h *etcdHelper) GetToList(ctx context.Context, key string, resourceVersion
// decodeNodeList walks the tree of each node in the list and decodes into the specified object
// decodeNodeList walks the tree of each node in the list and decodes into the specified object
func
(
h
*
etcdHelper
)
decodeNodeList
(
nodes
[]
*
etcd
.
Node
,
filter
storage
.
FilterFunc
,
slicePtr
interface
{})
error
{
func
(
h
*
etcdHelper
)
decodeNodeList
(
nodes
[]
*
etcd
.
Node
,
filter
storage
.
FilterFunc
,
slicePtr
interface
{})
error
{
trace
:=
util
.
NewTrace
(
"decodeNodeList "
+
getTypeName
(
slicePtr
))
trace
:=
util
trace
.
New
(
"decodeNodeList "
+
getTypeName
(
slicePtr
))
defer
trace
.
LogIfLong
(
400
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
400
*
time
.
Millisecond
)
v
,
err
:=
conversion
.
EnforcePtr
(
slicePtr
)
v
,
err
:=
conversion
.
EnforcePtr
(
slicePtr
)
if
err
!=
nil
||
v
.
Kind
()
!=
reflect
.
Slice
{
if
err
!=
nil
||
v
.
Kind
()
!=
reflect
.
Slice
{
...
@@ -383,7 +383,7 @@ func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion strin
...
@@ -383,7 +383,7 @@ func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion strin
if
ctx
==
nil
{
if
ctx
==
nil
{
glog
.
Errorf
(
"Context is nil"
)
glog
.
Errorf
(
"Context is nil"
)
}
}
trace
:=
util
.
NewTrace
(
"List "
+
getTypeName
(
listObj
))
trace
:=
util
trace
.
New
(
"List "
+
getTypeName
(
listObj
))
defer
trace
.
LogIfLong
(
400
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
400
*
time
.
Millisecond
)
listPtr
,
err
:=
meta
.
GetItemsPtr
(
listObj
)
listPtr
,
err
:=
meta
.
GetItemsPtr
(
listObj
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/storage/etcd3/store.go
View file @
a12c6617
...
@@ -25,18 +25,18 @@ import (
...
@@ -25,18 +25,18 @@ import (
"strings"
"strings"
"time"
"time"
"github.com/coreos/etcd/clientv3"
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage/etcd"
"k8s.io/kubernetes/pkg/storage/etcd"
"k8s.io/kubernetes/pkg/util"
"github.com/coreos/etcd/clientv3"
"github.com/golang/glog"
"golang.org/x/net/context"
)
)
type
store
struct
{
type
store
struct
{
...
@@ -216,7 +216,7 @@ func (s *store) conditionalDelete(ctx context.Context, key string, out runtime.O
...
@@ -216,7 +216,7 @@ func (s *store) conditionalDelete(ctx context.Context, key string, out runtime.O
func
(
s
*
store
)
GuaranteedUpdate
(
func
(
s
*
store
)
GuaranteedUpdate
(
ctx
context
.
Context
,
key
string
,
out
runtime
.
Object
,
ignoreNotFound
bool
,
ctx
context
.
Context
,
key
string
,
out
runtime
.
Object
,
ignoreNotFound
bool
,
precondtions
*
storage
.
Preconditions
,
tryUpdate
storage
.
UpdateFunc
,
suggestion
...
runtime
.
Object
)
error
{
precondtions
*
storage
.
Preconditions
,
tryUpdate
storage
.
UpdateFunc
,
suggestion
...
runtime
.
Object
)
error
{
trace
:=
util
.
NewTrace
(
fmt
.
Sprintf
(
"GuaranteedUpdate etcd3: %s"
,
reflect
.
TypeOf
(
out
)
.
String
()))
trace
:=
util
trace
.
New
(
fmt
.
Sprintf
(
"GuaranteedUpdate etcd3: %s"
,
reflect
.
TypeOf
(
out
)
.
String
()))
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
500
*
time
.
Millisecond
)
v
,
err
:=
conversion
.
EnforcePtr
(
out
)
v
,
err
:=
conversion
.
EnforcePtr
(
out
)
...
...
pkg/storage/watch_cache.go
View file @
a12c6617
...
@@ -29,9 +29,9 @@ import (
...
@@ -29,9 +29,9 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/apimachinery/pkg/watch"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/clock"
"k8s.io/client-go/util/clock"
"k8s.io/kubernetes/pkg/util"
)
)
const
(
const
(
...
@@ -281,7 +281,7 @@ func (w *watchCache) List() []interface{} {
...
@@ -281,7 +281,7 @@ func (w *watchCache) List() []interface{} {
// waitUntilFreshAndBlock waits until cache is at least as fresh as given <resourceVersion>.
// waitUntilFreshAndBlock waits until cache is at least as fresh as given <resourceVersion>.
// NOTE: This function acquired lock and doesn't release it.
// NOTE: This function acquired lock and doesn't release it.
// You HAVE TO explicitly call w.RUnlock() after this function.
// You HAVE TO explicitly call w.RUnlock() after this function.
func
(
w
*
watchCache
)
waitUntilFreshAndBlock
(
resourceVersion
uint64
,
trace
*
util
.
Trace
)
error
{
func
(
w
*
watchCache
)
waitUntilFreshAndBlock
(
resourceVersion
uint64
,
trace
*
util
trace
.
Trace
)
error
{
startTime
:=
w
.
clock
.
Now
()
startTime
:=
w
.
clock
.
Now
()
go
func
()
{
go
func
()
{
// Wake us up when the time limit has expired. The docs
// Wake us up when the time limit has expired. The docs
...
@@ -313,7 +313,7 @@ func (w *watchCache) waitUntilFreshAndBlock(resourceVersion uint64, trace *util.
...
@@ -313,7 +313,7 @@ func (w *watchCache) waitUntilFreshAndBlock(resourceVersion uint64, trace *util.
}
}
// WaitUntilFreshAndList returns list of pointers to <storeElement> objects.
// WaitUntilFreshAndList returns list of pointers to <storeElement> objects.
func
(
w
*
watchCache
)
WaitUntilFreshAndList
(
resourceVersion
uint64
,
trace
*
util
.
Trace
)
([]
interface
{},
uint64
,
error
)
{
func
(
w
*
watchCache
)
WaitUntilFreshAndList
(
resourceVersion
uint64
,
trace
*
util
trace
.
Trace
)
([]
interface
{},
uint64
,
error
)
{
err
:=
w
.
waitUntilFreshAndBlock
(
resourceVersion
,
trace
)
err
:=
w
.
waitUntilFreshAndBlock
(
resourceVersion
,
trace
)
defer
w
.
RUnlock
()
defer
w
.
RUnlock
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -323,7 +323,7 @@ func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64, trace *util.T
...
@@ -323,7 +323,7 @@ func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64, trace *util.T
}
}
// WaitUntilFreshAndGet returns a pointers to <storeElement> object.
// WaitUntilFreshAndGet returns a pointers to <storeElement> object.
func
(
w
*
watchCache
)
WaitUntilFreshAndGet
(
resourceVersion
uint64
,
key
string
,
trace
*
util
.
Trace
)
(
interface
{},
bool
,
uint64
,
error
)
{
func
(
w
*
watchCache
)
WaitUntilFreshAndGet
(
resourceVersion
uint64
,
key
string
,
trace
*
util
trace
.
Trace
)
(
interface
{},
bool
,
uint64
,
error
)
{
err
:=
w
.
waitUntilFreshAndBlock
(
resourceVersion
,
trace
)
err
:=
w
.
waitUntilFreshAndBlock
(
resourceVersion
,
trace
)
defer
w
.
RUnlock
()
defer
w
.
RUnlock
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/pkg/scheduler/generic_scheduler.go
View file @
a12c6617
...
@@ -26,8 +26,8 @@ import (
...
@@ -26,8 +26,8 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/errors"
utiltrace
"k8s.io/apiserver/pkg/util/trace"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/workqueue"
"k8s.io/kubernetes/pkg/util/workqueue"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
...
@@ -87,7 +87,7 @@ type genericScheduler struct {
...
@@ -87,7 +87,7 @@ type genericScheduler struct {
// If it succeeds, it will return the name of the node.
// If it succeeds, it will return the name of the node.
// If it fails, it will return a Fiterror error with reasons.
// If it fails, it will return a Fiterror error with reasons.
func
(
g
*
genericScheduler
)
Schedule
(
pod
*
v1
.
Pod
,
nodeLister
algorithm
.
NodeLister
)
(
string
,
error
)
{
func
(
g
*
genericScheduler
)
Schedule
(
pod
*
v1
.
Pod
,
nodeLister
algorithm
.
NodeLister
)
(
string
,
error
)
{
trace
:=
util
.
NewTrace
(
fmt
.
Sprintf
(
"Scheduling %s/%s"
,
pod
.
Namespace
,
pod
.
Name
))
trace
:=
util
trace
.
New
(
fmt
.
Sprintf
(
"Scheduling %s/%s"
,
pod
.
Namespace
,
pod
.
Name
))
defer
trace
.
LogIfLong
(
100
*
time
.
Millisecond
)
defer
trace
.
LogIfLong
(
100
*
time
.
Millisecond
)
nodes
,
err
:=
nodeLister
.
List
()
nodes
,
err
:=
nodeLister
.
List
()
...
...
pkg/util
/trace.go
→
staging/src/k8s.io/apiserver/pkg/util/trace
/trace.go
View file @
a12c6617
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
util
package
trace
import
(
import
(
"bytes"
"bytes"
...
@@ -35,7 +35,7 @@ type Trace struct {
...
@@ -35,7 +35,7 @@ type Trace struct {
steps
[]
traceStep
steps
[]
traceStep
}
}
func
New
Trace
(
name
string
)
*
Trace
{
func
New
(
name
string
)
*
Trace
{
return
&
Trace
{
name
,
time
.
Now
(),
nil
}
return
&
Trace
{
name
,
time
.
Now
(),
nil
}
}
}
...
...
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