@@ -39,7 +39,6 @@ const RequestEnqueueLabelValue = "cert-manager-istio-csr"
3939type Reconciler struct {
4040 common.CtrlClient
4141
42- ctx context.Context
4342 eventRecorder record.EventRecorder
4443 log logr.Logger
4544 scheme * runtime.Scheme
@@ -58,7 +57,6 @@ func New(mgr ctrl.Manager) (*Reconciler, error) {
5857 }
5958 return & Reconciler {
6059 CtrlClient : c ,
61- ctx : context .Background (),
6260 eventRecorder : mgr .GetEventRecorderFor (ControllerName ),
6361 log : ctrl .Log .WithName (ControllerName ),
6462 scheme : mgr .GetScheme (),
@@ -178,7 +176,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
178176 if ! istiocsr .DeletionTimestamp .IsZero () {
179177 r .log .V (1 ).Info ("istiocsr.openshift.operator.io is marked for deletion" , "namespace" , req .NamespacedName )
180178
181- if requeue , err := r .cleanUp (istiocsr ); err != nil {
179+ if requeue , err := r .cleanUp (ctx , istiocsr ); err != nil {
182180 return ctrl.Result {}, fmt .Errorf ("clean up failed for %q istiocsr.openshift.operator.io instance deletion: %w" , req .NamespacedName , err )
183181 } else if requeue {
184182 return ctrl.Result {RequeueAfter : defaultRequeueTime }, nil
@@ -197,25 +195,25 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
197195 return ctrl.Result {}, fmt .Errorf ("failed to update %q istiocsr.openshift.operator.io with finalizers: %w" , req .NamespacedName , err )
198196 }
199197
200- return r .processReconcileRequest (istiocsr , req .NamespacedName )
198+ return r .processReconcileRequest (ctx , istiocsr , req .NamespacedName )
201199}
202200
203- func (r * Reconciler ) processReconcileRequest (istiocsr * v1alpha1.IstioCSR , req types.NamespacedName ) (ctrl.Result , error ) {
201+ func (r * Reconciler ) processReconcileRequest (ctx context. Context , istiocsr * v1alpha1.IstioCSR , req types.NamespacedName ) (ctrl.Result , error ) {
204202 istioCSRCreateRecon := false
205203 if ! containsProcessedAnnotation (istiocsr ) && reflect .DeepEqual (istiocsr .Status , v1alpha1.IstioCSRStatus {}) {
206204 r .log .V (1 ).Info ("starting reconciliation of newly created istiocsr" , "namespace" , istiocsr .GetNamespace (), "name" , istiocsr .GetName ())
207205 istioCSRCreateRecon = true
208206 }
209207
210- if err := r .disallowMultipleIstioCSRInstances (istiocsr ); err != nil {
208+ if err := r .disallowMultipleIstioCSRInstances (ctx , istiocsr ); err != nil {
211209 if common .IsMultipleInstanceError (err ) {
212210 r .eventRecorder .Eventf (istiocsr , corev1 .EventTypeWarning , "MultiIstioCSRInstance" , "creation of multiple istiocsr instances is not supported, will not be processed" )
213211 err = nil
214212 }
215213 return ctrl.Result {}, err
216214 }
217215
218- reconcileErr := r .reconcileIstioCSRDeployment (istiocsr , istioCSRCreateRecon )
216+ reconcileErr := r .reconcileIstioCSRDeployment (ctx , istiocsr , istioCSRCreateRecon )
219217 if reconcileErr != nil {
220218 r .log .Error (reconcileErr , "failed to reconcile IstioCSR deployment" , "request" , req )
221219 }
@@ -225,7 +223,7 @@ func (r *Reconciler) processReconcileRequest(istiocsr *v1alpha1.IstioCSR, req ty
225223 reconcileErr ,
226224 r .log .WithValues ("namespace" , istiocsr .GetNamespace (), "name" , istiocsr .GetName ()),
227225 func (prependErr error ) error {
228- return r .updateCondition (istiocsr , prependErr )
226+ return r .updateCondition (ctx , istiocsr , prependErr )
229227 },
230228 defaultRequeueTime ,
231229 )
@@ -234,7 +232,7 @@ func (r *Reconciler) processReconcileRequest(istiocsr *v1alpha1.IstioCSR, req ty
234232// cleanUp handles deletion of istiocsr.openshift.operator.io gracefully.
235233//
236234//nolint:unparam // error return is kept for future implementation
237- func (r * Reconciler ) cleanUp (istiocsr * v1alpha1.IstioCSR ) (bool , error ) {
235+ func (r * Reconciler ) cleanUp (_ context. Context , istiocsr * v1alpha1.IstioCSR ) (bool , error ) {
238236 // TODO: For GA, handle cleaning up of resources created for installing istio-csr operand.
239237 // This might require a validation webhook to check for usage of service as GRPC endpoint in
240238 // any of OpenShift Service Mesh or Istiod deployments to avoid disruptions across cluster.
0 commit comments