From 959417f32103bc3695604e84dbf956ea452e9c02 Mon Sep 17 00:00:00 2001 From: Steven Fitzpatrick Date: Mon, 3 Aug 2020 11:52:11 -0500 Subject: [PATCH] Fluentd: Remove Deployment Option This chart could deploy fluentd either as a Deployment or a Daemonset. Both options would use the deployment-fluentd template with various sections toggled off based on values.yaml I'd like to know - Does anyone run this chart as a Deployment? We can simplify the chart, and zuul gates, by changing the chart to deploy a Daemonset specifically. Change-Id: Ie88ceadbf5113fc60e5bb0ddef09e18fe07a192c --- doc/source/install/multinode.rst | 4 +- ...deployment-fluentd.yaml => daemonset.yaml} | 24 +------ fluentd/values.yaml | 24 +------ tools/deployment/common/fluentd-deployment.sh | 65 ------------------- .../{fluentd-daemonset.sh => fluentd.sh} | 18 ++--- .../multinode/130-fluentd-daemonset.sh | 1 - tools/deployment/multinode/130-fluentd.sh | 1 + .../multinode/135-fluentd-deployment.sh | 1 - .../060-fluentd-daemonset.sh | 1 - .../osh-infra-logging/060-fluentd.sh | 1 + .../065-fluentd-deployment.sh | 1 - zuul.d/jobs.yaml | 6 +- 12 files changed, 14 insertions(+), 133 deletions(-) rename fluentd/templates/{deployment-fluentd.yaml => daemonset.yaml} (91%) delete mode 100755 tools/deployment/common/fluentd-deployment.sh rename tools/deployment/common/{fluentd-daemonset.sh => fluentd.sh} (95%) delete mode 120000 tools/deployment/multinode/130-fluentd-daemonset.sh create mode 120000 tools/deployment/multinode/130-fluentd.sh delete mode 120000 tools/deployment/multinode/135-fluentd-deployment.sh delete mode 120000 tools/deployment/osh-infra-logging/060-fluentd-daemonset.sh create mode 120000 tools/deployment/osh-infra-logging/060-fluentd.sh delete mode 120000 tools/deployment/osh-infra-logging/065-fluentd-deployment.sh diff --git a/doc/source/install/multinode.rst b/doc/source/install/multinode.rst index b5a47f211..d06f002e4 100644 --- a/doc/source/install/multinode.rst +++ b/doc/source/install/multinode.rst @@ -226,7 +226,7 @@ Alternatively, this step can be performed by running the script directly: Deploy Fluentd ^^^^^^^^^^^^^^ -.. literalinclude:: ../../../tools/deployment/multinode/135-fluentd-deployment.sh +.. literalinclude:: ../../../tools/deployment/multinode/130-fluentd.sh :language: shell :lines: 1,17- @@ -234,4 +234,4 @@ Alternatively, this step can be performed by running the script directly: .. code-block:: shell - ./tools/deployment/multinode/135-fluentd-deployment.sh + ./tools/deployment/multinode/130-fluentd.sh diff --git a/fluentd/templates/deployment-fluentd.yaml b/fluentd/templates/daemonset.yaml similarity index 91% rename from fluentd/templates/deployment-fluentd.yaml rename to fluentd/templates/daemonset.yaml index b626b8feb..4d1037fce 100644 --- a/fluentd/templates/deployment-fluentd.yaml +++ b/fluentd/templates/daemonset.yaml @@ -12,7 +12,7 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.deployment_fluentd }} +{{- if .Values.manifests.daemonset }} {{- $envAll := . }} {{- $mounts_fluentd := .Values.pod.mounts.fluentd.fluentd }} @@ -68,13 +68,8 @@ rules: - list - watch --- -{{- if eq .Values.deployment.type "Deployment" }} -apiVersion: apps/v1 -kind: Deployment -{{- else if eq .Values.deployment.type "DaemonSet" }} apiVersion: apps/v1 kind: DaemonSet -{{- end }} metadata: name: {{ $rcControllerName | quote }} annotations: @@ -82,12 +77,7 @@ metadata: labels: {{ tuple $envAll "fluentd" "internal" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: -{{- if eq .Values.deployment.type "Deployment" }} - replicas: {{ .Values.pod.replicas.fluentd }} -{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} -{{- else }} {{ tuple $envAll "fluentd" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} -{{- end }} selector: matchLabels: {{ tuple $envAll "fluentd" "internal" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} @@ -106,13 +96,9 @@ spec: spec: {{ dict "envAll" $envAll "application" "fluentd" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $rcControllerName | quote }} -{{ if and ($envAll.Values.pod.tolerations.fluentd.enabled) (eq .Values.deployment.type "DaemonSet") }} +{{ if $envAll.Values.pod.tolerations.fluentd.enabled }} {{ tuple $envAll "fluentd" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} {{ end }} -{{- if eq .Values.deployment.type "Deployment" }} - affinity: -{{ tuple $envAll "fluentd" "internal" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} -{{- end }} nodeSelector: {{ .Values.labels.fluentd.node_selector_key }}: {{ .Values.labels.fluentd.node_selector_value | quote }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.fluentd.timeout | default "30" }} @@ -131,7 +117,6 @@ spec: containerPort: {{ tuple "fluentd" "internal" "service" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: metrics containerPort: {{ tuple "fluentd" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} -{{- if eq .Values.deployment.type "Deployment" }} readinessProbe: tcpSocket: port: {{ tuple "fluentd" "internal" "service" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} @@ -142,7 +127,6 @@ spec: port: {{ tuple "fluentd" "internal" "service" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 60 timeoutSeconds: 10 -{{- end }} env: - name: NODE_NAME valueFrom: @@ -191,13 +175,11 @@ spec: volumeMounts: - name: pod-tmp mountPath: /tmp -{{- if eq .Values.deployment.type "DaemonSet" }} - name: varlog mountPath: /var/log - name: varlibdockercontainers mountPath: /var/lib/docker/containers readOnly: true -{{- end }} - name: pod-etc-fluentd mountPath: /fluentd/etc - name: fluentd-etc @@ -212,14 +194,12 @@ spec: volumes: - name: pod-tmp emptyDir: {} -{{- if eq .Values.deployment.type "DaemonSet" }} - name: varlog hostPath: path: /var/log - name: varlibdockercontainers hostPath: path: /var/lib/docker/containers -{{- end }} - name: pod-etc-fluentd emptyDir: {} {{ if and (.Values.manifests.secret_fluentd_env) (.Values.pod.env.fluentd.secrets) }} diff --git a/fluentd/values.yaml b/fluentd/values.yaml index f671dd1ad..90bc833ce 100644 --- a/fluentd/values.yaml +++ b/fluentd/values.yaml @@ -17,9 +17,6 @@ --- release_group: null -deployment: - type: DaemonSet - labels: fluentd: node_selector_key: openstack-control-plane @@ -397,28 +394,13 @@ pod: security_context: fluentd: pod: - runAsUser: 65534 + runAsUser: 0 container: fluentd: allowPrivilegeEscalation: false readOnlyRootFilesystem: true - - affinity: - anti: - type: - default: preferredDuringSchedulingIgnoredDuringExecution - topologyKey: - default: kubernetes.io/hostname - weight: - default: 10 lifecycle: upgrades: - deployments: - revision_history: 3 - pod_replacement_strategy: RollingUpdate - rolling_update: - max_unavailable: 1 - max_surge: 3 daemonsets: pod_replacement_strategy: RollingUpdate fluentd: @@ -428,8 +410,6 @@ pod: termination_grace_period: fluentd: timeout: 30 - replicas: - fluentd: 3 resources: enabled: false fluentd: @@ -446,7 +426,7 @@ pod: manifests: configmap_bin: true configmap_etc: true - deployment_fluentd: true + daemonset: true job_image_repo_sync: true network_policy: false secret_elasticsearch: true diff --git a/tools/deployment/common/fluentd-deployment.sh b/tools/deployment/common/fluentd-deployment.sh deleted file mode 100755 index e1c2d9438..000000000 --- a/tools/deployment/common/fluentd-deployment.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# 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 -xe - -#NOTE: Lint and package chart -make fluentd - -: ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD:="$(./tools/deployment/common/get-values-overrides.sh fluentd)"} - -if [ ! -d "/var/log/journal" ]; then -tee /tmp/fluentd.yaml << EOF -deployment: - type: Deployment -pod: - replicas: - fluentd: 1 - mounts: - fluentbit: - fluentbit: - volumes: - - name: runlog - hostPath: - path: /run/log - volumeMounts: - - name: runlog - mountPath: /run/log -EOF -helm upgrade --install fluentd ./fluentd \ - --namespace=osh-infra \ - --values=/tmp/fluentd.yaml \ - ${OSH_INFRA_EXTRA_HELM_ARGS} \ - ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD} - -else -tee /tmp/fluentd.yaml << EOF -deployment: - type: Deployment -pod: - replicas: - fluentd: 1 -EOF -fi -helm upgrade --install fluentd ./fluentd \ - --namespace=osh-infra \ - --values=/tmp/fluentd.yaml \ - ${OSH_INFRA_EXTRA_HELM_ARGS} \ - ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD} - -#NOTE: Wait for deploy -./tools/deployment/common/wait-for-pods.sh osh-infra - -#NOTE: Validate Deployment info -helm status fluentd diff --git a/tools/deployment/common/fluentd-daemonset.sh b/tools/deployment/common/fluentd.sh similarity index 95% rename from tools/deployment/common/fluentd-daemonset.sh rename to tools/deployment/common/fluentd.sh index 72d7c37cb..5ece3ae86 100755 --- a/tools/deployment/common/fluentd-daemonset.sh +++ b/tools/deployment/common/fluentd.sh @@ -18,11 +18,7 @@ set -xe make fluentd : ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD:="$(./tools/deployment/common/get-values-overrides.sh fluentd)"} -tee /tmp/fluentd-daemonset.yaml << EOF -endpoints: - fluentd: - hosts: - default: fluentd-daemonset +tee /tmp/fluentd.yaml << EOF pod: env: fluentd: @@ -30,12 +26,6 @@ pod: MY_TEST_VAR: FOO secrets: MY_TEST_SECRET: BAR - security_context: - fluentd: - pod: - runAsUser: 0 -deployment: - type: DaemonSet conf: fluentd: # This field is now rendered as a helm template! @@ -261,9 +251,9 @@ conf: user "#{ENV['ELASTICSEARCH_USERNAME']}" EOF -helm upgrade --install fluentd-daemonset ./fluentd \ +helm upgrade --install fluentd ./fluentd \ --namespace=osh-infra \ - --values=/tmp/fluentd-daemonset.yaml \ + --values=/tmp/fluentd.yaml \ ${OSH_INFRA_EXTRA_HELM_ARGS} \ ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD} @@ -271,4 +261,4 @@ helm upgrade --install fluentd-daemonset ./fluentd \ ./tools/deployment/common/wait-for-pods.sh osh-infra #NOTE: Validate Deployment info -helm status fluentd-daemonset +helm status fluentd diff --git a/tools/deployment/multinode/130-fluentd-daemonset.sh b/tools/deployment/multinode/130-fluentd-daemonset.sh deleted file mode 120000 index af568c5cf..000000000 --- a/tools/deployment/multinode/130-fluentd-daemonset.sh +++ /dev/null @@ -1 +0,0 @@ -../common/fluentd-daemonset.sh \ No newline at end of file diff --git a/tools/deployment/multinode/130-fluentd.sh b/tools/deployment/multinode/130-fluentd.sh new file mode 120000 index 000000000..c4b76c18c --- /dev/null +++ b/tools/deployment/multinode/130-fluentd.sh @@ -0,0 +1 @@ +../common/fluentd.sh \ No newline at end of file diff --git a/tools/deployment/multinode/135-fluentd-deployment.sh b/tools/deployment/multinode/135-fluentd-deployment.sh deleted file mode 120000 index 39a694b6e..000000000 --- a/tools/deployment/multinode/135-fluentd-deployment.sh +++ /dev/null @@ -1 +0,0 @@ -../common/fluentd-deployment.sh \ No newline at end of file diff --git a/tools/deployment/osh-infra-logging/060-fluentd-daemonset.sh b/tools/deployment/osh-infra-logging/060-fluentd-daemonset.sh deleted file mode 120000 index af568c5cf..000000000 --- a/tools/deployment/osh-infra-logging/060-fluentd-daemonset.sh +++ /dev/null @@ -1 +0,0 @@ -../common/fluentd-daemonset.sh \ No newline at end of file diff --git a/tools/deployment/osh-infra-logging/060-fluentd.sh b/tools/deployment/osh-infra-logging/060-fluentd.sh new file mode 120000 index 000000000..c4b76c18c --- /dev/null +++ b/tools/deployment/osh-infra-logging/060-fluentd.sh @@ -0,0 +1 @@ +../common/fluentd.sh \ No newline at end of file diff --git a/tools/deployment/osh-infra-logging/065-fluentd-deployment.sh b/tools/deployment/osh-infra-logging/065-fluentd-deployment.sh deleted file mode 120000 index 39a694b6e..000000000 --- a/tools/deployment/osh-infra-logging/065-fluentd-deployment.sh +++ /dev/null @@ -1 +0,0 @@ -../common/fluentd-deployment.sh \ No newline at end of file diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 46f88f99d..086441518 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -79,8 +79,7 @@ - ./tools/deployment/multinode/115-radosgw-osh-infra.sh - ./tools/deployment/multinode/120-elasticsearch.sh - ./tools/deployment/multinode/125-fluentbit.sh - - ./tools/deployment/multinode/130-fluentd-daemonset.sh - - ./tools/deployment/multinode/135-fluentd-deployment.sh + - ./tools/deployment/multinode/130-fluentd.sh - ./tools/deployment/multinode/140-kibana.sh - ./tools/deployment/multinode/160-zookeeper.sh - ./tools/deployment/multinode/600-grafana-selenium.sh || true @@ -149,8 +148,7 @@ - ./tools/deployment/osh-infra-logging/030-radosgw-osh-infra.sh - ./tools/deployment/osh-infra-logging/040-ldap.sh - ./tools/deployment/osh-infra-logging/050-elasticsearch.sh - - ./tools/deployment/osh-infra-logging/060-fluentd-daemonset.sh - - ./tools/deployment/osh-infra-logging/065-fluentd-deployment.sh + - ./tools/deployment/osh-infra-logging/060-fluentd.sh - ./tools/deployment/osh-infra-logging/070-kibana.sh - ./tools/deployment/osh-infra-logging/600-kibana-selenium.sh || true