From f970a1b3a73b68697a3d22709c8dc275e5eac4f7 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Mon, 4 Mar 2019 07:48:07 -0600 Subject: [PATCH] Elastic Beats: Update daemonset templates to match other daemonsets This updates the metricbeat and filebeat daemonset templates to include both the appropriate node selector definitions as well as the ability to enable tolerations for the daemonsets in the same manner as fluentbit and the node exporter Change-Id: I474c4361c86287f05ab6078c1f81d671e902598d --- elastic-filebeat/templates/daemonset.yaml | 9 ++++++++- elastic-filebeat/values.yaml | 8 ++++++++ elastic-metricbeat/templates/daemonset-node-metrics.yaml | 9 +++++++++ elastic-metricbeat/values.yaml | 8 ++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/elastic-filebeat/templates/daemonset.yaml b/elastic-filebeat/templates/daemonset.yaml index 828b789c6..c7a7e3321 100644 --- a/elastic-filebeat/templates/daemonset.yaml +++ b/elastic-filebeat/templates/daemonset.yaml @@ -78,6 +78,9 @@ kind: DaemonSet metadata: name: filebeat spec: + selector: + matchLabels: +{{ tuple $envAll "filebeat" "daemon" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} {{ tuple $envAll "filebeat" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: @@ -87,8 +90,12 @@ spec: configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: serviceAccountName: {{ $serviceAccountName }} +{{ if $envAll.Values.pod.tolerations.filebeat.enabled }} +{{ tuple $envAll "filebeat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ else }} nodeSelector: - {{ .Values.labels.filebeat.node_selector_key }}: {{ .Values.labels.filebeat.node_selector_value }} + {{ .Values.labels.filebeat.node_selector_key }}: {{ .Values.labels.filebeat.node_selector_value | quote }} +{{ end }} initContainers: {{ tuple $envAll "filebeat" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/elastic-filebeat/values.yaml b/elastic-filebeat/values.yaml index 00cb6b406..9490e59a9 100644 --- a/elastic-filebeat/values.yaml +++ b/elastic-filebeat/values.yaml @@ -204,6 +204,14 @@ pod: requests: memory: '100Mi' cpu: '100m' + tolerations: + filebeat: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + - key: node-role.kubernetes.io/node + operator: Exists mounts: filebeat: filebeat: diff --git a/elastic-metricbeat/templates/daemonset-node-metrics.yaml b/elastic-metricbeat/templates/daemonset-node-metrics.yaml index 85b8a9018..e8c58c035 100644 --- a/elastic-metricbeat/templates/daemonset-node-metrics.yaml +++ b/elastic-metricbeat/templates/daemonset-node-metrics.yaml @@ -78,6 +78,9 @@ kind: DaemonSet metadata: name: metricbeat-node-modules spec: + selector: + matchLabels: +{{ tuple $envAll "metricbeat" "daemon" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} {{ tuple $envAll "metricbeat" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: @@ -89,6 +92,12 @@ spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet serviceAccountName: {{ $serviceAccountName }} +{{ if $envAll.Values.pod.tolerations.metricbeat.enabled }} +{{ tuple $envAll "metricbeat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ else }} + nodeSelector: + {{ .Values.labels.metricbeat.node_selector_key }}: {{ .Values.labels.metricbeat.node_selector_value | quote }} +{{ end }} initContainers: {{ tuple $envAll "metricbeat" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/elastic-metricbeat/values.yaml b/elastic-metricbeat/values.yaml index e10bc938e..fdaa11de1 100644 --- a/elastic-metricbeat/values.yaml +++ b/elastic-metricbeat/values.yaml @@ -230,6 +230,14 @@ pod: requests: memory: '100Mi' cpu: '100m' + tolerations: + metricbeat: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + - key: node-role.kubernetes.io/node + operator: Exists mounts: metricbeat: metricbeat: