Skip to content

Fix service discovery bug in kubernetes-extensions (#19139) - #468

Closed
Parth Agrawal (pagrawal10) wants to merge 1 commit into
30.0.1-confluentfrom
pagrawal/backport-19139-k8s-discovery
Closed

Parth Agrawal (pagrawal10) wants to merge 1 commit into
30.0.1-confluentfrom
pagrawal/backport-19139-k8s-discovery

Conversation

@pagrawal10

Copy link
Copy Markdown

Backport of apache#19139.

Use Kubernetes container readiness (in addition to labels/annotations) to decide whether a pod is available for service discovery. Pods whose containers are not ready (e.g. OOM-killed but still carrying announcement labels) are now removed from discovery caches and re-added once ready again.

  • DefaultK8sApiClient: filter not-ready pods on list; remap watch events (MODIFIED->ADDED when ready, MODIFIED->NOT_READY when unready, skip not-ready ADDED events).
  • WatchResult: add MODIFIED and synthetic NOT_READY event types.
  • BaseNodeRoleWatcher: add childRemoved(node, skipIfUnknown) overload to silently ignore removals of nodes not in the cache.
  • K8sDruidNodeDiscoveryProvider: treat NOT_READY like DELETED, using skipIfUnknown=true for all k8s discovery removals.
  • Docs/spelling updates for readiness probe guidance.

Adapted for the 30.0.1 branch: new unit test converted from JUnit 5 to JUnit 4 to match the module, and JUnit annotations adjusted accordingly.

Fixes #XXXX.

Description

Fixed the bug ...

Renamed the class ...

Added a forbidden-apis entry ...

Release note

For tips about how to write a good release note, see Release notes.


Key changed/added classes in this PR
  • MyFoo
  • OurBar
  • TheirBaz

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Backport of apache#19139.

Use Kubernetes container readiness (in addition to labels/annotations) to
decide whether a pod is available for service discovery. Pods whose
containers are not ready (e.g. OOM-killed but still carrying announcement
labels) are now removed from discovery caches and re-added once ready again.

- DefaultK8sApiClient: filter not-ready pods on list; remap watch events
  (MODIFIED->ADDED when ready, MODIFIED->NOT_READY when unready, skip
  not-ready ADDED events).
- WatchResult: add MODIFIED and synthetic NOT_READY event types.
- BaseNodeRoleWatcher: add childRemoved(node, skipIfUnknown) overload to
  silently ignore removals of nodes not in the cache.
- K8sDruidNodeDiscoveryProvider: treat NOT_READY like DELETED, using
  skipIfUnknown=true for all k8s discovery removals.
- Docs/spelling updates for readiness probe guidance.

Adapted for the 30.0.1 branch: new unit test converted from JUnit 5 to
JUnit 4 to match the module, and JUnit annotations adjusted accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant