Skip to content

Telgraf Helm Chart does create Service config for snmp_trap plugin #709

Open
@mwmahlberg

Description

@mwmahlberg

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:

{{- 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions