frontend: workload: Fix Pods overview chart to reflect failing pods#6114
frontend: workload: Fix Pods overview chart to reflect failing pods#6114xonas1101 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: xonas1101 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 |
5d4f3d7 to
0c400a6
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes the Workloads overview “Pods” status chart so it can reflect unhealthy pods by introducing pod-specific health categorization, while keeping replica-based workload tiles on the existing binary replica-mismatch behavior.
Changes:
- Added an optional
categorize()path toWorkloadCircleChartto render a multi-segment health ring (healthy/degraded/transitional/failed). - Implemented
getPodHealth()to bucket pods based on phase/readiness/container state and wired it into the Pods tile. - Added the new i18n key
Otherand updated the Overview storyshot snapshot accordingly.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/components/workload/Overview.tsx | Wires categorize() for Pods so the chart uses pod-aware health bucketing. |
| frontend/src/components/workload/Charts.tsx | Adds categorized multi-segment rendering and legend breakdown support. |
| frontend/src/components/pod/List.tsx | Introduces getPodHealth() and health-category typing used by the overview chart. |
| frontend/src/components/workload/snapshots/Overview.Workloads.stories.storyshot | Updates snapshot to reflect the new multi-segment Pods chart output. |
| frontend/src/i18n/locales/en/translation.json | Adds Other translation key used in the new breakdown label. |
| frontend/src/i18n/locales/ar/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/bn/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/de/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/es/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/fr/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/he/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/hi/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/it/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/ja/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/ko/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/pt/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/ru/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/ta/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/ur/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/zh/translation.json | Adds Other key (fallback to English when untranslated). |
| frontend/src/i18n/locales/zh-tw/translation.json | Adds Other key (fallback to English when untranslated). |
The Workloads overview reuses WorkloadCircleChart for Pods, but its default health logic counts an item as failed when getReadyReplicas != getTotalReplicas. Pods have none of those replica fields, so both helpers return 0, the check is always false, and the Pods tile can only ever render 100% Running regardless of Error/CrashLoopBackOff/ ImagePullBackOff/Pending pods. Give the chart an optional per-item categorize() classifier. When provided (Pods only), it renders a multi-segment health ring instead of the binary one: healthy / degraded (running, not ready) / transitional (Pending, Terminating) / failed. Replica-based tiles keep their existing binary behavior unchanged. Add Pod.getHealth() to derive the category from the same signals the Pods list already shows (phase, readiness, container waiting/terminated reason, deletionTimestamp), so the chart and the list can't disagree. Terminating and Pending pods are treated as transitional rather than failures (NodeLost stays unhealthy), avoiding false-alarm red arcs. The helper and the shared WorkloadHealthCategory type live in the k8s model layer so pages don't need to import the heavy pod list module. Ref: kubernetes-sigs/headlamp issue 6090 Signed-off-by: xonas1101 <aarushsingh1305@gmail.com>
0c400a6 to
070c55e
Compare
What this fixes
Fixes #6090.
On the Workloads overview, the Pods status chart always reported
100% / "N Running", even when pods were inError,CrashLoopBackOff,ImagePullBackOff,Pending, etc. — it was structurally incapable of ever showing an unhealthy pod.Root cause
WorkloadCircleChartcomputes the failed count with a replica-mismatch check:getReadyReplicas/getTotalReplicasonly read replica fields (status.readyReplicas,status.numberReady,spec.replicas,status.currentNumberScheduled,status.desiredNumberScheduled). A Pod has none of these, so both helpers return0, the check is always0 !== 0→false, and the Pods tile can only ever render100%. This is correct for replica-based kinds (Deployment/StatefulSet/DaemonSet/ReplicaSet) but wrong for Pods.Approach
categorize()classifier toWorkloadCircleChart. When provided (Pods only), the chart renders a multi-segment health ring instead of the binary one:getPodHealth()derives the category from the same signals the Pods list already shows (phase, readiness, container waiting reason,deletionTimestamp), so the chart and the list can't disagree. Notably, Terminating and Pending pods are transitional, not failures, which avoids a false-alarm red arc.Before / after
On a cluster with 89 pods (50 Running&Ready, 13 not-ready, 19 Pending/Terminating, 7 genuinely failing):
100%89 Running56.2%50 Running·7 Failed · 13 Degraded · 19 OtherTesting
Overviewstoryshot (Pods tile now reflects real health instead of a flat 100%).tscandeslintclean; i18n strings extracted.