Skip to content

Commit

Permalink
Fixes #18
Browse files Browse the repository at this point in the history
Env vars can be passed to the fluentd container using extraEnv map.
Helm would create a secret and mount the values from it.
  • Loading branch information
jvassev committed Jul 5, 2018
1 parent c4d1523 commit 14bf14f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ Flags:
| `fluentdResources` | Resource definitions for the fluentd container | `{}`|
| `reloaderResources` | Resource definitions for the reloader container | `{}` |
| `tolerations` | Pod tolerations | `[]` |
| `extraEnv` | Extra env vars to pass to fluentd | `{}` |

## Cookbook

Expand Down
2 changes: 1 addition & 1 deletion log-router/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
apiVersion: v1
description: Distribution of Fluentd as K8S daemonset
name: log-router
version: 0.2.2
version: 0.2.3
4 changes: 3 additions & 1 deletion log-router/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ helm-dry-run:
--set image.pullSecret=test-pull-secret \
--set namespaces[0]=kfo-test \
--set namespaces[1]=kfo-consumer \
--set rbac.create=true \
--set meta.key=key \
--set meta.values.env=test \
--set meta.values.region=eu \
--set tolerations[0].key=key \
--set tolerations[0].operator=op \
--set tolerations[0].value=value
--set tolerations[0].value=value \
--set extraEnv.HELLO=world

clean:
rm -fr $(HELM_PACKAGE)-*.tgz || true
8 changes: 8 additions & 0 deletions log-router/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Copyright © 2018 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: BSD-2-Clause
*/}}
{{- $root := . -}}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -31,6 +32,13 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ template "fluentd-router.fullname" $root }}
key: {{ $key }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: fluentconf
Expand Down
21 changes: 21 additions & 0 deletions log-router/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{/*
Copyright © 2018 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: BSD-2-Clause
*/}}
{{- if .Values.extraEnv -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fluentd-router.fullname" . }}
labels:
app: {{ template "fluentd-router.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
{{- range $key, $value := .Values.extraEnv }}
{{ $key }}: {{ $value | b64enc | quote }}
{{- end }}
{{- end }}

2 changes: 2 additions & 0 deletions log-router/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ meta:
key: ""
values: {}

extraEnv: {}

# extraVolumes:
# - name: es-certs
# secret:
Expand Down

0 comments on commit 14bf14f

Please sign in to comment.