Skip to content

Commit

Permalink
Merge pull request #887 from fluxcd/rm-log-rec-id
Browse files Browse the repository at this point in the history
Remove custom reconcileID value from OCI HelmRepo logger and context overwrite
  • Loading branch information
stefanprodan authored Sep 5, 2022
2 parents 6a560d9 + 59294bf commit f97bbb6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions controllers/bucket_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
start := time.Now()
log := ctrl.LoggerFrom(ctx)

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)

// Fetch the Bucket
obj := &sourcev1.Bucket{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down
4 changes: 0 additions & 4 deletions controllers/gitrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ func (r *GitRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
start := time.Now()
log := ctrl.LoggerFrom(ctx)

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)

// Fetch the GitRepository
obj := &sourcev1.GitRepository{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down
4 changes: 0 additions & 4 deletions controllers/helmchart_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
start := time.Now()
log := ctrl.LoggerFrom(ctx)

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)

// Fetch the HelmChart
obj := &sourcev1.HelmChart{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down
4 changes: 0 additions & 4 deletions controllers/helmrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reque
start := time.Now()
log := ctrl.LoggerFrom(ctx)

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)

// Fetch the HelmRepository
obj := &sourcev1.HelmRepository{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down
9 changes: 1 addition & 8 deletions controllers/helmrepository_controller_oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/uuid"
kuberecorder "k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -113,13 +112,7 @@ func (r *HelmRepositoryOCIReconciler) SetupWithManagerAndOptions(mgr ctrl.Manage

func (r *HelmRepositoryOCIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, retErr error) {
start := time.Now()
log := ctrl.LoggerFrom(ctx).
// Sets a reconcile ID to correlate logs from all suboperations.
WithValues("reconcileID", uuid.NewUUID())

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)
log := ctrl.LoggerFrom(ctx)

// Fetch the HelmRepository
obj := &sourcev1.HelmRepository{}
Expand Down
4 changes: 0 additions & 4 deletions controllers/ocirepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ func (r *OCIRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
start := time.Now()
log := ctrl.LoggerFrom(ctx)

// logger will be associated to the new context that is
// returned from ctrl.LoggerInto.
ctx = ctrl.LoggerInto(ctx, log)

// Fetch the OCIRepository
obj := &sourcev1.OCIRepository{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down

0 comments on commit f97bbb6

Please sign in to comment.