-
Notifications
You must be signed in to change notification settings - Fork 3.4k
k8s: Avoid panic while checking ip mode #35782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something we could catch with better unit tests.
Good point, unit test is added to cover for this case. |
/test |
fc36767
to
16fd428
Compare
/test |
1 similar comment
/test |
tested in my cluster with the image disgest from the PR and confirmed it working |
/test |
/test |
1 similar comment
/test |
/test |
/test |
Update if condition to avoid panic if ip mode is nil, as OR operator is having higher precedence than AND operator. ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x222dcb0] goroutine 444 [running]: github.com/cilium/cilium/pkg/k8s.ParseService(0x400308f0e0, {0x40030a8480, 0x3, 0x4}) /go/src/github.com/cilium/cilium/pkg/k8s/service.go:232 +0x1320 github.com/cilium/cilium/pkg/k8s.(*ServiceCache).UpdateService(0x4001f10c60, 0x400308f0e0, 0x400133f680) /go/src/github.com/cilium/cilium/pkg/k8s/service_cache.go:337 +0x1e8 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).upsertK8sServiceV1(0x40005f9400, 0x400308f0e0, 0x10?) /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:142 +0x30 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).serviceEventLoop(0x40005f9400, 0x400190be38, 0x400133f680) /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:130 +0x1f4 created by github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).servicesInit in goroutine 1 /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:101 +0x160 ``` Fixes: ab8557c Signed-off-by: Tam Mach <tam.mach@cilium.io>
16fd428
to
3684b8e
Compare
/test |
Update if condition to avoid panic if ip mode is nil, as OR operator is having higher precedence than AND operator.
Reported-by: https://github.com/Truongnht
Fixes: ab8557c