api: Add status.summary with aggregated node counts to NodeReadinessRule - #484
vishnukothakapu wants to merge 1 commit into
Conversation
✅ Deploy Preview for node-readiness-controller canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vishnukothakapu The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @vishnukothakapu. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
d059ffe to
7b38a60
Compare
|
Not sure if we really need this with NRE is being proposed to solve these kind of problems. |
@Karthik-K-N, NRE works for checking individual nodes, but we still need this summary field for the Headlamp dashboard. otherwise, the UI would need to fetch thousands of NREs and calculate totals client-side. keeping the totals on the Rule object lets the dashboard load them with a single lightweight API call, which scales much better for large clusters. |
|
First of all before I check the code @vishnukothakapu, wanted to point out that this part is misleading
Your change won't magically fetch what your headlamp component is exactly rather the full CRD as a whole. Secondly @Karthik-K-N, this is different from NRE. It is to provide these values like how many nodes are satisfying a rule, how many are targeted by the rule etc. Metrics also provide the same info through other means, but the problem is Headlamp doesn't natively support using Prometheus metrics. Instead if we plumb those values in rule CRD, we will conveniently solve the Headlamp problem as well as have a chance to improvise the observability aspect for people using kubectl perhaps. |
7b38a60 to
6ad2f14
Compare
|
@vishnukothakapu please run the linter (using |
Signed-off-by: vishnukothakapu <vishnukothakapu27@gmail.com>
6ad2f14 to
e20a95d
Compare
Description
This PR implements the
status.summaryfield proposed in #483 to provide pre-computed node aggregated counts.As pointed out during review, because the Kubernetes API returns the full CRD object, this PR does not reduce the network payload size yet since the legacy arrays remain in the object. However, it accomplishes two critical goals:
status.nodeEvaluations. Once those arrays are eventually removed upstream, UI clients will already be reading fromstatus.summaryand the payload size will drastically drop.Implementation details :
NodeReadinessRuleSummaryto the CRD types (Matched, Held, Released, Failed).NodeEvaluationsarray.ListRuleNodeStateson the controller's local informer cache to generate the counts (identically to how the Prometheus metrics collector works).updateRuleStatus,cleanupDeletedNodes, and the node reconciler.NodeEvaluationsfor generating this summary.Related Issue
Fixes #483
Related to #327
Type of Change
/kind feature
/kind api-change
Testing
go buildandgo test ./internal/controller/...pass locally.patchRuleStatusWithOptimisticLock.TestComputeRuleSummaryusing thecontroller-runtimefake client to directly validate the decoupled summary computation against simulated cluster nodes.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?
Added a status.summary object to the NodeReadinessRule CRD that provides pre-computed, aggregated node evaluation counts (matched, held, released, and failed nodes) for O(1) reads by API clients.
Generative AI Usage Disclosure
How they were used:
Antigravity was used to write the unit tests for helper_unit_test.go. The final code was manually reviewed and tested locally