-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: rendering custom config tpl #346
base: develop
Are you sure you want to change the base?
Conversation
Can anyone review this? |
Hi @kimxogus, thank you for opening the pull request. To help me better understand and review this change, could you please provide an example? |
Hi @dsmith3197 , this is a simple example of usage of tpl config. global:
feature:
a: true
b: false
vector:
customConfig: |
sources:
kafka:
type: kafka
bootstrap_servers: KAFKA:9092
decoding:
codec: json
group_id: MY_GROUP
topics:
- common-topic
{{- if .Values.global.feature.a }}
- feature-a-topic
{{- end }}
{{- if .Values.global.feature.b }}
- feature-b-topic
{{- end }} |
@dsmith3197 Is there any progress reviewing this pr? |
3f38673
to
99d6bec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that the current approach breaks the automatic detection of container ports and the data directory when using templates in the Vector config. Is there a way we can work around this?
@dsmith3197 Yes, this could break those container port related templates, but I think adding all those additional values for container ports will make this pr too large |
@dsmith3197 Is this ok? |
Hi @kimxogus , Apologies in the delay of review of this. I'm admittedly having trouble with the whitespace trying to test this out but templating like this should be fine for templating the list value rather than a string, no? I'm looking at https://helm.sh/docs/chart_template_guide/control_structures/ which shows an example of doing it to add a key/value to a map. |
@jszwedko I just wanted to fix the broken tpl config. |
Ah I see, Focusing in on this bit, can you explain the issue a bit more clearly? I'm still not seeing it. It seems to imply the |
@jszwedko Sorry, I was confused the context as it's 4months old. global:
feature:
a: true
b: false
vector:
customConfig: |
sources:
kafka:
type: kafka
bootstrap_servers: KAFKA:9092
decoding:
codec: json
group_id: MY_GROUP
topics:
- common-topic
{{- if .Values.global.feature.a }}
- feature-a-topic
{{- end }}
{{- if .Values.global.feature.b }}
- feature-b-topic
{{- end }} |
Thanks @kimxogus ! My understanding is that it should be possible to template the YAML as-is like I mentioned in #346 (comment) (though admittedly I was still struggling with the formatting). Would that work for you? |
E.g. like they show here:
|
The code Helm raised this error with the template. |
@kimxogus Ah I see. Would it also work to run the |
Yes |
👍 do you mind updating this PR to do that instead, then? |
There's
{{ tpl (toYaml .Values.customConfig) . | indent 4 }}
, but we can't actually use tpl becuase there's several points accessing and iterating child objects of.Values.customConfig
.So I made them not to access or iterate child objects if customConfig is string.