From 8b4b03bda0f6fbd5d5ec94687e3b0586f060a6d3 Mon Sep 17 00:00:00 2001 From: anthony_dugouchet Date: Mon, 8 Jul 2019 15:37:20 +0200 Subject: [PATCH] [filebeat] additionals labels --- filebeat/README.md | 1 + filebeat/templates/daemonset.yaml | 3 +++ filebeat/tests/filebeat_test.py | 8 ++++++++ filebeat/values.yaml | 3 +++ 4 files changed, 15 insertions(+) diff --git a/filebeat/README.md b/filebeat/README.md index fe547488c..2870336ce 100644 --- a/filebeat/README.md +++ b/filebeat/README.md @@ -55,6 +55,7 @@ helm install --name filebeat elastic/filebeat --version 7.2.0 --set imageTag=7.2 | `imagePullSecrets` | Configuration for [imagePullSecrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret) so that you can use a private registry for your image | `[]` | | `managedServiceAccount` | Whether the `serviceAccount` should be managed by this helm chart. Set this to `false` in order to manage your own service account and related roles. | `true` | | `podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all Filebeat pods | `{}` | +| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Filebeat pods | `{}` | | `podSecurityContext` | Configurable [podSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for Filebeat pod execution environment | `runAsUser: 0`
`privileged: false` | | `livenessProbe` | Parameters to pass to [liveness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) checks for values such as timeouts and thresholds. | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | | `readinessProbe` | Parameters to pass to [readiness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) checks for values such as timeouts and thresholds. | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | diff --git a/filebeat/templates/daemonset.yaml b/filebeat/templates/daemonset.yaml index ddb0fc4eb..69953df30 100644 --- a/filebeat/templates/daemonset.yaml +++ b/filebeat/templates/daemonset.yaml @@ -8,6 +8,9 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service | quote }} release: {{ .Release.Name | quote }} + {{- range $key, $value := .Values.labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: selector: matchLabels: diff --git a/filebeat/tests/filebeat_test.py b/filebeat/tests/filebeat_test.py index 1a80e6b22..00517e9c6 100644 --- a/filebeat/tests/filebeat_test.py +++ b/filebeat/tests/filebeat_test.py @@ -180,3 +180,11 @@ def test_adding_a_extra_volume_with_volume_mount(): assert {'name': 'extras', 'emptyDir': {}} in extraVolume extraVolumeMounts = r['daemonset'][name]['spec']['template']['spec']['containers'][0]['volumeMounts'] assert {'name': 'extras', 'mountPath': '/usr/share/extras', 'readOnly': True} in extraVolumeMounts + +def test_adding_pod_labels(): + config = ''' +labels: + app.kubernetes.io/name: filebeat +''' + r = helm_template(config) + assert r['daemonset'][name]['metadata']['labels']['app.kubernetes.io/name'] == 'filebeat' diff --git a/filebeat/values.yaml b/filebeat/values.yaml index 9bb996c57..9cf900692 100755 --- a/filebeat/values.yaml +++ b/filebeat/values.yaml @@ -53,6 +53,9 @@ readinessProbe: # Whether this chart should self-manage its service account, role, and associated role binding. managedServiceAccount: true +# additionals labels +labels: {} + podAnnotations: {} # iam.amazonaws.com/role: es-cluster