@@ -177,6 +177,35 @@ var _ = Describe("Pod Metrics", func() {
177
177
_ , found = FindMetricWithLabelValues ("karpenter_pods_startup_duration_seconds" , nil )
178
178
Expect (found ).To (BeTrue ())
179
179
})
180
+ It ("should delete pod unstarted time and pod unbound duration metric on pod delete" , func () {
181
+ p := test .Pod ()
182
+ p .Status .Phase = corev1 .PodPending
183
+ ExpectApplied (ctx , env .Client , p )
184
+ ExpectReconcileSucceeded (ctx , podController , client .ObjectKeyFromObject (p ))
185
+ _ , found := FindMetricWithLabelValues ("karpenter_pods_current_unbound_time_seconds" , map [string ]string {
186
+ "name" : p .GetName (),
187
+ "namespace" : p .GetNamespace (),
188
+ })
189
+ Expect (found ).To (BeTrue ())
190
+ _ , found = FindMetricWithLabelValues ("karpenter_pods_unstarted_time_seconds" , map [string ]string {
191
+ "name" : p .GetName (),
192
+ "namespace" : p .GetNamespace (),
193
+ })
194
+ Expect (found ).To (BeTrue ())
195
+
196
+ ExpectDeleted (ctx , env .Client , p )
197
+ ExpectReconcileSucceeded (ctx , podController , client .ObjectKeyFromObject (p ))
198
+ _ , found = FindMetricWithLabelValues ("karpenter_pods_current_unbound_time_seconds" , map [string ]string {
199
+ "name" : p .GetName (),
200
+ "namespace" : p .GetNamespace (),
201
+ })
202
+ Expect (found ).To (BeFalse ())
203
+ _ , found = FindMetricWithLabelValues ("karpenter_pods_unstarted_time_seconds" , map [string ]string {
204
+ "name" : p .GetName (),
205
+ "namespace" : p .GetNamespace (),
206
+ })
207
+ Expect (found ).To (BeFalse ())
208
+ })
180
209
It ("should delete the pod state metric on pod delete" , func () {
181
210
p := test .Pod ()
182
211
ExpectApplied (ctx , env .Client , p )
0 commit comments