@@ -116,7 +116,7 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
116116 cluster .SetCrdbContainerImage (containerImage )
117117 cluster .SetAnnotationContainerImage (containerImage )
118118 jobName := cluster .JobName ()
119- changed , err := (resource.Reconciler {
119+ _ , err := (resource.Reconciler {
120120 ManagedResource : r ,
121121 Builder : resource.JobBuilder {
122122 Cluster : cluster ,
@@ -132,17 +132,10 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
132132 log .Error (err , "failed to reconcile job" )
133133 return err
134134 }
135- log .Error (err , "failed to reconcile job only err: " , err . Error () )
135+ log .Error (err , "failed to reconcile job only error" )
136136 return err
137137 }
138138
139- if changed {
140- log .V (int (zapcore .DebugLevel )).Info ("created/updated job, stopping request processing" )
141- // Return a non error error here to prevent the controller from
142- // clearing any previously set Status fields.
143- return NotReadyErr {errors .New ("job changed" )}
144- }
145-
146139 log .V (int (zapcore .DebugLevel )).Info ("version checker" , "job" , jobName )
147140 key := kubetypes.NamespacedName {
148141 Namespace : cluster .Namespace (),
@@ -184,11 +177,15 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
184177 }
185178 return errors .Wrapf (err , "failed to check the version of the crdb" )
186179 }
180+
181+ // Tail only last two lines as one line contains version info and one line has newline character. It is much faster.
182+ podLines := int64 (2 )
187183 podLogOpts := corev1.PodLogOptions {
188184 Container : resource .JobContainerName ,
185+ TailLines : & podLines ,
189186 }
190- //get pod for the job we created
191187
188+ //get pod for the job we created
192189 pods , err := v .clientset .CoreV1 ().Pods (job .Namespace ).List (ctx , metav1.ListOptions {
193190 LabelSelector : labels .Set (job .Spec .Selector .MatchLabels ).AsSelector ().String (),
194191 })
@@ -231,11 +228,12 @@ func (v *versionChecker) Act(ctx context.Context, cluster *resource.Cluster, log
231228 }
232229 output := buf .String ()
233230
231+ log .Info ("Logs of version checker pod" , "log" , output )
234232 // This is the value from Build Tag taken from the container
235233 calVersion = strings .Replace (output , "\n " , "" , - 1 )
236- // if no image is retrieved we exit
234+ // if no logs are found we will retry later to fetch the logs
237235 if calVersion == "" {
238- err := PermanentErr {Err : errors .New ("failed to check the version of the cluster" )}
236+ err := NotReadyErr {Err : errors .New ("failed to check the version of the cluster" )}
239237 log .Error (err , "crdb version not found" )
240238 return err
241239 }
@@ -366,7 +364,8 @@ func IsJobPodRunning(
366364 }
367365 pod := pods .Items [0 ]
368366 if ! kube .IsPodReady (& pod ) {
369- return LogError ("job pod is not ready yet waiting longer" , nil , l )
367+ pErr := fmt .Errorf ("pod %s is not ready, and in %s phase" , pod .Name , pod .Status .Phase )
368+ return LogError ("job pod is not ready yet waiting longer" , pErr , l )
370369 }
371370 l .V (int (zapcore .DebugLevel )).Info ("job pod is ready" )
372371 return nil
@@ -406,7 +405,7 @@ func WaitUntilJobPodIsRunning(ctx context.Context, clientset kubernetes.Interfac
406405 return IsJobPodRunning (ctx , clientset , job , l )
407406 }
408407 b := backoff .NewExponentialBackOff ()
409- b .MaxElapsedTime = 120 * time .Second
408+ b .MaxElapsedTime = 180 * time .Second
410409 b .MaxInterval = 10 * time .Second
411410 if err := backoff .Retry (f , b ); err != nil {
412411 return errors .Wrapf (err , "pod is not running for job: %s" , job .Name )
0 commit comments