Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
fix bug: not query all pod interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lichuang committed Sep 6, 2018
1 parent d86b6b4 commit e8fed69
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/rpccontroller/controller/rpcwatcher.go
Expand Up @@ -250,14 +250,15 @@ func (rw *rpcWatcher) queryRPCInterface(key string, rs *v1.RpcService) {

version, exist := pod.Labels[rpcVersion]
if !exist {
log.Errorf("service %s/%s pod has no %s label", service.Namespace, service.Name, rpcVersion)
return
log.Errorf("service %s/%s pod %s/%s has no %s label:%v",
service.Namespace, service.Name, pod.Namespace, pod.Name, rpcVersion, pod.Labels)
continue
}

i, exist := pod.Labels[rpcInterface]
if !exist {
log.Errorf("service %s/%s pod has no %s label", service.Namespace, service.Name, rpcInterface)
return
continue
}

log.Infof("pod %s, interface %s, version %s", pod.Name, i, version)
Expand All @@ -271,7 +272,7 @@ func (rw *rpcWatcher) queryRPCInterface(key string, rs *v1.RpcService) {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Errorf("url %s resp read body error: %v", url, err)
return
continue
}

log.Infof("url: %s, resp: %s", url, string(body))
Expand All @@ -280,12 +281,12 @@ func (rw *rpcWatcher) queryRPCInterface(key string, rs *v1.RpcService) {
err = json.Unmarshal(body, &rpcResponse)
if err != nil {
log.Errorf("json Unmarshal RpcResponse error: %v", err)
return
continue
}

if rpcResponse.Success != true {
log.Errorf("resp not success")
return
continue
}

for _, inter := range rpcResponse.Data.Providers {
Expand Down

0 comments on commit e8fed69

Please sign in to comment.