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

Adds logstash UDP service #1419

Closed
wants to merge 16 commits into from
Closed
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 @@ -147,6 +147,7 @@ useful for the [http input plugin][], for instance.
| `secretMounts` | Allows you easily mount a secret as a file inside the StatefulSet. Useful for mounting certificates and other secrets. See [values.yaml][] for an example | `[]` |
| `securityContext` | Allows you to set the [securityContext][] for the container | see [values.yaml][] |
| `service` | Configurable [service][] to expose the Logstash service. | see [values.yaml][] |
| `udpservice` | Configurable [udpservice][] to expose the Logstash service using UDP protocol. | see [values.yaml][] |
| `terminationGracePeriod` | The [terminationGracePeriod][] in seconds used when trying to stop the pod | `120` |
| `tolerations` | Configurable [tolerations][] | `[]` |
| `updateStrategy` | The [updateStrategy][] for the StatefulSet. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` |
Expand Down
2 changes: 1 addition & 1 deletion logstash/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1. Watch all cluster members come up.
$ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "logstash.fullname" . }} -w
$ kubectl get all --namespace={{ .Release.Namespace }} -l app={{ template "logstash.fullname" . }}
29 changes: 29 additions & 0 deletions logstash/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,32 @@ spec:
ports:
{{ toYaml .Values.service.ports | indent 4 }}
{{- end }}
---
{{- if .Values.udpservice.enabled -}}
kind: Service
apiVersion: v1
metadata:
name: "{{ template "logstash.fullname" . }}-udp"
labels:
app: "{{ template "logstash.fullname" . }}"
chart: "{{ .Chart.Name }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
spec:
type: {{ .Values.udpservice.type }}
{{- if .Values.udpservice.loadBalancerIP }}
loadBalancerIP: {{ .Values.udpservice.loadBalancerIP }}
{{- end }}
{{- with .Values.udpservice.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | indent 4 }}
{{- end }}
selector:
app: "{{ template "logstash.fullname" . }}"
chart: "{{ .Chart.Name }}"
release: {{ .Release.Name | quote }}
ports:
{{ toYaml .Values.udpservice.ports | indent 4 }}
{{- end }}
27 changes: 27 additions & 0 deletions logstash/tests/logstash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,33 @@ def test_adding_a_service():
assert "loadBalancerIP" not in s["spec"]


def test_adding_udp_service():
config = """
service:
annotations: {}
type: ClusterIP
ports:
- name: udp
port: 1234
protocol: UDP
targetPort: 1234
"""
r = helm_template(config)
s = r["service"][name]
assert s["metadata"]["name"] == name
assert s["metadata"]["annotations"] == {}
assert s["spec"]["type"] == "ClusterIP"
assert len(s["spec"]["ports"]) == 1
assert s["spec"]["ports"][0] == {
"name": "udp",
"port": 1234,
"protocol": "UDP",
"targetPort": 1234,
}
# Make sure that the default 'loadBalancerIP' string is empty
assert "loadBalancerIP" not in s["spec"]


def test_setting_fullnameOverride():
config = """
fullnameOverride: 'logstash-custom'
Expand Down
10 changes: 10 additions & 0 deletions logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@ service: {}
# protocol: TCP
# targetPort: 8080

udpservice:
enabled: false
annotations: {}
type: ClusterIP
ports:
- name: udp
port: 1234
protocol: UDP
targetPort: 1234

ingress:
enabled: false
className: "nginx"
Expand Down