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


   ### Issue description
   
   I upgraded apisixroute from v1alpha1 to v2beta1 before, so I kept 
`spec.http[].backend` in ApisixRoute.
   
   And now, I'm trying to upgrade apisix-ingress-controller from 1.2 to 1.3, 
then I ran into this problem.
   
   After investigation, this is because in the new version of CRD, ApisixRoute 
is stored as the v2beta2 version, but because the previous configuration file 
does not set `spec.http[].backends`, so `spec.http[].backends` is none in 
ApisixRoute v2beta2 version.
   
   ### Environment
   
   - 1.2 1.3
   
   
   ### Minimal test code / Steps to reproduce
   
   1. upgrade from 1.2 to 1.3
   
   ### Actual result
   
   apisix-ingress-controller crashed.
   
   ### Error log
   
   
   ```
   panic: runtime error: index out of range [0] with length 0
   goroutine 300 [running]:
   
github.com/apache/apisix-ingress-controller/pkg/kube/translation.(*translator).translateHTTPRouteV2beta2(0xc000402000,
 0xc000246cb0, 0xc00076e000, 0x1cb68b9, 0x1cb68b9)
        /build/controller/pkg/kube/translation/apisix_route.go:320 +0x2400
   
github.com/apache/apisix-ingress-controller/pkg/kube/translation.(*translator).TranslateRouteV2beta2(0xc000402000,
 0xc00076e000, 0x19, 0x1, 0x1)
        /build/controller/pkg/kube/translation/apisix_route.go:287 +0x7c
   
github.com/apache/apisix-ingress-controller/pkg/ingress.(*apisixRouteController).sync(0xc0007646a0,
 0x1fdabe0, 0xc00003c280, 0xc00046ec00, 0x8, 0xc000948780)
        /build/controller/pkg/ingress/apisix_route.go:178 +0x2227
   
github.com/apache/apisix-ingress-controller/pkg/ingress.(*apisixRouteController).runWorker(0xc0007646a0,
 0x1fdabe0, 0xc00003c280)
        /build/controller/pkg/ingress/apisix_route.go:79 +0x57
   created by 
github.com/apache/apisix-ingress-controller/pkg/ingress.(*apisixRouteController).run
        /build/controller/pkg/ingress/apisix_route.go:68 +0x245
   ```
   
   ### Expected result
   
   Avoid panic


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