Closed FesonX closed 2 years ago
I create an Ingress reference a service httpbin NOT exists in current namespace.
After a create the resource and delete, the APISIX Ingress Controller service panic and restart.
apache/apisix-ingress-controller:1.4.0
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.3-aliyun.1", GitCommit:"2d7fa03ee32075acb101bc7286176439c3edddf1", GitTreeState:"clean", BuildDate:"2022-01-18T14:15:16Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
kubectl -n demo run httpbin --image-pull-policy=IfNotPresent --image kennethreitz/httpbin --port 80 kubectl -n demo expose pod httpbin --port 80
The ingress service like this, which doesn't have a namespace in metadata, save it as ingress-example.yaml
ingress-example.yaml
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: httpserver-ingress spec: # apisix-ingress-controller is only interested in Ingress # resources with the matched ingressClass name, in our case, # it's apisix. ingressClassName: apisix rules: - host: local.httpbin.org http: paths: - backend: service: name: httpbin port: number: 80 path: / pathType: Prefix
kubectl create -f ingress-example.yaml kubectl delete -f ingress-example.yaml
the APISIX Ingress Controller service panic and restart.
2022-03-01T16:43:53+08:00 [31merror[0m translation/ingress.go:86 failed to translate ingress backend to upstream {"error": "endpoints: endpoints \"httpbin\" not found", "ingress": "&Ingress{ObjectMeta:{httpserver-ingress apisix 30a87b4b-5238-4ed3-9522-6a053979277b 24129335 1 2022-03-01 16:43:46 +0800 HKT <nil> <nil> map[] map[] [] [] [{kubectl-create Update [networking.k8s.io/v1](http://networking.k8s.io/v1) 2022-03-01 16:43:46 +0800 HKT FieldsV1 {\"f:spec\":{\"f:ingressClassName\":{},\"f:rules\":{}}} }]},Spec:IngressSpec{DefaultBackend:nil,TLS:[]IngressTLS{},Rules:[]IngressRule{IngressRule{Host:[local.httpbin.org](http://local.httpbin.org/),IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:httpbin,Port:ServiceBackendPort{Name:,Number:80,},},},PathType:*Prefix,},},},},},},IngressClassName:*apisix,},Status:IngressStatus{LoadBalancer:{[]},},}"} 2022-03-01T16:43:53+08:00 [31merror[0m ingress/ingress.go:131 failed to translate ingress {"error": "endpoints: endpoints \"httpbin\" not found", "ingress": {}} 2022-03-01T16:43:53+08:00 [33mwarn[0m ingress/ingress.go:231 sync ingress failed, will retry {"object": {"Type":3,"Object":{"Key":"apisix/httpserver-ingress","GroupVersion":"networking/v1","OldObject":null},"Tombstone":{}}, "error": "[ingress.networking.k8s.io](http://ingress.networking.k8s.io/) \"httpserver-ingress\" not found"} panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x18cb92c] goroutine 271 [running]: [github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).handleSyncErr](http://github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).handleSyncErr)(0xc000689e60, 0x198c020, 0xc000aca150, 0x1f9e100, 0xc000a88a00) /build/controller/pkg/ingress/ingress.go:237 +0x7ac [github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).runWorker](http://github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).runWorker)(0xc000689e60, 0x1fd9bf0, 0xc00052e040) /build/controller/pkg/ingress/ingress.go:81 +0xcc created by [github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).run](http://github.com/apache/apisix-ingress-controller/pkg/ingress.(*ingressController).run) /build/controller/pkg/ingress/ingress.go:68 +0x230
A more CLEAER error message describe the absent service.
Thanks for your report.
It's has been fixed. #872
Duplicate #855
I will close this one. Feel free to reopen it, if you have any question
Issue description
I create an Ingress reference a service httpbin NOT exists in current namespace.
After a create the resource and delete, the APISIX Ingress Controller service panic and restart.
Environment
Minimal test code / Steps to reproduce
The ingress service like this, which doesn't have a namespace in metadata, save it as
ingress-example.yaml
Actual result
the APISIX Ingress Controller service panic and restart.
Error log
Expected result
A more CLEAER error message describe the absent service.