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

[filebeat] Add extraInitContainers to filebeat chart #466

Merged
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 @@ -60,6 +60,7 @@ helm install --name filebeat elastic/filebeat --set imageTag=7.5.2
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| `filebeatConfig` | Allows you to add any config files in `/usr/share/filebeat` such as `filebeat.yml`. See [values.yaml](https://github.com/elastic/helm-charts/tree/master/filebeat/values.yaml) for an example of the formatting with the default configuration. | see [values.yaml](https://github.com/elastic/helm-charts/tree/master/filebeat/values.yaml) |
| `extraEnvs` | Extra [environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config) which will be appended to the `env:` definition for the container | `[]` |
| `extraInitContainers` | List of additional init containers to be added at the Daemonset | `[]` |
| `extraVolumeMounts` | List of additional volumeMounts to be mounted on the Daemonset | `[]` |
| `extraVolumes` | List of additional volumes to be mounted on the Daemonset | `[]` |
| `envFrom` | Templatable string of envFrom to be passed to the [environment from variables](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables) which will be appended to the `envFrom:` definition for the container | `[]` |
Expand Down
4 changes: 4 additions & 0 deletions filebeat/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.extraInitContainers }}
initContainers:
{{ toYaml .Values.extraInitContainers | indent 8 }}
{{- end }}
containers:
- name: "filebeat"
Expand Down
11 changes: 11 additions & 0 deletions filebeat/tests/filebeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ def test_adding_envs():
envs = r['daemonset'][name]['spec']['template']['spec']['containers'][0]['env']
assert {'name': 'LOG_LEVEL', 'value': 'DEBUG'} in envs

def test_adding_init_containers():
config = '''
extraInitContainers:
- name: dummy-init
image: busybox
command: ['echo', 'hey']
'''
r = helm_template(config)
initContainers = r['daemonset'][name]['spec']['template']['spec']['initContainers']
assert {'name': 'dummy-init', 'image': 'busybox', 'command': ['echo', 'hey']} in initContainers


def test_adding_image_pull_secrets():
config = '''
Expand Down
5 changes: 5 additions & 0 deletions filebeat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ extraVolumes: []
# - name: extras
# emptyDir: {}

extraInitContainers: []
# - name: dummy-init
# image: busybox
# command: ['echo', 'hey']

envFrom: []
# - configMapRef:
# name: configmap-name
Expand Down