Skip to content

Commit

Permalink
adds reason label for unschedulable pod
Browse files Browse the repository at this point in the history
  • Loading branch information
ilaylow committed Dec 10, 2024
1 parent 5e332b3 commit 55f1712
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/store/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,8 @@ func createPodStatusUnschedulableFamilyGenerator() generator.FamilyGenerator {
for _, c := range p.Status.Conditions {
if c.Type == v1.PodScheduled && c.Status == v1.ConditionFalse {
ms = append(ms, &metric.Metric{
LabelKeys: []string{},
LabelValues: []string{},
LabelKeys: []string{"reason"},
LabelValues: []string{c.Message},
Value: 1,
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/store/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ func TestPodStore(t *testing.T) {
Want: `
# HELP kube_pod_status_unschedulable [STABLE] Describes the unschedulable status for the pod.
# TYPE kube_pod_status_unschedulable gauge
kube_pod_status_unschedulable{namespace="ns2",pod="pod2",uid="uid2"} 1
kube_pod_status_unschedulable{namespace="ns2",pod="pod2",uid="uid2",reason="0/3 nodes are available: 3 Insufficient cpu."} 1
`,
MetricNames: []string{"kube_pod_status_unschedulable"},
},
Expand Down

0 comments on commit 55f1712

Please sign in to comment.