Skip to content

fix: add null-safety checks for labels and services in K8s RPC ingress parsers - #6896

Open
wy471x wants to merge 2 commits into
apache:masterfrom
wy471x:fix_K8s-RPC-ingress-parsers-error
Open

fix: add null-safety checks for labels and services in K8s RPC ingress parsers#6896
wy471x wants to merge 2 commits into
apache:masterfrom
wy471x:fix_K8s-RPC-ingress-parsers-error

Conversation

@wy471x

@wy471x wy471x commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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.

Summary

Bug Fix (3 files)

DubboIngressParser.java, GrpcParser.java, SofaParser.java — in each parseIngressRule method, added null-safety guards before iterating over labels:

  1. Null/empty labels check — if labels is null or empty, skip the label iteration with continue instead of throwing NullPointerException.
  2. Missing service check — before calling .getMetadata().getAnnotations(), check if serviceLister.namespace(namespace).get(...) returned null (service not yet in cache). Log a
    warning and continue, allowing a later reconcile to pick it up once the service cache is populated.

Unit Tests (3 new files, 9 tests)

  • DubboIngressParserTest.java — 3 tests
  • GrpcParserTest.java — 3 tests
  • SofaParserTest.java — 3 tests

close #6486

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] Kubernetes RPC ingress parsers can throw NPE when labels or services are missing

1 participant