refactor: check /health/cluster response body and use ProbeBuilder - #982
Conversation
NiFi's /health/cluster management-server endpoint returns HTTP 200 for both CONNECTING and CONNECTED nodes (only DISCONNECTED etc. get a non-2xx status), so a bare `curl --fail` could not tell a node still joining the cluster from one that has actually joined it. Verified against a live NiFi 2.9.0 node in minikube: /health/cluster returned 200 with body "Cluster Status: CONNECTING" while joining, and 200 with "Cluster Status: CONNECTED" once fully joined. The readiness probe now greps the response body for "Cluster Status: CONNECTED" instead of only checking the return code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaces manual Probe struct literals with ProbeBuilder, which validates that duration fields fit into K8s's i32 seconds fields instead of silently truncating. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech>
sbernauer
left a comment
There was a problem hiding this comment.
LGTM thanks! Only minor comment suggestion
Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech>
|
TL/DR: I had Claude run a field test with the improved readiness probe from this patch and it seems to significantly improve cluster stability in restart-heavy situations. I didn't test this exact code, because it made running the test in parallel much harder, but I did take the changed readiness probe and apply it to a NiFi cluster via PodOverride Both clusters ran a light workload with a generateflowfile processor and a few loadbalancing queues .. I then had Claude stand up a vanilla NiFi three node cluster and a cluster with this override applied and configure both with 5 minute cert lifetimes to ensure near constant restart pressure. I let this run for a bit and had Claude observe the state especially with an eye on overlapping restarts, and this is the report that came out:
|
|
Additionally: this readiness check will actually significantly improve behavior after an unclean shutdown. The old check I believe reported ready before wal replay was done - with this, ready is only reported after an unclean state following a non-graceful shutdown has been cleaned up. |
Description
Definition of Done Checklist
Author
Reviewer
Acceptance
type/deprecationlabel & add to the deprecation scheduletype/experimentallabel & add to the experimental features tracker