nic-6443 opened a new pull request #829:
URL: https://github.com/apache/apisix-ingress-controller/pull/829


   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   - [x] Bugfix
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   The object returned by the kubernetes listserver interface should be 
immutable, and this rule is explicitly stated in the listserver interface. 
   ```
   // IngressNamespaceLister helps list and get Ingresses.
   // All objects returned here must be treated as read-only.
   type IngressNamespaceLister interface {
   }
   ```
   If  change the object, it will cause some strange behavior, for example: the 
`oldObject` you get in the `control.onUpdate` callback is incorrect.
   
   ```
   2021-12-31T13:33:58+08:00    debug   ingress/ingress.go:267  ingress add 
event arrived       {"object": "&Ingress{ObjectMeta:{ingress-v1-lb  
ingress-apisix-e2e-tests-default-513114146  
394be781-cba8-4b3e-8249-87f7a96c4997 15867 1 2021-12-31 13:33:58 +0800 HKT 
<nil> <nil> map[] 
map[kubectl.kubernetes.io/last-applied-configuration:{\"apiVersion\":\"networking.k8s.io/v1\",\"kind\":\"Ingress\",\"metadata\":{\"annotations\":{\"kubernetes.io/ingress.class\":\"apisix\"},\"name\":\"ingress-v1-lb\",\"namespace\":\"ingress-apisix-e2e-tests-default-513114146\"},\"spec\":{\"rules\":[{\"host\":\"httpbin.org\",\"http\":{\"paths\":[{\"backend\":{\"service\":{\"name\":\"httpbin-service-e2e-test\",\"port\":{\"number\":80}}},\"path\":\"/ip\",\"pathType\":\"Exact\"}]}}]}}\n
 kubernetes.io/ingress.class:apisix] [] []  [{kubectl-client-side-apply Update 
networking.k8s.io/v1 2021-12-31 13:33:58 +0800 HKT FieldsV1 
{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubectl.kubernetes.io/last-applied-configuration\":{},
 \"f:kubernetes.io/ingress.class\":{}}},\"f:spec\":{\"f:rules\":{}}} 
}]},Spec:IngressSpec{DefaultBackend:nil,TLS:[]IngressTLS{},Rules:[]IngressRule{IngressRule{Host:httpbin.org,IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/ip,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:httpbin-service-e2e-test,Port:ServiceBackendPort{Name:,Number:80,},},},PathType:*Exact,},},},},},},IngressClassName:nil,},Status:IngressStatus{LoadBalancer:{[]},},}"}
   2021-12-31T13:33:59+08:00    debug   ingress/ingress.go:302  ingress update 
event arrived    {"new object": "&Ingress{ObjectMeta:{ingress-v1-lb  
ingress-apisix-e2e-tests-default-513114146  
394be781-cba8-4b3e-8249-87f7a96c4997 15868 1 2021-12-31 13:33:58 +0800 HKT 
<nil> <nil> map[] 
map[kubectl.kubernetes.io/last-applied-configuration:{\"apiVersion\":\"networking.k8s.io/v1\",\"kind\":\"Ingress\",\"metadata\":{\"annotations\":{\"kubernetes.io/ingress.class\":\"apisix\"},\"name\":\"ingress-v1-lb\",\"namespace\":\"ingress-apisix-e2e-tests-default-513114146\"},\"spec\":{\"rules\":[{\"host\":\"httpbin.org\",\"http\":{\"paths\":[{\"backend\":{\"service\":{\"name\":\"httpbin-service-e2e-test\",\"port\":{\"number\":80}}},\"path\":\"/ip\",\"pathType\":\"Exact\"}]}}]}}\n
 kubernetes.io/ingress.class:apisix] [] []  [{kubectl-client-side-apply Update 
networking.k8s.io/v1 2021-12-31 13:33:58 +0800 HKT FieldsV1 
{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubectl.kubernetes.io/last-applied-configuratio
 n\":{},\"f:kubernetes.io/ingress.class\":{}}},\"f:spec\":{\"f:rules\":{}}} } 
{apisix-ingress-controller Update networking.k8s.io/v1 2021-12-31 13:33:59 
+0800 HKT FieldsV1 {\"f:status\":{\"f:loadBalancer\":{\"f:ingress\":{}}}} 
}]},Spec:IngressSpec{DefaultBackend:nil,TLS:[]IngressTLS{},Rules:[]IngressRule{IngressRule{Host:httpbin.org,IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/ip,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:httpbin-service-e2e-test,Port:ServiceBackendPort{Name:,Number:80,},},},PathType:*Exact,},},},},},},IngressClassName:nil,},Status:IngressStatus{LoadBalancer:{[{10.6.6.6
  []}]},},}", "old object": "&Ingress{ObjectMeta:{ingress-v1-lb  
ingress-apisix-e2e-tests-default-513114146  
394be781-cba8-4b3e-8249-87f7a96c4997 15867 1 2021-12-31 13:33:58 +0800 HKT 
<nil> <nil> map[] 
map[kubectl.kubernetes.io/last-applied-configuration:{\"apiVersion\":\"networking.k8s.io/v1\",\"kind\":\"Ingress
 
\",\"metadata\":{\"annotations\":{\"kubernetes.io/ingress.class\":\"apisix\"},\"name\":\"ingress-v1-lb\",\"namespace\":\"ingress-apisix-e2e-tests-default-513114146\"},\"spec\":{\"rules\":[{\"host\":\"httpbin.org\",\"http\":{\"paths\":[{\"backend\":{\"service\":{\"name\":\"httpbin-service-e2e-test\",\"port\":{\"number\":80}}},\"path\":\"/ip\",\"pathType\":\"Exact\"}]}}]}}\n
 kubernetes.io/ingress.class:apisix] [] []  [{kubectl-client-side-apply Update 
networking.k8s.io/v1 2021-12-31 13:33:58 +0800 HKT FieldsV1 
{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubectl.kubernetes.io/last-applied-configuration\":{},\"f:kubernetes.io/ingress.class\":{}}},\"f:spec\":{\"f:rules\":{}}}
 
}]},Spec:IngressSpec{DefaultBackend:nil,TLS:[]IngressTLS{},Rules:[]IngressRule{IngressRule{Host:httpbin.org,IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/ip,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:httpbin-service-e2e-te
 
st,Port:ServiceBackendPort{Name:,Number:80,},},},PathType:*Exact,},},},},},},IngressClassName:nil,},Status:IngressStatus{LoadBalancer:{[{10.6.6.6
  []}]},},}"}
   ```


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