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

Commit

Permalink
Merge pull request #505 from ChiefAlexander/master
Browse files Browse the repository at this point in the history
Update logstash chart to support custom ports
  • Loading branch information
jmlrt committed Mar 9, 2020
2 parents a0749c3 + 3f87ed9 commit a0e8d77
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
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.1
| `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.1` |
| `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 @@ -125,6 +125,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

0 comments on commit a0e8d77

Please sign in to comment.