Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions filebeat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ helm install --name filebeat elastic/filebeat --set imageTag=7.4.0
| `extraVolumeMounts` | Templatable string of additional volumeMounts to be passed to the `tpl` function | `""` |
| `extraVolumes` | Templatable string of additional volumes to be passed to the `tpl` function | `""` |
| `hostPathRoot` | Fully-qualified [hostPath](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) that will be used to persist Filebeat registry data | `/var/lib` |
| `hostNetworking` | Use host networking in the daemonset so that hostname is reported correctly
| `image` | The Filebeat docker image | `docker.elastic.co/beats/filebeat` |
| `imageTag` | The Filebeat docker image tag | `7.4.0` |
| `imagePullPolicy` | The Kubernetes [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images) value | `IfNotPresent` |
Expand Down
8 changes: 8 additions & 0 deletions filebeat/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
{{- end }}
serviceAccountName: {{ template "serviceAccount" . }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod }}
{{- if .Values.hostNetworking }}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
volumes:
{{- range .Values.secretMounts }}
- name: {{ .name }}
Expand Down Expand Up @@ -111,6 +115,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 8 }}
{{- end }}
Expand Down
15 changes: 14 additions & 1 deletion filebeat/tests/filebeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../../helpers'))
from helpers import helm_template
import yaml

project = 'filebeat'
name = 'release-name-' + project
Expand Down Expand Up @@ -86,6 +85,20 @@ def test_override_the_default_update_strategy():
r = helm_template(config)
assert r['daemonset'][name]['spec']['updateStrategy']['type'] == 'OnDelete'


def test_host_networking():
config = '''
hostNetworking: true
'''
r = helm_template(config)
assert r['daemonset'][name]['spec']['template']['spec']['hostNetwork'] is True
config = '''
hostNetworking: false
'''
r = helm_template(config)
assert 'hostNetwork' not in r['daemonset'][name]['spec']['template']['spec']


def test_setting_a_custom_service_account():
config = '''
serviceAccount: notdefault
Expand Down
3 changes: 2 additions & 1 deletion filebeat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ filebeatConfig:
in_cluster: true

output.elasticsearch:
host: '${NODE_NAME}'
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'

# Extra environment variables to append to the DaemonSet pod spec.
Expand All @@ -32,7 +33,7 @@ extraVolumes: ""

# Root directory where Filebeat will write data to in order to persist registry data across pod restarts (file position and other metadata).
hostPathRoot: /var/lib

hostNetworking: true
image: "docker.elastic.co/beats/filebeat"
imageTag: "7.4.0"
imagePullPolicy: "IfNotPresent"
Expand Down