From 43f391dfa321ebffb8055a9e64c92ad4322984bd Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Wed, 6 Nov 2019 11:42:46 +0000 Subject: [PATCH 1/4] Implement new features - Allow defining custom containerPorts in both the forwarders and the aggregators - Add services for the forwarders and the aggregator - Allow exposing custom ports in the services - Add an option to deploy only the aggregator Signed-off-by: Alejandro Moreno --- bitnami/fluentd/Chart.yaml | 2 +- bitnami/fluentd/README.md | 15 +++ bitnami/fluentd/templates/NOTES.txt | 11 +- .../templates/aggregator-configmap.yaml | 4 +- .../templates/aggregator-statefulset.yaml | 8 +- bitnami/fluentd/templates/aggregator-svc.yaml | 32 +++++ .../templates/forwarder-configmap.yaml | 2 +- .../templates/forwarder-daemonset.yaml | 8 +- bitnami/fluentd/templates/forwarder-svc.yaml | 32 +++++ .../templates/{svc.yaml => metrics-svc.yaml} | 2 +- bitnami/fluentd/templates/svc-headless.yaml | 9 +- bitnami/fluentd/values-production.yaml | 112 +++++++++++++++++- bitnami/fluentd/values.yaml | 112 +++++++++++++++++- 13 files changed, 331 insertions(+), 18 deletions(-) create mode 100644 bitnami/fluentd/templates/aggregator-svc.yaml create mode 100644 bitnami/fluentd/templates/forwarder-svc.yaml rename bitnami/fluentd/templates/{svc.yaml => metrics-svc.yaml} (92%) diff --git a/bitnami/fluentd/Chart.yaml b/bitnami/fluentd/Chart.yaml index 345c485d7..3874db85a 100644 --- a/bitnami/fluentd/Chart.yaml +++ b/bitnami/fluentd/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: fluentd -version: 0.2.0 +version: 0.3.0 appVersion: 1.7.4 description: Fluentd is an open source data collector for unified logging layer keywords: diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md index 28873b350..8310a2836 100644 --- a/bitnami/fluentd/README.md +++ b/bitnami/fluentd/README.md @@ -60,10 +60,18 @@ The following tables lists the configurable parameters of the kibana chart and t | `nameOverride` | String to partially override fluentd.fullname template with a string (will prepend the release name) | `nil` | | `fullnameOverride` | String to fully override fluentd.fullname template with a string | `nil` | | `clusterDomain` | Kubernetes DNS domain name to use | `cluster.local` | +| `forwarder.enabled` | Enable Fluentd aggregator | `true` | | `forwarder.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | | `forwarder.configMap` | Name of the config map that contains the Fluentd configuration files | `nil` | | `forwarder.extraArgs` | Extra arguments for the Fluentd command line | `nil` | | `forwarder.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `forwarder.containerPorts` | Ports the forwarder containers will listen on | `Check values.yaml` | +| `forwarder.service.type` | Kubernetes service type (`ClusterIP`, `NodePort`, or `LoadBalancer`) for the forwarders | `ClusterIP` | +| `forwarder.service.ports` | Array containing the forwarder service ports | `Check values.yaml file` | +| `forwarder.service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | +| `forwarder.service.loadBalancerSourceRanges` | Addresses that are allowed when service is LoadBalancer | `[]` | +| `forwarder.service.clusterIP` | Static clusterIP or None for headless services | `nil` | +| `forwarder.service.annotations` | Annotations for the forwarder service | `{}` | | `forwarder.livenessProbe.enabled` | Enable liveness probes for the forwarder | `true` | | `forwarder.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | | `forwarder.livenessProbe.periodSeconds` | How often to perform the probe | `10` | @@ -89,6 +97,13 @@ The following tables lists the configurable parameters of the kibana chart and t | `aggregator.port` | Kubernetes Service port - Fluentd transport port for the aggregators | `24224` | | `aggregator.extraArgs` | Extra arguments for the Fluentd command line | `nil` | | `aggregator.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `aggregator.containerPorts` | Ports the aggregator containers will listen on | `Check values.yaml` | +| `aggregator.service.type` | Kubernetes service type (`ClusterIP`, `NodePort`, or `LoadBalancer`) for the aggregators | `ClusterIP` | +| `aggregator.service.ports` | Array containing the aggregator service ports | `Check values.yaml file` | +| `aggregator.service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | +| `aggregator.service.loadBalancerSourceRanges` | Addresses that are allowed when service is LoadBalancer | `[]` | +| `aggregator.service.clusterIP` | Static clusterIP or None for headless services | `nil` | +| `aggregator.service.annotations` | Annotations for the aggregator service | `{}` | | `aggregator.livenessProbe.enabled` | Enable liveness probes for the aggregator | `true` | | `aggregator.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | | `aggregator.livenessProbe.periodSeconds` | How often to perform the probe | `10` | diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt index b1a9837a8..302f8c213 100644 --- a/bitnami/fluentd/templates/NOTES.txt +++ b/bitnami/fluentd/templates/NOTES.txt @@ -3,15 +3,22 @@ To verify that Fluentd has started, run: kubectl get all -l "app.kubernetes.io/name={{ include "fluentd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -{{ if and .Values.aggregator.enabled (not .Values.aggregator.configMap) }} +{{ if and .Values.aggregator.enabled .Values.forwarder.enabled (not .Values.aggregator.configMap) }} Logs are captured on each node by the forwarder pods and then sent to the aggregator pods. By default, the aggregator pods send the logs to the standard output. You can see all the logs by running this command: kubectl logs -l "app.kubernetes.io/component=aggregator" You can mount your own configuration files to the aggregators and the forwarders. For example, this is useful if you want to forward the aggregated logs to Elasticsearch or another service. +{{- else if and .Values.aggregator.enabled (not .Values.forwarder.enabled) }} + You have deployed Fluentd in aggregator-only mode. Logs received by the aggregator will be thrown to the standard output by default. + You can see all the logs by running this command: + + kubectl logs -l "app.kubernetes.io/component=aggregator" + + You can mount your own configuration files to the aggregators. For example, this is useful if you want to forward the logs to Elasticsearch or another service. {{- else if and (not .Values.aggregator.enabled) (not .Values.forwarder.configMap) }} - Logs are captured on each node by the forwarder pods and sent to the standard output + Logs are captured on each node by the forwarder pods and sent to the standard output by default. You can see all the logs by running this command: kubectl logs -l "app.kubernetes.io/component=forwarder" diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml index 5c5868936..885e3b99a 100644 --- a/bitnami/fluentd/templates/aggregator-configmap.yaml +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -37,12 +37,14 @@ data: @type null - # TCP input to receive logs from the forwarders + # TCP input to receive logs from + {{- if and .Values.aggregator.port }} @type forward bind 0.0.0.0 port {{ .Values.aggregator.port }} + {{- end }} # HTTP input for the liveness and readiness probes diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 05096b734..611b8b878 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -41,12 +41,14 @@ spec: {{- toYaml .Values.aggregator.extraEnv | nindent 12 }} {{- end }} ports: - - name: http - containerPort: 9880 - protocol: TCP + {{- if .Values.aggregator.port }} - name: tcp containerPort: {{ .Values.aggregator.port }} protocol: TCP + {{- end }} + {{- if .Values.aggregator.containerPorts }} + {{- toYaml .Values.aggregator.containerPorts | nindent 8 }} + {{- end }} {{- if .Values.metrics.enabled }} - name: metrics containerPort: {{ .Values.metrics.service.port }} diff --git a/bitnami/fluentd/templates/aggregator-svc.yaml b/bitnami/fluentd/templates/aggregator-svc.yaml new file mode 100644 index 000000000..5984c9b1a --- /dev/null +++ b/bitnami/fluentd/templates/aggregator-svc.yaml @@ -0,0 +1,32 @@ +{{- if .Values.aggregator.service.ports }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "fluentd.fullname" . }}-aggregator + labels: {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: aggregator + {{- if .Values.aggregator.service.annotations }} + annotations: {{- tpl (toYaml .Values.aggregator.service.annotations) $ | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.aggregator.service.type }} + {{- if and .Values.aggregator.service.loadBalancerIP (eq .Values.aggregator.service.type "LoadBalancer") }} + loadBalancerIP: {{ .Values.aggregator.service.loadBalancerIP }} + {{- end }} + {{- if and .Values.aggregator.service.loadBalancerSourceRanges (eq .Values.aggregator.service.type "LoadBalancer") }} + loadBalancerSourceRanges: + {{- with .Values.aggregator.service.loadBalancerSourceRanges }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- if and (eq .Values.aggregator.service.type "ClusterIP") .Values.aggregator.service.clusterIP }} + clusterIP: {{ .Values.aggregator.service.clusterIP }} + {{- end }} + ports: + {{- range $key, $value := .Values.aggregator.service.ports }} + - name: {{ $key }} + {{ toYaml $value | nindent 6 }} + {{- end }} + selector: {{ include "fluentd.matchLabels" . | nindent 4 }} + app.kubernetes.io/component: aggregator +{{- end }} \ No newline at end of file diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 3fbf4c398..f45c0b0cd 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.forwarder.configMap -}} +{{- if and .Values.forwarder.enabled (not .Values.forwarder.configMap) -}} apiVersion: v1 kind: ConfigMap metadata: diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 48e2f9bb0..205feae0a 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -1,3 +1,4 @@ +{{- if .Values.forwarder.enabled }} apiVersion: apps/v1 kind: DaemonSet metadata: @@ -39,9 +40,9 @@ spec: {{- toYaml .Values.forwarder.extraEnv | nindent 8 }} {{- end }} ports: - - name: http - containerPort: 9880 - protocol: TCP + {{- if .Values.forwarder.containerPorts }} + {{- toYaml .Values.forwarder.containerPorts | nindent 8 }} + {{- end }} {{- if .Values.metrics.enabled }} - name: metrics containerPort: {{ .Values.metrics.service.port }} @@ -114,3 +115,4 @@ spec: {{- with .Values.forwarder.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} diff --git a/bitnami/fluentd/templates/forwarder-svc.yaml b/bitnami/fluentd/templates/forwarder-svc.yaml new file mode 100644 index 000000000..8e1415c4f --- /dev/null +++ b/bitnami/fluentd/templates/forwarder-svc.yaml @@ -0,0 +1,32 @@ +{{- if and .Values.forwarder.enabled .Values.forwarder.service.ports }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "fluentd.fullname" . }}-forwarder + labels: {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: forwarder + {{- if .Values.forwarder.service.annotations }} + annotations: {{- tpl (toYaml .Values.forwarder.service.annotations) $ | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.forwarder.service.type }} + {{- if and .Values.forwarder.service.loadBalancerIP (eq .Values.forwarder.service.type "LoadBalancer") }} + loadBalancerIP: {{ .Values.forwarder.service.loadBalancerIP }} + {{- end }} + {{- if and .Values.forwarder.service.loadBalancerSourceRanges (eq .Values.forwarder.service.type "LoadBalancer") }} + loadBalancerSourceRanges: + {{- with .Values.forwarder.service.loadBalancerSourceRanges }} + {{ toYaml . | nindent 4 }} + {{- end }} + {{- end }} + {{- if and (eq .Values.forwarder.service.type "ClusterIP") .Values.forwarder.service.clusterIP }} + clusterIP: {{ .Values.forwarder.service.clusterIP }} + {{- end }} + ports: + {{- range $key, $value := .Values.forwarder.service.ports }} + - name: {{ $key }} + {{ toYaml $value | nindent 6 }} + {{- end }} + selector: {{ include "fluentd.matchLabels" . | nindent 4 }} + app.kubernetes.io/component: forwarder +{{- end }} \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/metrics-svc.yaml similarity index 92% rename from bitnami/fluentd/templates/svc.yaml rename to bitnami/fluentd/templates/metrics-svc.yaml index 8243ab7aa..ad5a6251b 100644 --- a/bitnami/fluentd/templates/svc.yaml +++ b/bitnami/fluentd/templates/metrics-svc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "fluentd.fullname" . }} + name: {{ include "fluentd.fullname" . }}-metrics labels: {{- include "fluentd.labels" . | nindent 4 }} annotations: {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} spec: diff --git a/bitnami/fluentd/templates/svc-headless.yaml b/bitnami/fluentd/templates/svc-headless.yaml index e0822ed09..a64899a4c 100644 --- a/bitnami/fluentd/templates/svc-headless.yaml +++ b/bitnami/fluentd/templates/svc-headless.yaml @@ -1,4 +1,4 @@ -{{- if .Values.aggregator.enabled -}} +{{- if and .Values.aggregator.enabled .Values.aggregator.service.ports -}} apiVersion: v1 kind: Service metadata: @@ -9,9 +9,10 @@ spec: type: ClusterIP clusterIP: None ports: - - name: tcp - port: {{ .Values.aggregator.port }} - targetPort: tcp + {{- range $key, $value := .Values.aggregator.service.ports }} + - name: {{ $key }} + {{ toYaml $value | nindent 6 }} + {{- end }} selector: {{- include "fluentd.matchLabels" . | nindent 4 }} app.kubernetes.io/component: aggregator {{- end -}} diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml index e57dd763b..b941ef712 100644 --- a/bitnami/fluentd/values-production.yaml +++ b/bitnami/fluentd/values-production.yaml @@ -38,6 +38,7 @@ image: clusterDomain: cluster.local forwarder: + enabled: true ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory ## @@ -59,6 +60,68 @@ forwarder: ## extraEnv: {} + containerPorts: + - name: http + containerPort: 9880 + protocol: TCP + # - name: syslog-tcp + # containerPort: 5140 + # protocol: TCP + # - name: syslog-udp + # containerPort: 5140 + # protocol: UDP + # - name: tcp + # containerPort: 24224 + # protocol: TCP + + ## Service parameters + ## + service: + ## Service type + ## + type: ClusterIP + + ## Service ports + ## + ports: + # http: + # port: 9880 + # targetPort: http + # protocol: TCP + # syslog-udp: + # port: 5140 + # targetPort: syslog-udp + # protocol: UDP + # nodePort: 31514 + # syslog-tcp: + # port: 5140 + # targetPort: syslog-tcp + # protocol: TCP + # nodePort: 31514 + # tcp: + # port: 24224 + # targetPort: tcp + # protocol: TCP + + ## loadBalancerIP for the forwarders service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + # loadBalancerIP: + + ## Load Balancer sources + ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service + ## + # loadBalancerSourceRanges: + # - 10.10.10.0/24 + + ## Set the Cluster IP to use + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address + ## + # clusterIP: None + + ## Provide any additional annotations which may be required + ## + annotations: {} + ## Configure extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## @@ -133,7 +196,8 @@ aggregator: ## If not specified, one will be created by default # configMap: - ## Port which the forwarders will connect to to send the logs + ## Port the aggregator container will listen for logs. Leave it blank to ignore. + ## You can specify other ports in the aggregator.containerPorts parameter ## port: 24224 @@ -149,6 +213,52 @@ aggregator: ## extraEnv: {} + containerPorts: + # - name: my-port + # containerPort: 24222 + # protocol: TCP + - name: http + containerPort: 9880 + protocol: TCP + + ## Service parameters + ## + service: + ## Service type + ## + type: ClusterIP + + ## Service ports + ## + ports: + tcp: + port: 24224 + targetPort: tcp + protocol: TCP + # http: + # port: 9880 + # targetPort: http + # protocol: TCP + + ## loadBalancerIP for the forwarders service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + # loadBalancerIP: + + ## Load Balancer sources + ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service + ## + # loadBalancerSourceRanges: + # - 10.10.10.0/24 + + ## Set the Cluster IP to use + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address + ## + # clusterIP: None + + ## Provide any additional annotations which may be required + ## + annotations: {} + ## Configure extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 642bb6580..ab14857c8 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -38,6 +38,7 @@ image: clusterDomain: cluster.local forwarder: + enabled: true ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory ## @@ -59,6 +60,68 @@ forwarder: ## extraEnv: {} + containerPorts: + - name: http + containerPort: 9880 + protocol: TCP + # - name: syslog-tcp + # containerPort: 5140 + # protocol: TCP + # - name: syslog-udp + # containerPort: 5140 + # protocol: UDP + # - name: tcp + # containerPort: 24224 + # protocol: TCP + + ## Service parameters + ## + service: + ## Service type + ## + type: ClusterIP + + ## Service ports + ## + ports: + # http: + # port: 9880 + # targetPort: http + # protocol: TCP + # syslog-udp: + # port: 5140 + # targetPort: syslog-udp + # protocol: UDP + # nodePort: 31514 + # syslog-tcp: + # port: 5140 + # targetPort: syslog-tcp + # protocol: TCP + # nodePort: 31514 + # tcp: + # port: 24224 + # targetPort: tcp + # protocol: TCP + + ## loadBalancerIP for the forwarders service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + # loadBalancerIP: + + ## Load Balancer sources + ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service + ## + # loadBalancerSourceRanges: + # - 10.10.10.0/24 + + ## Set the Cluster IP to use + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address + ## + # clusterIP: None + + ## Provide any additional annotations which may be required + ## + annotations: {} + ## Configure extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## @@ -133,7 +196,8 @@ aggregator: ## If not specified, one will be created by default # configMap: - ## Port which the forwarders will connect to to send the logs + ## Port the aggregator container will listen for logs. Leave it blank to ignore. + ## You can specify other ports in the aggregator.containerPorts parameter ## port: 24224 @@ -149,6 +213,52 @@ aggregator: ## extraEnv: {} + containerPorts: + # - name: my-port + # containerPort: 24222 + # protocol: TCP + - name: http + containerPort: 9880 + protocol: TCP + + ## Service parameters + ## + service: + ## Service type + ## + type: ClusterIP + + ## Service ports + ## + ports: + tcp: + port: 24224 + targetPort: tcp + protocol: TCP + # http: + # port: 9880 + # targetPort: http + # protocol: TCP + + ## loadBalancerIP for the forwarders service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + # loadBalancerIP: + + ## Load Balancer sources + ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service + ## + # loadBalancerSourceRanges: + # - 10.10.10.0/24 + + ## Set the Cluster IP to use + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address + ## + # clusterIP: None + + ## Provide any additional annotations which may be required + ## + annotations: {} + ## Configure extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## From e15fdc43b1cf56a15950920ca3a96334ee003139 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Thu, 7 Nov 2019 15:51:02 +0000 Subject: [PATCH 2/4] Validate installation Signed-off-by: Alejandro Moreno --- bitnami/fluentd/templates/NOTES.txt | 1 + bitnami/fluentd/templates/_helpers.tpl | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt index 302f8c213..eea7a2aa3 100644 --- a/bitnami/fluentd/templates/NOTES.txt +++ b/bitnami/fluentd/templates/NOTES.txt @@ -26,4 +26,5 @@ You can mount your own configuration files to the forwarders. For example, this is useful if you want to forward the logs to Elasticsearch or another service. {{- end }} +{{- include "fluentd.validateValues" . }} {{- include "fluentd.checkRollingTags" . -}} diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index ce48d30f4..1d8a35ae8 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -114,6 +114,7 @@ Validate data */}} {{- define "fluentd.validateValues" -}} {{- $messages := list -}} +{{- $messages := append $messages (include "fluentd.validateValues.deployment" .) -}} {{- $messages := append $messages (include "fluentd.validateValues.rbac" .) -}} {{- $messages := without $messages "" -}} {{- $message := join "\n" $messages -}} @@ -122,6 +123,15 @@ Validate data {{- end -}} {{- end -}} +{{/* Validate values of Fluentd - forwarders and aggregators can't be disabled at the same time */}} +{{- define "fluentd.validateValues.deployment" -}} +{{- if and (not .Values.forwarder.enabled) (not .Values.aggregator.enabled) -}} +fluentd: + You have disabled both the forwarders and the aggregators. + Please enable at least one of them (--set forwarder.enabled=true) (--set aggregator.enabled=true) +{{- end -}} +{{- end -}} + {{/* Validate values of Fluentd - must create serviceAccount to create enable RBAC */}} {{- define "fluentd.validateValues.rbac" -}} {{- if and .Values.rbac.create (not .Values.serviceAccount.create) -}} From cd584a384d5b3bb22e8e678a2d727d6890e3799f Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Fri, 8 Nov 2019 11:45:35 +0000 Subject: [PATCH 3/4] Use helper for annotations Signed-off-by: Alejandro Moreno --- bitnami/fluentd/templates/_helpers.tpl | 13 +++++++++++++ .../fluentd/templates/aggregator-statefulset.yaml | 2 +- bitnami/fluentd/templates/aggregator-svc.yaml | 2 +- bitnami/fluentd/templates/forwarder-daemonset.yaml | 2 +- bitnami/fluentd/templates/forwarder-svc.yaml | 2 +- bitnami/fluentd/templates/metrics-svc.yaml | 2 +- bitnami/fluentd/values-production.yaml | 1 + bitnami/fluentd/values.yaml | 1 + 8 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index 1d8a35ae8..f72f6e33d 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -173,3 +173,16 @@ Get the certificates secret name. {{- printf "%s-tls" (include "fluentd.fullname" . ) -}} {{- end -}} {{- end -}} + +{{/* +Renders a value that contains template. +Usage: +{{ include "fluentd.tplValue" (dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "fluentd.tplValue" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 611b8b878..efce893d4 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -19,7 +19,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/aggregator-configmap.yaml") . | sha256sum }} {{- if .Values.aggregator.podAnnotations }} - {{- toYaml .Values.aggregator.podAnnotations | nindent 8 }} + {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.podAnnotations "context" $) | nindent 8 }} {{- end }} spec: {{- include "fluentd.imagePullSecrets" . | nindent 6 }} diff --git a/bitnami/fluentd/templates/aggregator-svc.yaml b/bitnami/fluentd/templates/aggregator-svc.yaml index 5984c9b1a..2c88c3067 100644 --- a/bitnami/fluentd/templates/aggregator-svc.yaml +++ b/bitnami/fluentd/templates/aggregator-svc.yaml @@ -6,7 +6,7 @@ metadata: labels: {{- include "fluentd.labels" . | nindent 4 }} app.kubernetes.io/component: aggregator {{- if .Values.aggregator.service.annotations }} - annotations: {{- tpl (toYaml .Values.aggregator.service.annotations) $ | nindent 4 }} + annotations: {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.service.annotations "context" $) | nindent 4 }} {{- end }} spec: type: {{ .Values.aggregator.service.type }} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 205feae0a..2f871f34b 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -17,7 +17,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/forwarder-configmap.yaml") . | sha256sum }} {{- if .Values.forwarder.podAnnotations }} - {{- toYaml .Values.forwarder.podAnnotations | nindent 8 }} + {{- include "fluentd.tplValue" (dict "value" .Values.forwarder.podAnnotations "context" $) | nindent 8 }} {{- end }} spec: {{- include "fluentd.imagePullSecrets" . | nindent 6 }} diff --git a/bitnami/fluentd/templates/forwarder-svc.yaml b/bitnami/fluentd/templates/forwarder-svc.yaml index 8e1415c4f..a47d37b80 100644 --- a/bitnami/fluentd/templates/forwarder-svc.yaml +++ b/bitnami/fluentd/templates/forwarder-svc.yaml @@ -6,7 +6,7 @@ metadata: labels: {{- include "fluentd.labels" . | nindent 4 }} app.kubernetes.io/component: forwarder {{- if .Values.forwarder.service.annotations }} - annotations: {{- tpl (toYaml .Values.forwarder.service.annotations) $ | nindent 4 }} + annotations: {{- include "fluentd.tplValue" (dict "value" .Values.forwarder.service.annotations "context" $) | nindent 4 }} {{- end }} spec: type: {{ .Values.forwarder.service.type }} diff --git a/bitnami/fluentd/templates/metrics-svc.yaml b/bitnami/fluentd/templates/metrics-svc.yaml index ad5a6251b..2b0c92f1d 100644 --- a/bitnami/fluentd/templates/metrics-svc.yaml +++ b/bitnami/fluentd/templates/metrics-svc.yaml @@ -4,7 +4,7 @@ kind: Service metadata: name: {{ include "fluentd.fullname" . }}-metrics labels: {{- include "fluentd.labels" . | nindent 4 }} - annotations: {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} + annotations: {{- include "fluentd.tplValue" (dict "value" .Values.metrics.service.annotations "context" $) | nindent 4 }} spec: type: {{ .Values.metrics.service.type }} {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }} diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml index b941ef712..fed7f2eeb 100644 --- a/bitnami/fluentd/values-production.yaml +++ b/bitnami/fluentd/values-production.yaml @@ -242,6 +242,7 @@ aggregator: ## loadBalancerIP for the forwarders service (optional, cloud specific) ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## # loadBalancerIP: ## Load Balancer sources diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index ab14857c8..8c1b3f45b 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -242,6 +242,7 @@ aggregator: ## loadBalancerIP for the forwarders service (optional, cloud specific) ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## # loadBalancerIP: ## Load Balancer sources From ff47b234e51642f18dec02a2b0cc865417799602 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Fri, 8 Nov 2019 11:47:39 +0000 Subject: [PATCH 4/4] Update image tags Signed-off-by: Alejandro Moreno --- bitnami/fluentd/values-production.yaml | 2 +- bitnami/fluentd/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml index fed7f2eeb..26cfdcfe2 100644 --- a/bitnami/fluentd/values-production.yaml +++ b/bitnami/fluentd/values-production.yaml @@ -13,7 +13,7 @@ global: {} image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.4-debian-9-r0 + tag: 1.7.4-debian-9-r9 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 8c1b3f45b..1278fee0f 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -13,7 +13,7 @@ global: {} image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.4-debian-9-r0 + tag: 1.7.4-debian-9-r9 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images