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

Update logstash chart to support custom ports #505

Merged
merged 3 commits into from
Mar 9, 2020
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 logstash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`<br>`initialDelaySeconds: 300`<br>`periodSeconds: 10`<br>`successThreshold: 3`<br>`timeoutSeconds: 5` |
Expand Down
3 changes: 3 additions & 0 deletions logstash/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions logstash/tests/logstash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 5 additions & 0 deletions logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down