Comments (2)
My read of https://github.com/influxdata/tick-charts/blob/master/telegraf-s/templates/_helpers.tpl#L94-L175 is that it's essentially duplicated twice in order to handle multiple levels of nesting.
I.E. if I set
config:
inputs:
defaultdisk:
disk:
tagpass:
fstype:
- ext4
foo:
bar:
- baz
then change the helper to
+++ b/libs/influx/k8s/charts/telegraf/templates/_helpers.tpl
@@ -95,7 +95,7 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
{{- range $inputIdx, $configObject := . -}}
{{- range $input, $config := . -}}
- [[inputs.{{- $input }}]]
+ [[FIRSTinputs.{{- $input }}]]
{{- if $config -}}
{{- $tp := typeOf $config -}}
{{- if eq $tp "map[string]interface {}" -}}
@@ -139,7 +139,7 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
]
{{- end }}
{{- if eq $tp "map[string]interface {}" }}
- [[inputs.{{ $input }}.{{ $key }}]]
+ [[SECONDinputs.{{ $input }}.{{ $key }}]]
{{- range $k, $v := $value }}
{{- $tps := typeOf $v }}
{{- if eq $tps "string" }}
@@ -160,7 +160,7 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
]
{{- end }}
{{- if eq $tps "map[string]interface {}"}}
- [[inputs.{{ $input }}.{{ $key }}.{{ $k }}]]
+ [[THIRDinputs.{{ $input }}.{{ $key }}.{{ $k }}]]
{{- range $foo, $bar := $v }}
{{ $foo }} = {{ $bar | quote }}
{{- end }}
@@ -172,4 +172,4 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
and render it I get the TOML
[[FIRSTinputs.disk]]
[[SECONDinputs.disk.tagpass]]
[[THIRDinputs.disk.tagpass.foo]]
bar = "[baz]"
fstype = [
"ext4",
]
(The way baz is rendered there is unexpected, but that tangential to what I'm after)
I guess the additional levels use [[
in order to support plugins like postgresql_extensible, where you could have miltiple[[inputs.postgresql_extensible.query]]
inside [[inputs.postgresql_extensible]]
The only fix that comes to my mind is to make this even more comples by adding some logic at https://github.com/influxdata/tick-charts/blob/master/telegraf-s/templates/_helpers.tpl#L141-L142 to check the key name against namepass, namedrop, tagpass, and tagdrop and use []
if they match and [[]]
if they don't.
from tick-charts.
I've solved our immediate issue by this diff to our fork of the chart:
diff --git a/libs/influx/k8s/charts/telegraf/templates/_helpers.tpl b/libs/influx/k8s/charts/telegraf/templates/_helpers.tpl
index 93ace660..322bfd60 100755
--- a/libs/influx/k8s/charts/telegraf/templates/_helpers.tpl
+++ b/libs/influx/k8s/charts/telegraf/templates/_helpers.tpl
@@ -139,7 +139,11 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
]
{{- end }}
{{- if eq $tp "map[string]interface {}" }}
+ {{- if eq $key "tagpass" }}
+ [inputs.{{ $input }}.{{ $key }}]
+ {{- else }}
[[inputs.{{ $input }}.{{ $key }}]]
+ {{- end }}
{{- range $k, $v := $value }}
{{- $tps := typeOf $v }}
{{- if eq $tps "string" }}
@@ -172,4 +176,4 @@ We truncate at 24 chars because some Kubernetes name fields are limited to this
If these charts are still maintained, I'm happy to sign a CLA and collaborate on a more general fix.
from tick-charts.
Related Issues (20)
- Bug in telegraf-s helpers template for inputs, comma placement incorrect
- Kapacitor Failed to list resource
- read /var/run/utmp: is a directory
- Allow setting of service account for telegraf-ds HOT 4
- [telegraf] Readiness/Liveness probes for telegraf containers
- Repo Revival HOT 14
- Telegraf to collect StatsD HOT 2
- Use Okta as oauth provider HOT 1
- telegraf-ds Does Not Support InfluxDB V2
- Don't delete old versions from repository
- [stable/influxdb] Liveness probe fails while in WAL recovery HOT 1
- Cannot override configuration parameters (example doesn't work) HOT 4
- /stats/summary returned HTTP status 401 Unauthorized HOT 13
- Telegraf with multiple replicas HOT 2
- Easy fix - telegraf:1.9.3-alpine Does not exist on Docker Hub HOT 1
- Feature Request: support for priority classes
- Support service accounts for telegraf-s
- Whats the difference to influxdata/kube-influxdb?
- Helm chart for influx v2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tick-charts.