diff --git a/filebeat/README.md b/filebeat/README.md
index fd755b3ed..478e8a757 100644
--- a/filebeat/README.md
+++ b/filebeat/README.md
@@ -81,6 +81,7 @@ helm install --name filebeat elastic/filebeat --set imageTag=7.4.1
| `affinity` | Configurable [affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) | `{}` |
| `priorityClassName` | The [name of the PriorityClass](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass). No default is supplied as the PriorityClass must be created first. | `""` |
| `updateStrategy` | The [updateStrategy](https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy) for the `DaemonSet`. By default Kubernetes will kill and recreate pods on updates. Setting this to `OnDelete` will require that pods be deleted manually. | `RollingUpdate` |
+| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
## Examples
diff --git a/filebeat/templates/_helpers.tpl b/filebeat/templates/_helpers.tpl
index 769546335..3c5ec7678 100755
--- a/filebeat/templates/_helpers.tpl
+++ b/filebeat/templates/_helpers.tpl
@@ -11,9 +11,13 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+{{- end -}}
{{/*
Use the fullname if the serviceAccount value is not set
diff --git a/filebeat/tests/filebeat_test.py b/filebeat/tests/filebeat_test.py
index 5bd288921..7e74f1029 100644
--- a/filebeat/tests/filebeat_test.py
+++ b/filebeat/tests/filebeat_test.py
@@ -39,7 +39,7 @@ def test_defaults():
assert {
'name': 'data',
'hostPath': {
- 'path': '/var/lib/release-name-filebeat-default-data',
+ 'path': '/var/lib/' + name + '-default-data',
'type': 'DirectoryOrCreate'
}
} in volumes
@@ -231,3 +231,22 @@ def test_priority_class_name():
r = helm_template(config)
priority_class_name = r['daemonset'][name]['spec']['template']['spec']['priorityClassName']
assert priority_class_name == "highest"
+
+def test_setting_fullnameOverride():
+ config = '''
+fullnameOverride: 'filebeat-custom'
+'''
+ r = helm_template(config)
+
+ custom_name = 'filebeat-custom'
+ assert custom_name in r['daemonset']
+ assert r['daemonset'][custom_name]['spec']['template']['spec']['containers'][0]['name'] == project
+ assert r['daemonset'][custom_name]['spec']['template']['spec']['serviceAccountName'] == name
+ volumes = r['daemonset'][custom_name]['spec']['template']['spec']['volumes']
+ assert {
+ 'name': 'data',
+ 'hostPath': {
+ 'path': '/var/lib/' + custom_name + '-default-data',
+ 'type': 'DirectoryOrCreate'
+ }
+ } in volumes
diff --git a/kibana/README.md b/kibana/README.md
index d7773ef38..593fb124c 100644
--- a/kibana/README.md
+++ b/kibana/README.md
@@ -82,6 +82,7 @@ helm install --name kibana elastic/kibana --set imageTag=7.4.1
| `service` | Configurable [service](https://kubernetes.io/docs/concepts/services-networking/service/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `type: ClusterIP`
`port: 5601`
`nodePort:`
`annotations: {}` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Kibana pods | `{}` |
| `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` |
+| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
## Examples
diff --git a/kibana/templates/_helpers.tpl b/kibana/templates/_helpers.tpl
index a5254f445..517c2daa2 100755
--- a/kibana/templates/_helpers.tpl
+++ b/kibana/templates/_helpers.tpl
@@ -11,9 +11,13 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
{{- $name := default .Release.Name .Values.nameOverride -}}
{{- printf "%s-%s" $name .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+{{- end -}}
{{/*
Return the appropriate apiVersion for ingress.
diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py
index de4ddb3a8..afc37e8fd 100644
--- a/kibana/tests/kibana_test.py
+++ b/kibana/tests/kibana_test.py
@@ -406,3 +406,16 @@ def test_adding_lifecycle_events():
d = r['deployment'][name]['spec']['template']['spec']
p = d['containers'][0]['lifecycle']['postStart']
assert p['exec']['command'][0] == '/bin/true'
+
+def test_setting_fullnameOverride():
+ config = '''
+fullnameOverride: 'kibana-custom'
+'''
+ r = helm_template(config)
+
+ custom_name = 'kibana-custom'
+ assert custom_name in r['deployment']
+ assert custom_name in r['service']
+
+ assert r['service'][custom_name]['spec']['ports'][0]['port'] == 5601
+ assert r['deployment'][custom_name]['spec']['template']['spec']['containers'][0]['name'] == 'kibana'
diff --git a/metricbeat/README.md b/metricbeat/README.md
index 661e2b386..15d2413e5 100644
--- a/metricbeat/README.md
+++ b/metricbeat/README.md
@@ -78,6 +78,7 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.4.1
| `affinity` | Configurable [affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) | `{}` |
| `updateStrategy` | The [updateStrategy](https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy) for the `DaemonSet`. By default Kubernetes will kill and recreate pods on updates. Setting this to `OnDelete` will require that pods be deleted manually. | `RollingUpdate` |
| `replicas` | The replica count for the metricbeat deployment talking to kube-state-metrics | `1` |
+| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
## Examples
diff --git a/metricbeat/templates/_helpers.tpl b/metricbeat/templates/_helpers.tpl
index 769546335..3c5ec7678 100755
--- a/metricbeat/templates/_helpers.tpl
+++ b/metricbeat/templates/_helpers.tpl
@@ -11,9 +11,13 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+{{- end -}}
{{/*
Use the fullname if the serviceAccount value is not set
diff --git a/metricbeat/tests/metricbeat_test.py b/metricbeat/tests/metricbeat_test.py
index 0b119d1c2..84dc55f23 100644
--- a/metricbeat/tests/metricbeat_test.py
+++ b/metricbeat/tests/metricbeat_test.py
@@ -239,3 +239,22 @@ def test_adding_pod_labels():
'''
r = helm_template(config)
assert r['daemonset'][name]['metadata']['labels']['app.kubernetes.io/name'] == 'metricbeat'
+
+def test_setting_fullnameOverride():
+ config = '''
+fullnameOverride: 'metricbeat-custom'
+'''
+ r = helm_template(config)
+
+ custom_name = 'metricbeat-custom'
+ assert custom_name in r['daemonset']
+ assert r['daemonset'][custom_name]['spec']['template']['spec']['containers'][0]['name'] == project
+ assert r['daemonset'][custom_name]['spec']['template']['spec']['serviceAccountName'] == name
+ volumes = r['daemonset'][custom_name]['spec']['template']['spec']['volumes']
+ assert {
+ 'name': 'data',
+ 'hostPath': {
+ 'path': '/var/lib/' + custom_name + '-default-data',
+ 'type': 'DirectoryOrCreate'
+ }
+ } in volumes