dovics opened a new issue, #2779:
URL: https://github.com/apache/apisix-ingress-controller/issues/2779
### Current Behavior
Creating an Ingress that has no annotations and uses `pathType:
ImplementationSpecific` can cause the controller to panic during ADC
translation.
The panic happens because `TranslateIngressAnnotations()` returns `nil`
when the Ingress has no annotations, but the Ingress translator dereferences
`config.UseRegex` when handling
`PathTypeImplementationSpecific`.
Affected code path:
```go
config := t.TranslateIngressAnnotations(obj.Annotations)
...
case networkingv1.PathTypeImplementationSpecific:
if config.UseRegex {
...
}
When obj.Annotations is empty, config is nil, so config.UseRegex panics.
### Expected Behavior
The controller should not panic when translating a valid Ingress without
annotations.
For an Ingress with `pathType: ImplementationSpecific` and no
`k8s.apisix.apache.org/use-regex` annotation, the route should be translated as
a normal non-regex path.
### Error Logs
```
2026-06-03T00:22:40.383Z ERROR controller-runtime
runtime/signal_unix.go:925 Observed a panic {"controller":
"ingress", "controllerGroup": "networking.k8s.io", "controllerKind": "Ingress",
"Ingress": {"name":"xx","namespace":"xxxxxx"}, "namespace": "xxxxx", "name":
"xxxxxx", "reconcileID": "0298ca8d-dccb-4bcf-87dc-c680febfc2ac", "panic":
"runtime error: invalid memory address or nil pointer dereference",
"panicGoValue": "\"invalid memory address or nil pointer dereference\"",
"stacktrace": "goroutine 1509
[running]:\nk8s.io/apimachinery/pkg/util/runtime.logPanic({0x257c9b8,
0xc0058b5620}, {0x1eb9300,
0x37dd610})\n\t/home/runner/go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:107
+0xbc\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile.func1()\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:108
+0x112\npanic({0x1eb9300?, 0x37dd610?})\n\t/opt/hostedt
oolcache/go/1.24.11/x64/src/runtime/panic.go:792
+0x132\ngithub.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).buildRouteFromIngressPath(0xc00000e258,
0xc00684c120, 0xc0027434a0, 0xc0017040c0, 0x0, {0xc00399d5d6, 0x3},
0xc001704030)\n\t/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/internal/adc/translator/ingress.go:285
+0x355\ngithub.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).buildServiceFromIngressPath(0xc00000e258,
0xc00684c120, 0xc0027434a0, 0x0, 0xc0017040c0, {0xc00399d5d6, 0x3},
{0xc001a400a0, 0x1, 0x1},
...)\n\t/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/internal/adc/translator/ingress.go:165
+0x33c\ngithub.com/apache/apisix-ingress-controller/internal/adc/translator.(*Translator).TranslateIngress(0xc00000e258,
0xc00684c120,
0xc0027434a0)\n\t/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/internal/adc/translator/ingress.go:107
+0x49a\ngithub.com/a
pache/apisix-ingress-controller/internal/provider/apisix.(*apisixProvider).Update(0xc00077e000,
{0xc0005c0b40?, 0x2584428?}, 0xc00684c120, {0x25a49d0,
0xc00188b760})\n\t/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/internal/provider/apisix/provider.go:131
+0xa65\ngithub.com/apache/apisix-ingress-controller/internal/controller.(*IngressReconciler).Reconcile(0xc00047a2a0,
{0x257c9b8, 0xc0058b5620}, {{{0xc000f86580?, 0x21f309c?}, {0xc000f94680?,
0x100?}}})\n\t/home/runner/work/apisix-ingress-controller/apisix-ingress-controller/internal/controller/ingress_controller.go:206
+0x146e\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile(0xc0058b5590?,
{0x257c9b8?, 0xc0058b5620?}, {{{0xc000f86580?, 0x0?}, {0xc000f94680?,
0x0?}}})\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119
+0xbf\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler(0x2
5a04e0, {0x257c9f0, 0xc0006cc6e0}, {{{0xc000f86580, 0xf}, {0xc000f94680,
0x1f}}},
0x0)\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:334
+0x3ad\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem(0x25a04e0,
{0x257c9f0,
0xc0006cc6e0})\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:294
+0x21b\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2()\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:255
+0x85\ncreated by
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2
in goroutine
505\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:251
+0x6b5\n"}
```
### Steps to Reproduce
1. Install APISIX Ingress Controller.
2. Ensure an APISIX IngressClass exists, for example:
```yaml
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: apisix
spec:
controller: apisix.apache.org/apisix-ingress-controller
3. Create a Service:
apiVersion: v1
kind: Service
metadata:
name: httpbin
namespace: default
spec:
ports:
- name: http
port: 80
targetPort: 80
4. Create an Ingress without annotations and with pathType:
ImplementationSpecific:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: no-panic-implementation-specific
namespace: default
spec:
ingressClassName: apisix
rules:
- host: no-panic.example.com
http:
paths:
- path: /anything
pathType: ImplementationSpecific
backend:
service:
name: httpbin
port:
number: 80
5. Observe the controller while it reconciles the Ingress.
Expected: the Ingress is translated successfully.
Actual: the controller may panic due to dereferencing a nil annotation
config.
### Environment
- APISIX Ingress controller version : v2.0.1
- Kubernetes cluster version: v1.33.4
--
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]