Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #339 from jmlrt/metricbeat-additional-labels
Browse files Browse the repository at this point in the history
[metricbeat] add pod labels
  • Loading branch information
jmlrt committed Oct 22, 2019
2 parents 88b12d3 + 84caed7 commit 38ec68f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions metricbeat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.4.0
| `imageTag` | The Metricbeat docker image tag | `7.4.0` |
| `imagePullPolicy` | The Kubernetes [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images) value | `IfNotPresent` |
| `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 | `[]` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Metricbeat pods | `{}` |
| `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` |
| `clusterRoleRules` | Configurable [cluster role rules](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole) that Metricbeat uses to access Kubernetes resources. | see [values.yaml](./values.yaml) |
| `podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all Metricbeat pods | `{}` |
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions metricbeat/tests/metricbeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,12 @@ def test_cluster_role_rules():
assert rules['apiGroups'][0] == 'someone'
assert rules['verbs'][0] == 'or'
assert rules['resources'][0] == 'something'


def test_adding_pod_labels():
config = '''
labels:
app.kubernetes.io/name: metricbeat
'''
r = helm_template(config)
assert r['daemonset'][name]['metadata']['labels']['app.kubernetes.io/name'] == 'metricbeat'
3 changes: 3 additions & 0 deletions metricbeat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ readinessProbe:
periodSeconds: 10
timeoutSeconds: 5

# additionals labels
labels: {}

# Whether this chart should self-manage its service account, role, and associated role binding.
managedServiceAccount: true

Expand Down

0 comments on commit 38ec68f

Please sign in to comment.