Uploaded image for project: 'OpenShift Logging'
  1. OpenShift Logging
  2. LOG-5978

API defaults are filled in too eagerly in OpenShift Console form view

XMLWordPrintable

    • False
    • None
    • False
    • NEW
    • OBSDA-550 - Updated APIs for Logging 6.0
    • NEW
    • Release Note Not Required
    • Log Collection - Sprint 258

      Description of problem:

      When creating a new ClusterLogForwarder using OpenShift Console's form view, as soon as the first "output" is added, the defaults for all output types are filled in (mostly "compression"). Because only one output type is valid to be used, this effectively produces an invalid configuration which can not be sent to the API server.

      apiVersion: observability.openshift.io/v1
      kind: ClusterLogForwarder
      metadata:
        name: logging
        namespace: openshift-logging
      spec:
        managementState: Managed
        outputs:
          - loki:
              tuning:
                compression: snappy
            splunk:
              tuning:
                compression: none
            kafka:
              tuning:
                compression: none
            lokiStack:
              tuning:
                compression: snappy
            http:
              tuning:
                compression: none
            otlp:
              tuning:
                compression: gzip
            syslog:
              facility: user
              rfc: RFC5424
              severity: informational
            cloudwatch:
              tuning:
                compression: none
            elasticsearch:
              tuning:
                compression: none
              version: 8 

      This seems to be a shortcoming of the form view, because the "tuning" struct is a pointer field and marked "omitempty", so it should not automatically expand, which is the behavior observed when sending a YAML to the API directly.

      Version-Release number of selected component (if applicable):

      cluster-logging-operator 6.0.0

      How reproducible:

      Install cluster-logging-operator 6.0.0 and use the OpenShift Console form view to create a ClusterLogForwarder resource.

      Steps to Reproduce:

      1. Create ClusterLogForwarder resource
      2. Switch to form view
      3. Add an element to `.spec.outputs`
      4. Switch back to YAML view

      Actual results:

      YAML contains a lot of unused fields that are filled in with defaults.

      Expected results:

      Only the needed fields are present in the YAML output.

      Additional info:

      While this seems to be an issue in how the form view works, a fix from our side would be to remove the "kubebuilder:default" definitions from our API and do the defaulting in the operator.

              rojacob@redhat.com Robert Jacob
              rojacob@redhat.com Robert Jacob
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: