Skip to content

Commit 59294bf

Browse files
committed
controllers: Remove ctx overwrite
Context in the reconcilers were overwritten earlier after adding new log field `reconcileID` in the logger. Since the `reconcileID` is now set by controller-runtime, this is no longer needed. The logger in the context already has the field set and when the context is passed to other functions, they too have the logger with the reconcileID set. Signed-off-by: Sunny <[email protected]>
1 parent 658134f commit 59294bf

6 files changed

+0
-24
lines changed

controllers/bucket_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,6 @@ func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
249249
start := time.Now()
250250
log := ctrl.LoggerFrom(ctx)
251251

252-
// logger will be associated to the new context that is
253-
// returned from ctrl.LoggerInto.
254-
ctx = ctrl.LoggerInto(ctx, log)
255-
256252
// Fetch the Bucket
257253
obj := &sourcev1.Bucket{}
258254
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

controllers/gitrepository_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ func (r *GitRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
164164
start := time.Now()
165165
log := ctrl.LoggerFrom(ctx)
166166

167-
// logger will be associated to the new context that is
168-
// returned from ctrl.LoggerInto.
169-
ctx = ctrl.LoggerInto(ctx, log)
170-
171167
// Fetch the GitRepository
172168
obj := &sourcev1.GitRepository{}
173169
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

controllers/helmchart_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
185185
start := time.Now()
186186
log := ctrl.LoggerFrom(ctx)
187187

188-
// logger will be associated to the new context that is
189-
// returned from ctrl.LoggerInto.
190-
ctx = ctrl.LoggerInto(ctx, log)
191-
192188
// Fetch the HelmChart
193189
obj := &sourcev1.HelmChart{}
194190
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

controllers/helmrepository_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reque
150150
start := time.Now()
151151
log := ctrl.LoggerFrom(ctx)
152152

153-
// logger will be associated to the new context that is
154-
// returned from ctrl.LoggerInto.
155-
ctx = ctrl.LoggerInto(ctx, log)
156-
157153
// Fetch the HelmRepository
158154
obj := &sourcev1.HelmRepository{}
159155
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

controllers/helmrepository_controller_oci.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ func (r *HelmRepositoryOCIReconciler) Reconcile(ctx context.Context, req ctrl.Re
114114
start := time.Now()
115115
log := ctrl.LoggerFrom(ctx)
116116

117-
// logger will be associated to the new context that is
118-
// returned from ctrl.LoggerInto.
119-
ctx = ctrl.LoggerInto(ctx, log)
120-
121117
// Fetch the HelmRepository
122118
obj := &sourcev1.HelmRepository{}
123119
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

controllers/ocirepository_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ func (r *OCIRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
161161
start := time.Now()
162162
log := ctrl.LoggerFrom(ctx)
163163

164-
// logger will be associated to the new context that is
165-
// returned from ctrl.LoggerInto.
166-
ctx = ctrl.LoggerInto(ctx, log)
167-
168164
// Fetch the OCIRepository
169165
obj := &sourcev1.OCIRepository{}
170166
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {

0 commit comments

Comments
 (0)