allenhaozi opened a new issue #814:
URL: https://github.com/apache/apisix-ingress-controller/issues/814


   ### Issue description
   
   The following logic, if I run into an error, causes all nodes after this 
node to be skipped
   
   Is this by design
   
   
https://github.com/apache/apisix-ingress-controller/blob/819b00318e8cd9b6639913301fb89d2acb168926/pkg/apisix/upstream.go#L127
   
   ```go
           var items []*v1.Upstream
        for i, item := range upsItems.Node.Items {
                ups, err := item.upstream()
                if err != nil {
                        log.Errorw("failed to convert upstream item",
                                zap.String("url", u.url),
                                zap.String("upstream_key", item.Key),
                                zap.Error(err),
                        )
                        return nil, err
                }
                items = append(items, ups)
                log.Debugf("list upstream #%d, body: %s", i, string(item.Value))
        }
        return items, nil
   ```
   
   ```
   2021-12-26T10:34:56+08:00    error   apisix/upstream.go:122  failed to 
convert upstream item {"url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams";,
 "upstream_key": "/apisix/upstreams/387087894457615097", "error": "unmarshal 
upstream failure,err:unexpected non-empty 
object,value:{\"timeout\":{\"send\":6,\"connect\":6,\"read\":6},\"type\":\"roundrobin\",\"scheme\":\"http\",\"update_time\":1640251964,\"id\":\"387087894457615097\",\"pass_host\":\"pass\",\"nodes\":{\"10.42.8.234:80\":100},\"name\":\"test_iam-frontend_80\",\"create_time\":1640251964,\"keepalive_pool\":{\"size\":320,\"idle_timeout\":60,\"requests\":1000}}:
 unexpected non-empty object", "errorVerbose": "unexpected non-empty 
object\nunmarshal upstream failure,err:unexpected non-empty 
object,value:{\"timeout\":{\"send\":6,\"connect\":6,\"read\":6},\"type\":\"roundrobin\",\"scheme\":\"http\",\"update_time\":1640251964,\"id\":\"387087894457615097\",\"pass_host\":\"pass\",\"nodes\":{\"10.42.8.234
 
:80\":100},\"name\":\"test_iam-frontend_80\",\"create_time\":1640251964,\"keepalive_pool\":{\"size\":320,\"idle_timeout\":60,\"requests\":1000}}\ngithub.com/apache/apisix-ingress-controller/pkg/apisix.(*item).upstream\n\t/build/pkg/apisix/resource.go:132\ngithub.com/apache/apisix-ingress-controller/pkg/apisix.(*upstreamClient).List\n\t/build/pkg/apisix/upstream.go:120\ngithub.com/apache/apisix-ingress-controller/pkg/apisix.(*cluster).syncCacheOnce\n\t/build/pkg/apisix/cluster.go:211\ngithub.com/apache/apisix-ingress-controller/pkg/apisix.(*cluster).syncCache.func2\n\t/build/pkg/apisix/cluster.go:185\nk8s.io/apimachinery/pkg/util/wait.ConditionFunc.WithContext.func1\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:217\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:230\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection\n\t/go/pkg/mod/k8s.io/[email protected]
 
.4/pkg/util/wait/wait.go:223\nk8s.io/apimachinery/pkg/util/wait.ExponentialBackoff\n\t/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:418\ngithub.com/apache/apisix-ingress-controller/pkg/apisix.(*cluster).syncCache\n\t/build/pkg/apisix/cluster.go:182\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"}
   
   ```
   
   
   
   
   
   
   ### Environment
   
   - current master


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to