Skip to content

Commit e3c3dfe

Browse files
Merge pull request #3289 from openshift-cherrypick-robot/cherry-pick-3253-to-release-4.20
[release-4.20] OCPBUGS-61559: Fix secret controller logger mutation
2 parents d29a8ac + 0800446 commit e3c3dfe

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

controllers/metric_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func NewMetricReconciler(mgr manager.Manager, clusterConfig cluster.Config, cfg
7272
// Reconcile is part of the main kubernetes reconciliation loop which reads that state of the cluster for a
7373
// Node object and aims to move the current state of the cluster closer to the desired state.
7474
func (r *metricReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
75-
r.log = r.log.WithValues(MetricController, req.NamespacedName)
75+
r.log.V(1).Info("reconciling", "name", req.NamespacedName.String())
7676
// validate if cluster monitoring is enabled in the operator namespace
7777
enabled, err := r.validate(ctx)
7878
if err != nil {

controllers/node_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ func NewNodeReconciler(mgr manager.Manager, clusterConfig cluster.Config, watchN
7171
// Reconcile is part of the main kubernetes reconciliation loop which reads that state of the cluster for a
7272
// Node object and aims to move the current state of the cluster closer to the desired state.
7373
func (r *nodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
74-
r.log = r.log.WithValues(NodeController, req.NamespacedName)
7574
// Prevent WMCO upgrades while Node objects are being processed
7675
if err := condition.MarkAsBusy(ctx, r.client, r.watchNamespace, r.recorder, NodeController); err != nil {
7776
return ctrl.Result{}, err
@@ -93,6 +92,7 @@ func (r *nodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
9392
return ctrl.Result{}, err
9493
}
9594

95+
r.log.V(1).Info("reconciling", "name", req.NamespacedName.String())
9696
if _, ok := node.GetAnnotations()[metadata.RebootAnnotation]; ok {
9797
// Create a new signer using the private key that the instances will be reconciled with
9898
signer, err := signer.Create(ctx, types.NamespacedName{Namespace: r.watchNamespace,

controllers/registry_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ func NewRegistryReconciler(mgr manager.Manager, clusterConfig cluster.Config,
7878
// Reconcile is part of the main kubernetes reconciliation loop which reads that state of the cluster for objects
7979
// related to image registry config and aims to move the current state of the cluster closer to the desired state.
8080
func (r *registryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
81-
r.log = r.log.WithValues(RegistryController, req.NamespacedName)
82-
81+
r.log.V(1).Info("reconciling", "name", req.NamespacedName.String())
8382
configFiles, err := registries.GenerateConfigFiles(ctx, r.client)
8483
if err != nil {
8584
return ctrl.Result{}, err

controllers/secret_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ type SecretReconciler struct {
147147
// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
148148
func (r *SecretReconciler) Reconcile(ctx context.Context,
149149
request ctrl.Request) (result reconcile.Result, reconcileErr error) {
150-
r.log = r.log.WithValues(SecretController, request.NamespacedName)
151-
152150
var err error
153151
// Prevent WMCO upgrades while secret-based resources are being processed
154152
if err := condition.MarkAsBusy(ctx, r.client, r.watchNamespace, r.recorder, SecretController); err != nil {
@@ -159,6 +157,7 @@ func (r *SecretReconciler) Reconcile(ctx context.Context,
159157
result.Requeue, reconcileErr)
160158
}()
161159

160+
r.log.V(1).Info("reconciling", "secret", request.NamespacedName.String())
162161
r.signer, err = signer.Create(ctx, kubeTypes.NamespacedName{Namespace: r.watchNamespace,
163162
Name: secrets.PrivateKeySecret}, r.client)
164163
if err != nil {

0 commit comments

Comments
 (0)