kiwigrid / helm-charts

Helm charts for Kubernetes curated by Kiwigrid
https://kiwigrid.github.io
MIT License
186 stars 209 forks source link

[fluentd-elasticsearch] Please make it possible to have fluentd listen on a hostPort. #273

Closed kreiger closed 4 years ago

kreiger commented 4 years ago

Is this a request for help?: No

Is this a BUG REPORT or FEATURE REQUEST? (choose one): Feature Request

Version of Helm and Kubernetes: Helm v2.16.1 Kubernetes v1.17.0

Which chart in which version: fluentd-elasticsearch-6.1.0

What you expected to happen: Instead of creating a service, i'd like to be able to have the fluentd pods in the DaemonSet listening on the same port on every node, using hostPort in the pod template spec.

I've implemented it like this for myself, by adding service.ports[].hostPort:

$ git diff
diff --git a/charts/fluentd-elasticsearch/templates/daemonset.yaml b/charts/fluentd-elasticsearch/templates/daemonset.yaml
index 7fdcc80..3ef82aa 100644
--- a/charts/fluentd-elasticsearch/templates/daemonset.yaml
+++ b/charts/fluentd-elasticsearch/templates/daemonset.yaml
@@ -155,6 +155,9 @@ spec:
 {{- range $port := .Values.service.ports }}
           - name: {{ $port.name }}
             containerPort: {{ $port.port }}
+{{- if $port.hostPort }}
+            hostPort: {{ $port.hostPort }}
+{{- end }}
 {{- if $port.protocol }}
             protocol: {{ $port.protocol }}
 {{- end }}
diff --git a/charts/fluentd-elasticsearch/templates/service.yaml b/charts/fluentd-elasticsearch/templates/service.yaml
index 9bf2bae..d6026f6 100644
--- a/charts/fluentd-elasticsearch/templates/service.yaml
+++ b/charts/fluentd-elasticsearch/templates/service.yaml
@@ -1,6 +1,7 @@
 {{- if .Values.service }}
 {{- range $port := .Values.service.ports  }}
 {{- $service_type := $port.type | default "ClusterIP" }}
+{{- if or (ne $service_type "ClusterIP") (not $port.hostPort) }}
 ---
 apiVersion: v1
 kind: Service
@@ -29,3 +30,4 @@ spec:
     app.kubernetes.io/instance: {{ $.Release.Name }}
 {{- end }}
 {{- end }}
+{{- end }}
monotek commented 4 years ago

please create a pr.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.