-
Notifications
You must be signed in to change notification settings - Fork 339
Open
Description
When the input plugin snmp_trap
is used the helm chart does not render a service.
This is due to the fact that there is no special treatment defined for itin the service template, beginning from l22:
helm-charts/charts/telegraf/templates/service.yaml
Lines 22 to 93 in fe0d58b
{{- range $key, $value := . -}} | |
{{- $tp := typeOf $value -}} | |
{{- if eq $key "http_listener" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "http-listener" | |
{{- end }} | |
{{- if eq $key "influxdb_listener" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "influxdb-listener" | |
{{- end }} | |
{{- if eq $key "http_listener_v2" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "http-listener-v2" | |
{{- end }} | |
{{- if eq $key "influxdb_v2_listener" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "influxdb-v2-listener" | |
{{- end }} | |
{{- if eq $key "opentelemetry" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "opentelemetry" | |
{{- end }} | |
{{- if eq $key "statsd" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
protocol: "UDP" | |
name: "statsd" | |
{{- end }} | |
{{- if eq $key "tcp_listener" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "tcp-listener" | |
{{- end }} | |
{{- if eq $key "udp_listener" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
protocol: "UDP" | |
name: "udp-listener" | |
{{- end }} | |
{{- if eq $key "webhooks" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
name: "webhooks" | |
{{- end }} | |
{{- if eq $key "syslog" }} | |
{{- if regexMatch "^(tcp|udp).*" $value.server }} | |
- port: {{ regexFind "[0-9]+$" $value.server | int64 }} | |
targetPort: {{ regexFind "[0-9]+$" $value.server | int64 }} | |
protocol: {{ upper (substr 0 3 $value.server) }} | |
name: "syslog" | |
{{- end }} | |
{{- end }} | |
{{- if eq $key "socket_listener" }} | |
{{- if or (hasPrefix "udp" $value.service_address) (hasPrefix "tcp" $value.service_address) }} | |
- port: {{ regexFind "[0-9]+$" $value.service_address | int64 }} | |
targetPort: {{ regexFind "[0-9]+$" $value.service_address | int64 }} | |
protocol: {{ upper (substr 0 3 $value.service_address) }} | |
name: {{ printf "%s-%s" "socket-listener" (regexFind "[0-9]+$" $value.service_address) }} | |
{{- end }} | |
{{- end }} | |
{{- if eq $key "cisco_telemetry_mdt" }} | |
- port: {{ trimPrefix ":" $value.service_address | int64 }} | |
targetPort: {{ trimPrefix ":" $value.service_address | int64 }} | |
protocol: "TCP" | |
name: "cisco-telemetry-mdt" | |
{{- end }} | |
{{- end -}} |
The result is that while telegraf listens on the SNMP traps within the pod, the listener is not accessible from the outside.
Metadata
Metadata
Assignees
Labels
No labels