openshift/cluster-logging-operator

fluentd config map not presented in standard yaml format for editing when viewed with 'oc edit cm fluentd'

bfarrell-ibm opened this issue · 3 comments

Describe the bug
Openshift cluster logging has been installed following the documented instructions.

When i attempt to edit the fluentd config map immediately after the pods start it is presented in a format that is difficult to edit - with lots of carriage returns, \n etc

oc edit cm fluentd

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  fluent.conf: "## CLO GENERATED CONFIGURATION ###\n# This file is a copy of the fluentd
    configuration entrypoint\n# which should normally be supplied in a configmap.\n\n<system>\n
    \ log_level \"#{ENV['LOG_LEVEL'] || 'warn'}\"\n</system>\n\n# In each section
    below, pre- and post- includes don't include anything initially;\n# they exist
    to enable future additions to openshift conf as needed.\n\n## sources\n## ordered
    so that syslog always runs last...\n<source>\n  @type prometheus\n  bind \"#{ENV['POD_IP']}\"\n
    \ <ssl>\n    enable true\n    certificate_path \"#{ENV['METRICS_CERT'] || '/etc/fluent/metrics/tls.crt'}\"\n
    \   private_key_path \"#{ENV['METRICS_KEY'] || '/etc/fluent/metrics/tls.key'}\"\n
    \ </ssl>\n</source>\n\n<source>\n  @type prometheus_monitor\n  <labels>\n    hostname

The issue has been noticed on 5.0, 5.1 and 5.2.

Environment

  • Seen on OCP 4.7 and OCP 4.8
  • ClusterLogging instance (5.0/5.1/5.2)

Logs
n/a

Expected behavior
fluentd config map should be presented in a more standard yaml format

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  fluent.conf: |+
    ## CLO GENERATED CONFIGURATION ###
    # This file is a copy of the fluentd configuration entrypoint
    # which should normally be supplied in a configmap.

    <system>
      log_level "#{ENV['LOG_LEVEL'] || 'warn'}"
    </system>

    # In each section below, pre- and post- includes don't include anything initially;
    # they exist to enable future additions to openshift conf as needed.

Actual behavior
The fluentd config map is not easily editable.
Perhaps the default config map has extra characters present (trailing spaces etc) which impact the format presentation.

To Reproduce
Steps to reproduce the behavior:

  1. Install cluster logging as per the documentation
    https://docs.openshift.com/container-platform/4.8/logging/cluster-logging-deploying.html
  2. After creating the cluster logging instance and pods have started attempt to modify the fluentd config map oc edit cm fluentd

Additional context

This is a known issue that is caused by a mismatch of spaces and tabs which is challenging to hunt down. A work around is to extract the configmap to a local directory, make your edits and use 'oc replace'

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

fixed by #1352