Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add UnexpectedAdmissionError to kube_pod_status_reason metric #1145

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pod-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
| kube_pod_init_container_resource_requests | Gauge | `resource`=&lt;resource-name&gt; <br> `unit`=&lt;resource-unit&gt; <br> `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | STABLE |
| kube_pod_spec_volumes_persistentvolumeclaims_info | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `volume`=&lt;volume-name&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-claimname&gt; | STABLE |
| kube_pod_spec_volumes_persistentvolumeclaims_readonly | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `volume`=&lt;volume-name&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-claimname&gt; | STABLE |
| kube_pod_status_reason | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;NodeLost\|Evicted&gt; | EXPERIMENTAL |
| kube_pod_status_reason | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;NodeLost\|Evicted\|UnexpectedAdmissionError&gt; | EXPERIMENTAL |
| kube_pod_status_scheduled_time | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_status_unschedulable | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |

Expand Down
2 changes: 1 addition & 1 deletion internal/store/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
descPodLabelsDefaultLabels = []string{"namespace", "pod"}
containerWaitingReasons = []string{"ContainerCreating", "CrashLoopBackOff", "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", "CreateContainerError", "InvalidImageName"}
containerTerminatedReasons = []string{"OOMKilled", "Completed", "Error", "ContainerCannotRun", "DeadlineExceeded", "Evicted"}
podStatusReasons = []string{"NodeLost", "Evicted"}
podStatusReasons = []string{"NodeLost", "Evicted", "UnexpectedAdmissionError"}

podMetricFamilies = []generator.FamilyGenerator{
{
Expand Down
24 changes: 24 additions & 0 deletions internal/store/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ kube_pod_container_status_last_terminated_reason{container="container7",namespac
kube_pod_status_phase{namespace="ns4",phase="Unknown",pod="pod4"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="Evicted"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="NodeLost"} 1
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="UnexpectedAdmissionError"} 0
`,
MetricNames: []string{"kube_pod_status_phase", "kube_pod_status_reason"},
},
Expand All @@ -1112,6 +1113,28 @@ kube_pod_container_status_last_terminated_reason{container="container7",namespac
# TYPE kube_pod_status_reason gauge
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="Evicted"} 1
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="NodeLost"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="UnexpectedAdmissionError"} 0
`,
MetricNames: []string{"kube_pod_status_reason"},
},
{
Obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod4",
Namespace: "ns4",
DeletionTimestamp: &metav1.Time{},
},
Status: v1.PodStatus{
Phase: v1.PodRunning,
Reason: "UnexpectedAdmissionError",
},
},
Want: `
# HELP kube_pod_status_reason The pod status reasons
# TYPE kube_pod_status_reason gauge
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="Evicted"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="NodeLost"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="UnexpectedAdmissionError"} 1
`,
MetricNames: []string{"kube_pod_status_reason"},
},
Expand All @@ -1132,6 +1155,7 @@ kube_pod_container_status_last_terminated_reason{container="container7",namespac
# TYPE kube_pod_status_reason gauge
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="Evicted"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="NodeLost"} 0
kube_pod_status_reason{namespace="ns4",pod="pod4",reason="UnexpectedAdmissionError"} 0
`,
MetricNames: []string{"kube_pod_status_reason"},
},
Expand Down
1 change: 1 addition & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ kube_pod_status_phase{namespace="default",pod="pod0",phase="Unknown"} 0
# TYPE kube_pod_status_reason gauge
kube_pod_status_reason{namespace="default",pod="pod0",reason="Evicted"} 0
kube_pod_status_reason{namespace="default",pod="pod0",reason="NodeLost"} 0
kube_pod_status_reason{namespace="default",pod="pod0",reason="UnexpectedAdmissionError"} 0
# HELP kube_pod_status_scheduled Describes the status of the scheduling process for the pod.
# TYPE kube_pod_status_scheduled gauge
# HELP kube_pod_container_info Information about a container in a pod.
Expand Down