@@ -131,6 +131,14 @@ var _ = SIGDescribe("NodeProblemDetector [DisabledForLargeClusters]", func() {
131
131
gomega .Eventually (func () error {
132
132
return verifyEvents (f , eventListOptions , 1 , "AUFSUmountHung" , node .Name )
133
133
}, pollTimeout , pollInterval ).Should (gomega .Succeed ())
134
+
135
+ // Node problem detector reports kubelet start events automatically starting from NPD v0.7.0+.
136
+ // Since Kubelet may be restarted for a few times after node is booted. We just check the event
137
+ // is detected, but do not check how many times Kubelet is started.
138
+ ginkgo .By (fmt .Sprintf ("Check node-problem-detector posted KubeletStart event on node %q" , node .Name ))
139
+ gomega .Eventually (func () error {
140
+ return verifyEventExists (f , eventListOptions , "KubeletStart" , node .Name )
141
+ }, pollTimeout , pollInterval ).Should (gomega .Succeed ())
134
142
}
135
143
136
144
ginkgo .By ("Gather node-problem-detector cpu and memory stats" )
@@ -202,6 +210,19 @@ func verifyEvents(f *framework.Framework, options metav1.ListOptions, num int, r
202
210
return nil
203
211
}
204
212
213
+ func verifyEventExists (f * framework.Framework , options metav1.ListOptions , reason , nodeName string ) error {
214
+ events , err := f .ClientSet .CoreV1 ().Events (metav1 .NamespaceDefault ).List (options )
215
+ if err != nil {
216
+ return err
217
+ }
218
+ for _ , event := range events .Items {
219
+ if event .Reason == reason && event .Source .Host == nodeName && event .Count > 0 {
220
+ return nil
221
+ }
222
+ }
223
+ return fmt .Errorf ("Event %s does not exist: %v" , reason , events .Items )
224
+ }
225
+
205
226
func verifyNodeCondition (f * framework.Framework , condition v1.NodeConditionType , status v1.ConditionStatus , reason , nodeName string ) error {
206
227
node , err := f .ClientSet .CoreV1 ().Nodes ().Get (nodeName , metav1.GetOptions {})
207
228
if err != nil {
0 commit comments