chzhuo opened a new pull request #724:
URL: https://github.com/apache/apisix-ingress-controller/pull/724


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [x] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   
![image](https://user-images.githubusercontent.com/10919124/139024175-ee48548b-a9e0-4ea3-8e43-d4325a6e087f.png)
   I found this error in apisix-ingress-controller log
   
   Controller sync the upstream from APISIX will set the `v1.Upstream.Nodes = 
nil ` when the  APISIX upstream json like `"nodes": {}`  
   
   
   we can repeat this:
   ```golang
   package main
   
   import (
        "encoding/json"
        "fmt"
   
        v1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
   )
   
   func main() {
        data := `{"node":{}}`
        var ups v1.Upstream
   
        err := json.Unmarshal([]byte(data), &ups)
        if err != nil {
                panic(err)
        }
        fmt.Println(ups.Nodes == nil) // output: true
   }
   ```
   Output should be `false`, but is `true`
   


-- 
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