@@ -132,7 +132,7 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
132
132
log .Error (err , "failed to reconcile job" )
133
133
return err
134
134
}
135
- log .Error (err , "failed to reconcile job only err: " , err . Error () )
135
+ log .Error (err , "failed to reconcile job only error" )
136
136
return err
137
137
}
138
138
@@ -184,11 +184,15 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
184
184
}
185
185
return errors .Wrapf (err , "failed to check the version of the crdb" )
186
186
}
187
+
188
+ // Tail only last two lines as one line contains version info and one line has newline character. It is much faster.
189
+ podLines := int64 (2 )
187
190
podLogOpts := corev1.PodLogOptions {
188
191
Container : resource .JobContainerName ,
192
+ TailLines : & podLines ,
189
193
}
190
- //get pod for the job we created
191
194
195
+ //get pod for the job we created
192
196
pods , err := v .clientset .CoreV1 ().Pods (job .Namespace ).List (ctx , metav1.ListOptions {
193
197
LabelSelector : labels .Set (job .Spec .Selector .MatchLabels ).AsSelector ().String (),
194
198
})
@@ -231,11 +235,12 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
231
235
}
232
236
output := buf .String ()
233
237
238
+ log .Info ("Logs of version checker pod" , "log" , output )
234
239
// This is the value from Build Tag taken from the container
235
240
calVersion = strings .Replace (output , "\n " , "" , - 1 )
236
- // if no image is retrieved we exit
241
+ // if no logs are found we will retry later to fetch the logs
237
242
if calVersion == "" {
238
- err := PermanentErr {Err : errors .New ("failed to check the version of the cluster" )}
243
+ err := NotReadyErr {Err : errors .New ("failed to check the version of the cluster" )}
239
244
log .Error (err , "crdb version not found" )
240
245
return err
241
246
}
0 commit comments