openshift/cluster-logging-operator

ClusterLogForwarder's status is constantly replaced, leading to infinite reconciliation runs

Closed this issue · 1 comments

ClusterLogForwarder's status is constantly replaced, leading to infinite reconciliation runs

The following code:

controllers/forwarding/forwarding_controller.go
@@ -83,7 +83,9 @@ func (r *ReconcileForwarder) Reconcile(ctx context.Context, request ctrl.Request
        // Fetch the ClusterLogForwarder instance
        instance, err, status := loader.FetchClusterLogForwarder(r.Client, request.NamespacedName.Namespace, request.NamespacedName.Name, true, func() logging.ClusterLogging { return *cl })
        if status != nil {
              instance.Status = *status

always repalces the entire CLF status. That in turn leads to constant status updates of the type Ready condition where lastTransitionTime is always set, even though no actual transition happens.

In turn, the operator infinitely reconciles resources, even though nothing happens.

You can easily see this by running the current version of the Operator with debug level 3:

 LOG_LEVEL=3 make run

With the following 2 resources in place:

[akaris@workstation logging]$ cat configuring-cluster-logging-minimal.yaml
apiVersion: "logging.openshift.io/v1"
kind: "ClusterLogging"
metadata:
  name: "instance" 
  namespace: openshift-logging
spec:
  managementState: "Managed"
  collection:
    tolerations:
    - effect: NoSchedule
      key: node-role.kubernetes.io/master
      operator: Exists
    type: vector
[akaris@workstation logging]$ cat configuring-log-forwarder.yaml
apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
  name: instance
  namespace: openshift-logging
spec:
  pipelines:
   - inputRefs:
     - audit
     outputRefs:
     - loki-external
     labels:
       job: openshift-audit
       clusterid: sno10
   - inputRefs:
     - application
     outputRefs:
     - loki-external
     labels:
       job: openshift-application
       clusterid: sno10
   - inputRefs:
     - infrastructure
     outputRefs:
     - loki-external
     labels:
       job: openshift-infrastructure
       clusterid: sno10
  outputs:
  - name: loki-external
    type: loki
    url: http://192.168.18.75:3100

/assign