fix: avoid NPE in IngressReconciler.getZookeeperUrl when zookeeper service has no endpoints (#6865) - #6965
Open
juicewcode wants to merge 2 commits into
Open
Conversation
…rvice has no endpoints (apache#6865)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6865
Summary
For a Dubbo/Sofa ingress that uses a zookeeper service name as the register address,
IngressReconciler.getZookeeperUrlfetchedV1Endpointsfrom the lister. When the service has no Endpoints yet,v1Endpointsis null andv1Endpoints.getSubsets()threw an NPE during reconcile, blocking route configuration. This PRadds a null check on
v1Endpoints: when no Endpoints are found it logs a clear message and falls through to theexisting
ShenyuExceptionfallback (the same path as empty subsets), so no NPE is thrown.Added
IngressReconcilerZookeeperUrlTestwith two cases —testReconcileWithoutZookeeperEndpointsverifiesthe graceful
ShenyuExceptionfallback instead of an NPE (regression);testReconcileWithZookeeperEndpointsverifiesthe service name is still resolved to the Pod IP (
zookeeper://127.0.0.1:2181) and written into the dubbo plugin config(normal path).
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.