mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-01 06:30:09 +08:00
Merge pull request #73217 from kubernetes/revert-73071-reflector_trace
Revert "Adding trace to reflector initialization" Kubernetes-commit: a5d55f49b0f480b5bfe9fc40c9a07d9c04c117fd
This commit is contained in:
parent
96c09e7697
commit
955fe458eb
502
Godeps/Godeps.json
generated
502
Godeps/Godeps.json
generated
File diff suppressed because it is too large
Load Diff
2
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
2
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
@ -381,7 +381,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
|
|||||||
var info version.Info
|
var info version.Info
|
||||||
err = json.Unmarshal(body, &info)
|
err = json.Unmarshal(body, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("got '%s': %v", string(body), err)
|
return nil, fmt.Errorf("unable to parse the server version: %v", err)
|
||||||
}
|
}
|
||||||
return &info, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
|
23
vendor/k8s.io/client-go/tools/cache/reflector.go
generated
vendored
23
vendor/k8s.io/client-go/tools/cache/reflector.go
generated
vendored
@ -175,10 +175,31 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
|
|||||||
options := metav1.ListOptions{ResourceVersion: "0"}
|
options := metav1.ListOptions{ResourceVersion: "0"}
|
||||||
r.metrics.numberOfLists.Inc()
|
r.metrics.numberOfLists.Inc()
|
||||||
start := r.clock.Now()
|
start := r.clock.Now()
|
||||||
list, err := r.listerWatcher.List(options)
|
|
||||||
|
var list runtime.Object
|
||||||
|
var err error
|
||||||
|
listCh := make(chan struct{}, 1)
|
||||||
|
panicCh := make(chan interface{}, 1)
|
||||||
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
panicCh <- r
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
list, err = r.listerWatcher.List(options)
|
||||||
|
close(listCh)
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case <-stopCh:
|
||||||
|
return nil
|
||||||
|
case r := <-panicCh:
|
||||||
|
panic(r)
|
||||||
|
case <-listCh:
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s: Failed to list %v: %v", r.name, r.expectedType, err)
|
return fmt.Errorf("%s: Failed to list %v: %v", r.name, r.expectedType, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
r.metrics.listDuration.Observe(time.Since(start).Seconds())
|
r.metrics.listDuration.Observe(time.Since(start).Seconds())
|
||||||
listMetaInterface, err := meta.ListAccessor(list)
|
listMetaInterface, err := meta.ListAccessor(list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user