apisix-ingress-controller
apisix-ingress-controller copied to clipboard
request help: upstreamNode json解析异常
Issue description
问题1:
-
admin api根据id获取upstream json数据如下:
-
apisix-ingress-controller定义的数据结构如下:
-
注释红框中的判断,否则解析报错
3.1 不注释代码的情况下,报错:
2022-08-04 22:04:55.984 error unexpected non-empty object
3.2 注释代码的情况下,upstreamNode解析为空:
&{Metadata:{ID:419230261889204925 Name:test Desc: Labels:map[]} Type:roundrobin HashOn: Key: Checks:<nil> Nodes:[] Scheme:http Retries:<nil> Timeout:0xc0000d80d8 TLS:<nil>}
- 下面的json数据结构不注释代码的情况下也可以正常解析
Environment
- your apisix-ingress-controller version (output of apisix-ingress-controller version --long): 1.5.0
- your Kubernetes cluster version (output of kubectl version): 1.18
- if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (uname -a): centos7.4
Thank you very much. I am trying to reproduce this problem. This problem does exist.
Can you tell me the version of your apisix-dashboard?
xref: #712
Can you tell me the version of your apisix-dashboard?
apisix-dashboard 我用的最新的master分支,我看manager-api的源码有做数据结构转换 https://github.com/apache/apisix-dashboard/blob/master/api/internal/core/entity/format.go
@bzp2010 Could you help confirm this if you have time?
apisix-ingress-controller调用的是admin-api,会有上面提到的数据解析问题;manager-api虽然有对upstreamNodes做数据结构转换,响应的json数据controller可以正常的解析,但是controller只支持api-key的验证,而manager-api是jwt的验证
I'll fix it #1222 .