From 8488ad18bd7706155ed7370ee48118596e6ecba3 Mon Sep 17 00:00:00 2001 From: arthurvanduynhoven Date: Fri, 26 Apr 2019 12:54:26 +0200 Subject: [PATCH] Fluentd - Allow ingress path to be configurable (#12561) Signed-off-by: Arthur Van Duynhoven --- stable/fluentd/Chart.yaml | 2 +- stable/fluentd/README.md | 7 ++++-- stable/fluentd/templates/ingress.yaml | 24 +++++++++++-------- stable/fluentd/templates/service.yaml | 2 +- stable/fluentd/values.yaml | 34 +++++++++++++++------------ 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/stable/fluentd/Chart.yaml b/stable/fluentd/Chart.yaml index 1c1dd676b2..39923c5e43 100644 --- a/stable/fluentd/Chart.yaml +++ b/stable/fluentd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: A Fluentd Elasticsearch Helm chart for Kubernetes. icon: https://raw.githubusercontent.com/fluent/fluentd-docs/master/public/logo/Fluentd_square.png name: fluentd -version: 1.7.0 +version: 1.8.0 appVersion: v2.4.0 home: https://www.fluentd.org/ sources: diff --git a/stable/fluentd/README.md b/stable/fluentd/README.md index 9b310fc24d..445d3091f2 100644 --- a/stable/fluentd/README.md +++ b/stable/fluentd/README.md @@ -46,17 +46,20 @@ Parameter | Description | Default `output.sslVersion` | output ssl version | `TLSv1` `output.buffer_chunk_limit` | output buffer chunk limit | `2M` `output.buffer_queue_limit` | output buffer queue limit | `8` -`service.type` | type of service | `ClusterIP` `image.pullPolicy` | Image pull policy | `IfNotPresent` `image.repository` | Image repository | `gcr.io/google-containers/fluentd-elasticsearch` `image.tag` | Image tag | `v2.4.0` `imagePullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) `ingress.enabled` | enable ingress | `false` +`ingress.labels` | list of labels for the ingress rule | See [values.yaml](values.yaml) +`ingress.annotations` | list of annotations for the ingress rule | `kubernetes.io/ingress.class: nginx` See [values.yaml](values.yaml) +`ingress.hosts` | host definition for ingress | See [values.yaml](values.yaml) +`ingress.tls` | tls rules for ingress | See [values.yaml](values.yaml) `nodeSelector` | node labels for pod assignment | `{}` `replicaCount` | desired number of pods | `1` ??? `resources` | pod resource requests & limits | `{}` `priorityClassName` | priorityClassName | `nil` -`service.port` | port for the service | `80` +`service.ports` | port definition for the service | See [values.yaml](values.yaml) `service.type` | type of service | `ClusterIP` `tolerations` | List of node taints to tolerate | `[]` `persistence.enabled` | Enable buffer persistence | `false` diff --git a/stable/fluentd/templates/ingress.yaml b/stable/fluentd/templates/ingress.yaml index fe1818966f..4ed58913c2 100644 --- a/stable/fluentd/templates/ingress.yaml +++ b/stable/fluentd/templates/ingress.yaml @@ -1,32 +1,36 @@ {{- if .Values.ingress.enabled -}} {{- $serviceName := include "fluentd.fullname" . -}} -{{- $servicePort := .Values.service.externalPort -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ template "fluentd.fullname" . }} labels: app: {{ template "fluentd.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + chart: {{ template "fluentd.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} +{{- if .Values.ingress.labels }} +{{ toYaml .Values.ingress.labels | indent 4 }} +{{- end }} +{{- if .Values.ingress.annotations }} annotations: - {{- range $key, $value := .Values.ingress.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} +{{ tpl ( toYaml .Values.ingress.annotations | indent 4 ) . }} +{{- end }} spec: rules: {{- range $host := .Values.ingress.hosts }} - - host: {{ $host.name }} - http: + - http: paths: - - path: / + - path: {{ $host.path | default "/" }} backend: - serviceName: {{ $host.serviceName }} + serviceName: {{ $serviceName }} servicePort: {{ $host.servicePort }} + {{- if (not (empty $host.name)) }} + host: {{ $host.name }} + {{- end -}} {{- end -}} {{- if .Values.ingress.tls }} tls: {{ toYaml .Values.ingress.tls | indent 4 }} {{- end -}} -{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/fluentd/templates/service.yaml b/stable/fluentd/templates/service.yaml index c57d7e0d22..ad75e1518d 100644 --- a/stable/fluentd/templates/service.yaml +++ b/stable/fluentd/templates/service.yaml @@ -4,7 +4,7 @@ metadata: name: {{ template "fluentd.fullname" . }} labels: app: {{ template "fluentd.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + chart: {{ template "fluentd.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: diff --git a/stable/fluentd/values.yaml b/stable/fluentd/values.yaml index cbaa6f0380..ba92bc6cf8 100644 --- a/stable/fluentd/values.yaml +++ b/stable/fluentd/values.yaml @@ -21,8 +21,9 @@ env: {} service: type: ClusterIP - # type: nodePort: - externalPort: 80 + # type: NodePort + # nodePort: + # Used to create Service records ports: - name: "monitor-agent" protocol: TCP @@ -34,20 +35,23 @@ annotations: {} ingress: enabled: false - # Used to create an Ingress and Service record. - # hosts: - # - name: "http-input.local" - # protocol: TCP - # serviceName: http-input - # servicePort: 9880 annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - tls: - # Secrets must be manually created in the namespace. - # - secretName: http-input-tls - # hosts: - # - http-input.local + kubernetes.io/ingress.class: nginx +# kubernetes.io/tls-acme: "true" +# # Depending on which version of ingress controller you may need to configure properly - https://kubernetes.github.io/ingress-nginx/examples/rewrite/#rewrite-target +# nginx.ingress.kubernetes.io/rewrite-target: / + labels: [] + # If doing TCP or UDP ingress rule don't forget to update your Ingress Controller to accept TCP connections - https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/ + hosts: +# - name: "http-input.local" +# protocol: TCP +# servicePort: 9880 +# path: / + tls: {} + # Secrets must be manually created in the namespace. +# - secretName: http-input-tls +# hosts: +# - http-input.local configMaps: general.conf: |