Skip to content

fix: avoid NPE in IngressReconciler.getZookeeperUrl when zookeeper service has no endpoints (#6865) - #6965

Open
juicewcode wants to merge 2 commits into
apache:masterfrom
juicewcode:fix/6865-ingress-zookeeper-endpoints-npe
Open

fix: avoid NPE in IngressReconciler.getZookeeperUrl when zookeeper service has no endpoints (#6865)#6965
juicewcode wants to merge 2 commits into
apache:masterfrom
juicewcode:fix/6865-ingress-zookeeper-endpoints-npe

Conversation

@juicewcode

Copy link
Copy Markdown
Contributor

Fixes #6865

Summary

  • For a Dubbo/Sofa ingress that uses a zookeeper service name as the register address,
    IngressReconciler.getZookeeperUrl fetched V1Endpoints from the lister. When the service has no Endpoints yet,
    v1Endpoints is null and v1Endpoints.getSubsets() threw an NPE during reconcile, blocking route configuration. This PR
    adds a null check on v1Endpoints: when no Endpoints are found it logs a clear message and falls through to the
    existing ShenyuException fallback (the same path as empty subsets), so no NPE is thrown.

  • Added IngressReconcilerZookeeperUrlTest with two cases — testReconcileWithoutZookeeperEndpoints verifies
    the graceful ShenyuException fallback instead of an NPE (regression); testReconcileWithZookeeperEndpoints verifies
    the 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:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] IngressReconciler.getZookeeperUrl NPE when zookeeper service has no Endpoints

1 participant