From 92717bdc7285ea66476f3fad6b035bb9b1c1e079 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Fri, 5 Oct 2018 15:52:04 -0500 Subject: [PATCH] Ceph: Remove fluentbit sidecars, mount hostpath for logs This removes the fluentbit sidecars from the ceph-mon and ceph-osd charts. Instead, we mount /var/log/ceph as a hostpath, and use the fluentbit daemonset to target the mounted log files instead This also updates the fluentd configuration to better handle the correct configuration type for flush_interval (time vs int), as well as updates the fluentd elasticsearch output values to help address the gate failures resulting from the Elasticsearch bulk endpoints failing Change-Id: If3f2ff6371f267ed72379de25ff463079ba4cddc --- .../bin/mon/_fluentbit-sidecar.sh.tpl | 19 ------ ceph-mon/templates/configmap-bin.yaml | 4 -- ceph-mon/templates/configmap-etc.yaml | 15 ----- ceph-mon/templates/daemonset-mon.yaml | 43 ++++++-------- .../templates/utils/_to_fluentbit_conf.tpl | 38 ------------ ceph-mon/values.yaml | 58 ------------------ .../bin/osd/_fluentbit-sidecar.sh.tpl | 20 ------- ceph-osd/templates/configmap-bin.yaml | 4 -- ceph-osd/templates/configmap-etc.yaml | 15 ----- ceph-osd/templates/daemonset-osd.yaml | 59 +++++++++++-------- .../templates/utils/_to_fluentbit_conf.tpl | 38 ------------ ceph-osd/values.yaml | 58 ------------------ elasticsearch/values.yaml | 4 +- .../templates/utils/_to_fluentd_conf.tpl | 4 ++ fluent-logging/values.yaml | 21 ++++--- 15 files changed, 70 insertions(+), 330 deletions(-) delete mode 100644 ceph-mon/templates/bin/mon/_fluentbit-sidecar.sh.tpl delete mode 100644 ceph-mon/templates/utils/_to_fluentbit_conf.tpl delete mode 100644 ceph-osd/templates/bin/osd/_fluentbit-sidecar.sh.tpl delete mode 100644 ceph-osd/templates/utils/_to_fluentbit_conf.tpl diff --git a/ceph-mon/templates/bin/mon/_fluentbit-sidecar.sh.tpl b/ceph-mon/templates/bin/mon/_fluentbit-sidecar.sh.tpl deleted file mode 100644 index f72e41de1..000000000 --- a/ceph-mon/templates/bin/mon/_fluentbit-sidecar.sh.tpl +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -{{/* -Copyright 2017 The Openstack-Helm Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/}} -set -ex - -exec /fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf diff --git a/ceph-mon/templates/configmap-bin.yaml b/ceph-mon/templates/configmap-bin.yaml index 8f9e10f63..64ffd5515 100644 --- a/ceph-mon/templates/configmap-bin.yaml +++ b/ceph-mon/templates/configmap-bin.yaml @@ -60,8 +60,4 @@ data: utils-checkPGs.sh: | {{ tuple "bin/utils/_checkPGs.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} -{{ if .Values.logging.fluentd }} - fluentbit-sidecar.sh: | -{{ tuple "bin/mon/_fluentbit-sidecar.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} -{{ end }} {{- end }} diff --git a/ceph-mon/templates/configmap-etc.yaml b/ceph-mon/templates/configmap-etc.yaml index ac4b1e7b0..f0efd3f75 100644 --- a/ceph-mon/templates/configmap-etc.yaml +++ b/ceph-mon/templates/configmap-etc.yaml @@ -42,15 +42,6 @@ limitations under the License. {{- if empty .Values.conf.ceph.osd.public_network -}} {{- $_ := .Values.network.public | set .Values.conf.ceph.osd "public_network" -}} {{- end -}} - -{{- if not (has "fluentd_output" .Values.conf.fluentbit) -}} -{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} -{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- $fluentd_output := dict "header" "output" "Name" "forward" "Match" "*" "Host" $fluentd_host "Port" $fluentd_port -}} -{{- $_ := set .Values "__fluentbit_config" ( list $fluentd_output) -}} -{{- $__fluentbit_config := append .Values.conf.fluentbit .Values.__fluentbit_config -}} -{{- $_ := set .Values.conf "fluentbit" $__fluentbit_config -}} -{{- end -}} --- apiVersion: v1 kind: ConfigMap @@ -59,12 +50,6 @@ metadata: data: ceph.conf: | {{ include "helm-toolkit.utils.to_ini" .Values.conf.ceph | indent 4 }} -{{ if .Values.logging.fluentd }} - fluent-bit.conf: | -{{ include "ceph-mon.utils.to_fluentbit_conf" .Values.conf.fluentbit | indent 4 }} - parsers.conf: | -{{ include "ceph-mon.utils.to_fluentbit_conf" .Values.conf.parsers | indent 4 }} -{{ end }} {{- end }} {{- end }} {{- end }} diff --git a/ceph-mon/templates/daemonset-mon.yaml b/ceph-mon/templates/daemonset-mon.yaml index ada10bda9..dfd38ff11 100644 --- a/ceph-mon/templates/daemonset-mon.yaml +++ b/ceph-mon/templates/daemonset-mon.yaml @@ -91,6 +91,19 @@ spec: - name: pod-run mountPath: /run readOnly: false + - name: ceph-log-ownership +{{ tuple $envAll "ceph_mon" | include "helm-toolkit.snippets.image" | indent 10 }} + securityContext: + runAsUser: 0 + command: + - chown + - -R + - ceph:root + - /var/log/ceph + volumeMounts: + - name: pod-var-log + mountPath: /var/log/ceph + readOnly: false containers: - name: ceph-mon {{ tuple $envAll "ceph_mon" | include "helm-toolkit.snippets.image" | indent 10 }} @@ -195,33 +208,13 @@ spec: - name: pod-run mountPath: /run readOnly: false - - name: varlog + - name: pod-var-log mountPath: /var/log/ceph - {{ if .Values.logging.fluentd }} - - name: fluentbit-sidecar -{{ tuple $envAll "fluentbit" | include "helm-toolkit.snippets.image" | indent 10 }} -{{ tuple $envAll $envAll.Values.pod.resources.fluentbit | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - command: - - /tmp/fluentbit-sidecar.sh - volumeMounts: - - name: ceph-mon-bin - mountPath: /tmp/fluentbit-sidecar.sh - subPath: fluentbit-sidecar.sh - readOnly: true - - name: varlog - mountPath: /var/log/ceph - - name: ceph-mon-etc - mountPath: /fluent-bit/etc/fluent-bit.conf - subPath: fluent-bit.conf - readOnly: true - - name: ceph-mon-etc - mountPath: /fluent-bit/etc/parsers.conf - subPath: parsers.conf - readOnly: true - {{ end }} + readOnly: false volumes: - - name: varlog - emptyDir: {} + - name: pod-var-log + hostPath: + path: /var/log/ceph - name: ceph-mon-bin configMap: name: ceph-mon-bin diff --git a/ceph-mon/templates/utils/_to_fluentbit_conf.tpl b/ceph-mon/templates/utils/_to_fluentbit_conf.tpl deleted file mode 100644 index 773120488..000000000 --- a/ceph-mon/templates/utils/_to_fluentbit_conf.tpl +++ /dev/null @@ -1,38 +0,0 @@ -{{/* -Copyright 2017 The Openstack-Helm Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/}} - -# This function generates fluentbit configuration files with entries in the -# ceph-mon values.yaml. It results in a configuration section with the -# following format (for as many key/value pairs defined in values for a section): -# [HEADER] -# key value -# key value -# key value -# The configuration schema can be found here: -# http://fluentbit.io/documentation/0.12/configuration/schema.html - -{{- define "ceph-mon.utils.to_fluentbit_conf" -}} -{{- range $values := . -}} -{{- range $section := . -}} -{{- $header := pick . "header" -}} -{{- $config := omit . "header" }} -[{{$header.header | upper }}] -{{range $key, $value := $config -}} -{{ $key | indent 4 }} {{ $value }} -{{end -}} -{{- end -}} -{{- end -}} -{{- end -}} diff --git a/ceph-mon/values.yaml b/ceph-mon/values.yaml index 7ba269d7d..d457019d6 100644 --- a/ceph-mon/values.yaml +++ b/ceph-mon/values.yaml @@ -28,7 +28,6 @@ images: ceph_config_helper: 'docker.io/port/ceph-config-helper:v1.10.3' ceph_mon: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' ceph_mon_check: 'docker.io/port/ceph-config-helper:v1.10.3' - fluentbit: docker.io/fluent/fluent-bit:0.12.14 dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.1' image_repo_sync: docker.io/docker:17.07.0 local_registry: @@ -71,13 +70,6 @@ pod: limits: memory: "50Mi" cpu: "500m" - fluentbit: - requests: - memory: "5Mi" - cpu: "250m" - limits: - memory: "50Mi" - cpu: "500m" jobs: bootstrap: limits: @@ -187,40 +179,6 @@ conf: storage: mon: directory: /var/lib/openstack-helm/ceph/mon - fluentbit: - - service: - header: service - Flush: 30 - Daemon: Off - Log_Level: info - Parsers_File: parsers.conf - - ceph_tail: - # NOTE(srwilkers): Despite being exposed, these values should not be - # modified, as the ceph-mon logs are always placed here - header: input - Name: tail - Tag: ceph-mon.* - Path: /var/log/ceph/*.log - Parser: syslog - DB: /var/log/ceph/ceph.db - DB.Sync: Normal - Buffer_Chunk_Size: 1M - Buffer_Max_Size: 1M - Mem_Buf_Limit: 5MB - Refresh_Interval: 10s - parsers: - - syslog: - header: parser - Name: syslog - Format: regex - Regex: '^(?