Merge pull request #73217 from kubernetes/revert-73071-reflector_trace

Revert "Adding trace to reflector initialization"

Kubernetes-commit: a5d55f49b0f480b5bfe9fc40c9a07d9c04c117fd
This commit is contained in:
Kubernetes Publisher 2019-01-23 12:20:27 -08:00
parent 96c09e7697
commit 955fe458eb
3 changed files with 274 additions and 253 deletions

502
Godeps/Godeps.json generated

File diff suppressed because it is too large Load Diff

View File

@ -381,7 +381,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
var info version.Info
err = json.Unmarshal(body, &info)
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
}

View File

@ -175,10 +175,31 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
options := metav1.ListOptions{ResourceVersion: "0"}
r.metrics.numberOfLists.Inc()
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 {
return fmt.Errorf("%s: Failed to list %v: %v", r.name, r.expectedType, err)
}
r.metrics.listDuration.Observe(time.Since(start).Seconds())
listMetaInterface, err := meta.ListAccessor(list)
if err != nil {