@@ -106,7 +106,7 @@ func (sr *ShimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
106106
107107	// 1. Check if the shim resource exists 
108108	var  shimResource  rcmv1.Shim 
109- 	if  err  :=  sr .Client . Get (ctx , req .NamespacedName , & shimResource ); err  !=  nil  {
109+ 	if  err  :=  sr .Get (ctx , req .NamespacedName , & shimResource ); err  !=  nil  {
110110		log .Err (err ).Msg ("Unable to fetch shimResource" )
111111		return  ctrl.Result {}, client .IgnoreNotFound (err )
112112	}
@@ -214,7 +214,7 @@ func (sr *ShimReconciler) updateStatus(ctx context.Context, shim *rcmv1.Shim, no
214214	}
215215
216216	// Re-fetch shim to avoid "object has been modified" errors 
217- 	if  err  :=  sr .Client . Get (ctx , types.NamespacedName {Name : shim .Name , Namespace : shim .Namespace }, shim ); err  !=  nil  {
217+ 	if  err  :=  sr .Get (ctx , types.NamespacedName {Name : shim .Name , Namespace : shim .Namespace }, shim ); err  !=  nil  {
218218		log .Error ().Msgf ("Unable to re-fetch shim: %s" , err )
219219		return  fmt .Errorf ("failed to fetch shim: %w" , err )
220220	}
@@ -269,7 +269,7 @@ func (sr *ShimReconciler) recreateStrategyRollout(ctx context.Context, shim *rcm
269269func  (sr  * ShimReconciler ) deployJobOnNode (ctx  context.Context , shim  * rcmv1.Shim , node  corev1.Node , jobType  string ) error  {
270270	log  :=  log .Ctx (ctx )
271271
272- 	if  err  :=  sr .Client . Get (ctx , types.NamespacedName {Name : node .Name }, & node ); err  !=  nil  {
272+ 	if  err  :=  sr .Get (ctx , types.NamespacedName {Name : node .Name }, & node ); err  !=  nil  {
273273		log .Error ().Msgf ("Unable to re-fetch node: %s" , err )
274274		return  fmt .Errorf ("failed to fetch node: %w" , err )
275275	}
@@ -311,7 +311,7 @@ func (sr *ShimReconciler) deployJobOnNode(ctx context.Context, shim *rcmv1.Shim,
311311	}
312312
313313	// We rely on controller-runtime to rate limit us. 
314- 	if  err  :=  sr .Client . Patch (ctx , job , patchMethod , patchOptions ); err  !=  nil  {
314+ 	if  err  :=  sr .Patch (ctx , job , patchMethod , patchOptions ); err  !=  nil  {
315315		log .Error ().Msgf ("Unable to reconcile Job: %s" , err )
316316		if  err  :=  sr .updateNodeLabels (ctx , & node , shim , "failed" ); err  !=  nil  {
317317			log .Error ().Msgf ("Unable to update node label %s: %s" , shim .Name , err )
@@ -506,7 +506,7 @@ func (sr *ShimReconciler) handleDeployRuntimeClass(ctx context.Context, shim *rc
506506	}
507507
508508	// Note that we reconcile even if the deployment is in a good state. We rely on controller-runtime to rate limit us. 
509- 	if  err  :=  sr .Client . Patch (ctx , runtimeClass , patchMethod , patchOptions ); err  !=  nil  {
509+ 	if  err  :=  sr .Patch (ctx , runtimeClass , patchMethod , patchOptions ); err  !=  nil  {
510510		log .Error ().Msgf ("Unable to reconcile RuntimeClass %s" , err )
511511		return  ctrl.Result {}, fmt .Errorf ("failed to reconcile RuntimeClass: %w" , err )
512512	}
@@ -602,7 +602,7 @@ func (sr *ShimReconciler) runtimeClassExists(ctx context.Context, shim *rcmv1.Sh
602602// getRuntimeClass finds a RuntimeClass. 
603603func  (sr  * ShimReconciler ) getRuntimeClass (ctx  context.Context , shim  * rcmv1.Shim ) (* nodev1.RuntimeClass , error ) {
604604	rc  :=  nodev1.RuntimeClass {}
605- 	err  :=  sr .Client . Get (ctx , types.NamespacedName {Name : shim .Spec .RuntimeClass .Name , Namespace : shim .Namespace }, & rc )
605+ 	err  :=  sr .Get (ctx , types.NamespacedName {Name : shim .Spec .RuntimeClass .Name , Namespace : shim .Namespace }, & rc )
606606	if  err  !=  nil  {
607607		return  nil , fmt .Errorf ("failed to get runtimeClass: %w" , err )
608608	}
@@ -613,7 +613,7 @@ func (sr *ShimReconciler) getRuntimeClass(ctx context.Context, shim *rcmv1.Shim)
613613func  (sr  * ShimReconciler ) removeFinalizerFromShim (ctx  context.Context , shim  * rcmv1.Shim ) error  {
614614	if  controllerutil .ContainsFinalizer (shim , RCMOperatorFinalizer ) {
615615		controllerutil .RemoveFinalizer (shim , RCMOperatorFinalizer )
616- 		if  err  :=  sr .Client . Update (ctx , shim ); err  !=  nil  {
616+ 		if  err  :=  sr .Update (ctx , shim ); err  !=  nil  {
617617			return  fmt .Errorf ("failed to remove finalizer: %w" , err )
618618		}
619619	}
@@ -624,7 +624,7 @@ func (sr *ShimReconciler) removeFinalizerFromShim(ctx context.Context, shim *rcm
624624func  (sr  * ShimReconciler ) ensureFinalizerForShim (ctx  context.Context , shim  * rcmv1.Shim , finalizer  string ) error  {
625625	if  ! controllerutil .ContainsFinalizer (shim , finalizer ) {
626626		controllerutil .AddFinalizer (shim , finalizer )
627- 		if  err  :=  sr .Client . Update (ctx , shim ); err  !=  nil  {
627+ 		if  err  :=  sr .Update (ctx , shim ); err  !=  nil  {
628628			return  fmt .Errorf ("failed to set finalizer: %w" , err )
629629		}
630630	}
0 commit comments