You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Let's assume that node problem detector has started the same time as kubelet
134
+
// We only will check for the KubeletStart if parsing of date here succeed
135
+
// This is an optimization to not ssh one more time to get kubelet's start time.
136
+
// Also we assume specific datetime format to simplify the logic
137
+
output:=result.Stdout
138
+
139
+
// searching for the line "Apr 14 04:47:42 gke-cluster-1-default-pool-b1565719-eqht systemd[1]: Started Kubernetes node problem detector." and fallback to
140
+
idx:=strings.Index(output, "Started Kubernetes node problem detector")
141
+
ifidx!=-1 {
142
+
output=output[:idx]
143
+
idx=strings.LastIndex(output, "\n")
144
+
145
+
ifidx!=-1 {
146
+
output=output[0:15]
147
+
}
148
+
149
+
st, err:=time.Parse("Jan 02 15:04:05", output)
150
+
st=st.AddDate(time.Now().Year(), 0, 0)
151
+
152
+
iferr==nil {
153
+
checkForKubeletStart=time.Since(st) <time.Hour
154
+
}
155
+
} else {
156
+
// fallback to searching the line:
157
+
// -- Logs begin at Thu 2022-04-28 17:32:39 UTC, end at Thu 2022-04-28 17:40:05 UTC. --
158
+
idx:=strings.Index(output, ", end at ")
159
+
160
+
output=output[:idx]
161
+
idx=strings.LastIndex(output, "-- Logs begin at ")
0 commit comments