Job: Handle error returned from AddEventHandler function (#119917)
* Job: Handle error returned from AddEventHandler function Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Use the error message the similar to CronJob Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Clean up error messages Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Put the tesing.T on the second place in the args for the newControllerFromClient function Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Put the testing.T on the second place in the args for the newControllerFromClientWithClock function Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Call t.Helper() Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Put the testing.TB on the second place in the args for the createJobControllerWithSharedInformers function and call tb.Helper() there Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Put the testing.TB on the second place in the args for the startJobControllerAndWaitForCaches function and call tb.Helper() there Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> * Adapt TestFinializerCleanup to the eventhandler error Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com> --------- Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
This commit is contained in:
@@ -29,12 +29,16 @@ import (
|
||||
)
|
||||
|
||||
func startJobController(ctx context.Context, controllerContext ControllerContext) (controller.Interface, bool, error) {
|
||||
go job.NewController(
|
||||
jobController, err := job.NewController(
|
||||
ctx,
|
||||
controllerContext.InformerFactory.Core().V1().Pods(),
|
||||
controllerContext.InformerFactory.Batch().V1().Jobs(),
|
||||
controllerContext.ClientBuilder.ClientOrDie("job-controller"),
|
||||
).Run(ctx, int(controllerContext.ComponentConfig.JobController.ConcurrentJobSyncs))
|
||||
)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("creating Job controller: %v", err)
|
||||
}
|
||||
go jobController.Run(ctx, int(controllerContext.ComponentConfig.JobController.ConcurrentJobSyncs))
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
@@ -44,7 +48,7 @@ func startCronJobController(ctx context.Context, controllerContext ControllerCon
|
||||
controllerContext.ClientBuilder.ClientOrDie("cronjob-controller"),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("error creating CronJob controller V2: %v", err)
|
||||
return nil, true, fmt.Errorf("creating CronJob controller V2: %v", err)
|
||||
}
|
||||
|
||||
go cj2c.Run(ctx, int(controllerContext.ComponentConfig.CronJobController.ConcurrentCronJobSyncs))
|
||||
|
Reference in New Issue
Block a user