Skip to content

Commit

Permalink
Add context to handler func
Browse files Browse the repository at this point in the history
Adding context to handler func. The signature of `MapFunc` changed in `controller-runtime` to allow context to be passed in all handler funcs[1]

[1] kubernetes-sigs/controller-runtime@2464a9d
  • Loading branch information
vladfr committed Feb 12, 2024
1 parent 66c3572 commit 79d63f6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ func (r *ConfigDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error {
we just need to loop through the list and create a reconcile request for each one.
If an error occurs fetching the list, or no `ConfigDeployments` are found, then no reconcile requests will be returned.
*/
func (r *ConfigDeploymentReconciler) findObjectsForConfigMap(configMap client.Object) []reconcile.Request {
func (r *ConfigDeploymentReconciler) findObjectsForConfigMap(ctx context.Context, configMap client.Object) []reconcile.Request {
attachedConfigDeployments := &appsv1.ConfigDeploymentList{}
listOps := &client.ListOptions{
FieldSelector: fields.OneTermEqualSelector(configMapField, configMap.GetName()),
Namespace: configMap.GetNamespace(),
}
err := r.List(context.TODO(), attachedConfigDeployments, listOps)
err := r.List(ctx, attachedConfigDeployments, listOps)
if err != nil {
return []reconcile.Request{}
}
Expand All @@ -205,4 +205,4 @@ func (r *ConfigDeploymentReconciler) findObjectsForConfigMap(configMap client.Ob
}
}
return requests
}
}

0 comments on commit 79d63f6

Please sign in to comment.