From e908cc5c0cd67183420876ea9e741b707dcf532f Mon Sep 17 00:00:00 2001 From: Mike Robinet Date: Thu, 3 Jan 2019 11:13:48 -0600 Subject: [PATCH] [stable/sumlogic-fluentd] Supply collector URL via existing secret (#9583) Signed-off-by: Mike Robinet --- stable/sumologic-fluentd/Chart.yaml | 2 +- stable/sumologic-fluentd/README.md | 7 ++++--- stable/sumologic-fluentd/templates/NOTES.txt | 8 ++++---- stable/sumologic-fluentd/templates/daemonset.yaml | 8 ++++++-- stable/sumologic-fluentd/templates/secrets.yaml | 2 ++ stable/sumologic-fluentd/values.yaml | 5 ++++- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/stable/sumologic-fluentd/Chart.yaml b/stable/sumologic-fluentd/Chart.yaml index e00e20c9b5..f223318978 100755 --- a/stable/sumologic-fluentd/Chart.yaml +++ b/stable/sumologic-fluentd/Chart.yaml @@ -1,5 +1,5 @@ name: sumologic-fluentd -version: 0.8.1 +version: 0.8.2 appVersion: 2.1.0 description: Sumologic Log Collector keywords: diff --git a/stable/sumologic-fluentd/README.md b/stable/sumologic-fluentd/README.md index 3523ec34fb..290ff28022 100644 --- a/stable/sumologic-fluentd/README.md +++ b/stable/sumologic-fluentd/README.md @@ -62,7 +62,8 @@ The following table lists the configurable parameters of the sumologic-fluentd c | `podAnnotations` | Annotations to add to the DaemonSet's Pods | `{}` | | `tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | `[]` | | `updateStrategy` | `OnDelete` or `RollingUpdate` (requires Kubernetes >= 1.6) | `OnDelete` | -| `sumologic.collectorUrl` | An HTTP collector in SumoLogic that the container can send logs to via HTTP | `Nil` You must provide your own | +| `sumologic.collectorUrl` | An HTTP collector in SumoLogic that the container can send logs to via HTTP | `Nil` You must provide your own value | +| `sumologic.collectorUrlExistingSecret` | If set, use the secret with the name provided instead of creating a new one | `Nil` You must reference an existing secret | | `sumologic.fluentdSource` | The fluentd input source, `file` or `systemd` | `file` | | `sumologic.fluentdUserConfigDir` | A directory of user-defined fluentd configuration files, which must be in the `*.conf` directory in the container | `/fluentd/conf.d/user` | | `sumologic.flushInterval` | How frequently to push logs to sumo, in seconds | `5` | @@ -169,12 +170,12 @@ $ helm install --name my-release stable/sumologic-fluentd --set rbac.create=true ### Excluding and Including data -You have several options controlling the filtering of data that gets sent to Sumo Logic. +You have several options controlling the filtering of data that gets sent to Sumo Logic. #### Excluding data using environment variables There are several environment variables that can exclude data. The following table show which environment variables affect which Fluentd sources. - + | Environment Variable | Containers | Docker | Kubernetes | Systemd | |----------------------|------------|--------|------------|---------| | `EXCLUDE_CONTAINER_REGEX` | ✔ | ✘ | ✘ | ✘ | diff --git a/stable/sumologic-fluentd/templates/NOTES.txt b/stable/sumologic-fluentd/templates/NOTES.txt index c62a9a6bd0..9b51a00c1b 100644 --- a/stable/sumologic-fluentd/templates/NOTES.txt +++ b/stable/sumologic-fluentd/templates/NOTES.txt @@ -1,4 +1,4 @@ -{{- if .Values.sumologic.collectorUrl -}} +{{- if (or (.Values.sumologic.collectorUrlExistingSecret) (.Values.sumologic.collectorUrl)) -}} Sumo Logic agents are spinning up on each node in your cluster. After a few minutes, you should see logs available in Sumo Logic. @@ -14,9 +14,9 @@ SumoLogic. sumologic.com/exclude: "true" {{- else -}} -########################################################### -#### ERROR: You did not set a sumologic.collectorUrl #### -########################################################### +################################################################################################# +#### ERROR: You did not set sumologic.collectorUrl or sumologic.collectorUrlExistingSecret #### +################################################################################################# This deployment will be incomplete until you provide your collector URL, from Sumo Logic. diff --git a/stable/sumologic-fluentd/templates/daemonset.yaml b/stable/sumologic-fluentd/templates/daemonset.yaml index f950a6a7b5..0e4a51cefe 100644 --- a/stable/sumologic-fluentd/templates/daemonset.yaml +++ b/stable/sumologic-fluentd/templates/daemonset.yaml @@ -1,4 +1,4 @@ -{{- if .Values.sumologic.collectorUrl -}} +{{- if (or (.Values.sumologic.collectorUrlExistingSecret) (.Values.sumologic.collectorUrl)) -}} # Sumologic collector URL is required apiVersion: extensions/v1beta1 kind: DaemonSet @@ -52,14 +52,18 @@ spec: {{- else }} - name: fluentd-user-conf mountPath: /fluentd/conf.d/user - readOnly: true + readOnly: true {{- end }} {{- end }} env: - name: COLLECTOR_URL valueFrom: secretKeyRef: + {{- if .Values.sumologic.collectorUrlExistingSecret }} + name: "{{ .Values.sumologic.collectorUrlExistingSecret }}" + {{- else }} name: "{{ template "sumologic-fluentd.fullname" . }}" + {{- end }} key: collector-url - name: K8S_NODE_NAME valueFrom: diff --git a/stable/sumologic-fluentd/templates/secrets.yaml b/stable/sumologic-fluentd/templates/secrets.yaml index 915a660226..38900e912e 100644 --- a/stable/sumologic-fluentd/templates/secrets.yaml +++ b/stable/sumologic-fluentd/templates/secrets.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.sumologic.collectorUrlExistingSecret -}} apiVersion: v1 kind: Secret metadata: @@ -13,3 +14,4 @@ metadata: type: Opaque data: collector-url: {{ default "MISSING" .Values.sumologic.collectorUrl | b64enc | quote }} +{{- end }} diff --git a/stable/sumologic-fluentd/values.yaml b/stable/sumologic-fluentd/values.yaml index 494598d1ec..14b700f2fd 100644 --- a/stable/sumologic-fluentd/values.yaml +++ b/stable/sumologic-fluentd/values.yaml @@ -21,7 +21,10 @@ updateStrategy: OnDelete sumologic: ## You'll need to set this to sumo collector, before the agent will run. ## ref: https://github.com/SumoLogic/fluentd-kubernetes-sumologic#sumologic - collectorUrl: "" + # collectorUrl: + + ## Use existing Secret which stores collector url instead of creating a new one + # collectorUrlExistingSecret: ## The source of fluentd logs, either file or systemd fluentdSource: file