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
This commit is contained in:
Steven Fitzpatrick 2020-08-03 11:52:11 -05:00
parent b82a146640
commit 959417f321
12 changed files with 14 additions and 133 deletions

View File

@ -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

View File

@ -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) }}

View File

@ -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

View File

@ -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

View File

@ -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']}"
</match>
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

View File

@ -1 +0,0 @@
../common/fluentd-daemonset.sh

View File

@ -0,0 +1 @@
../common/fluentd.sh

View File

@ -1 +0,0 @@
../common/fluentd-deployment.sh

View File

@ -1 +0,0 @@
../common/fluentd-daemonset.sh

View File

@ -0,0 +1 @@
../common/fluentd.sh

View File

@ -1 +0,0 @@
../common/fluentd-deployment.sh

View File

@ -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