diff --git a/logstash/README.md b/logstash/README.md
index 3b2a06934..cd14fff5b 100644
--- a/logstash/README.md
+++ b/logstash/README.md
@@ -73,6 +73,7 @@ helm install --name logstash elastic/logstash --set imageTag=7.6.0
| `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 | `[]` |
| `imageTag` | The Logstash docker image tag | `7.6.0` |
| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. | `9600` |
+| `extraPorts` | An array of extra ports to open on the pod | `[]` |
| `labels` | Configurable [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Logstash pods | `{}` |
| `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](https://github.com/elastic/helm-charts/tree/master/logstash/values.yaml) for an example of the formatting. | `{}` |
| `livenessProbe` | Configuration fields for the [livenessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) | `failureThreshold: 3`
`initialDelaySeconds: 300`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` |
diff --git a/logstash/templates/statefulset.yaml b/logstash/templates/statefulset.yaml
index f953ec890..6c9838d3a 100644
--- a/logstash/templates/statefulset.yaml
+++ b/logstash/templates/statefulset.yaml
@@ -150,6 +150,9 @@ spec:
ports:
- name: http
containerPort: {{ .Values.httpPort }}
+ {{- if .Values.extraPorts }}
+ {{- toYaml .Values.extraPorts | nindent 8 }}
+ {{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
env:
diff --git a/logstash/tests/logstash_test.py b/logstash/tests/logstash_test.py
index b37e22fe8..ed798a496 100755
--- a/logstash/tests/logstash_test.py
+++ b/logstash/tests/logstash_test.py
@@ -180,6 +180,19 @@ def test_adding_a_extra_container():
} in extraContainer
+def test_adding_a_extra_port():
+ config = """
+extraPorts:
+ - name: foo
+ containerPort: 30000
+"""
+ r = helm_template(config)
+ extraPorts = r["statefulset"][name]["spec"]["template"]["spec"]["containers"][0][
+ "ports"
+ ]
+ assert {"name": "foo", "containerPort": 30000,} in extraPorts
+
+
def test_adding_a_extra_init_container():
config = """
extraInitContainers: |
diff --git a/logstash/values.yaml b/logstash/values.yaml
index 498136a5d..434a2a261 100755
--- a/logstash/values.yaml
+++ b/logstash/values.yaml
@@ -124,6 +124,11 @@ podManagementPolicy: "Parallel"
httpPort: 9600
+# Custom ports to add to logstash
+extraPorts: []
+ # - name: beats
+ # containerPort: 5001
+
updateStrategy: RollingUpdate
# This is the max unavailable setting for the pod disruption budget