kunwp1 opened a new pull request, #6853: URL: https://github.com/apache/texera/pull/6853
### What changes were proposed in this PR? Refactor the per-user computing-unit listing so its status/metrics logic lives in one reusable place and hits Kubernetes in bulk. No API response changes; this is groundwork for the admin listing endpoint (stacked follow-up PR). - Centralize listing logic in `ComputingUnitHelpers` (`resolveOwnerInfo`, `partitionLiveUnits`, `reconcileVanishedKubernetesUnits`, `buildDashboardUnit`, plus the `isKubernetes` / `podPhasesFor` / `podMetricsFor` guards), and remove the duplicated private status/metrics helpers from `ComputingUnitManagingResource`. - Add bulk `KubernetesClient.getAllPodPhases` / `getAllPodMetrics` (one namespace-wide `list()` / `top()` each) and a shared `containerUsage` helper; `listComputingUnits` now resolves pod status/metrics in bulk instead of probing pod existence twice per unit and re-fetching `top()` per unit. - Per-user reconciliation now runs over cuid-deduplicated units, reducing redundant DB updates. - Add a package-private `KubernetesClient` test seam (`setClientForTesting`) so the fabric8 client can be stubbed in tests; unused in production. ### Any related issues, documentation, discussions? Part of #6476 (Admin Computing Units Dashboard); prepares the shared listing helpers reused by the admin endpoint in the stacked follow-up. Originates from discussion #6322. ### How was this PR tested? Added `ComputingUnitManagingResourceSpec` and extended `ComputingUnitHelpersSpec` / `KubernetesClientSpec` (embedded Postgres via `MockTexeraDB`; stubbed fabric8 client for the bulk k8s paths). Ran `sbt 'ComputingUnitManagingService/testOnly org.apache.texera.service.util.ComputingUnitHelpersSpec org.apache.texera.service.util.KubernetesClientSpec org.apache.texera.service.resource.ComputingUnitManagingResourceSpec'` (34 tests, all green) and `sbt 'ComputingUnitManagingService/scalafmtCheck; ComputingUnitManagingService/Test/scalafmtCheck'` (clean). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code, Claude Opus 4.8 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
