-
Notifications
You must be signed in to change notification settings - Fork 183
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
refactor(helm): add helper function to add quotes to annotation_match #1655
Conversation
cf3e5ad
to
a026924
Compare
quote function is not use as it automatically adds '\' before special characters
a026924
to
f771448
Compare
{{- define "fluentd.metadata.annotations_match.quotes" -}} | ||
{{- $matches_with_quotes := list -}} | ||
{{- range $match := .Values.fluentd.metadata.annotation_match }} | ||
{{- $match_with_quotes := printf "\"%s\"" $match }} |
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.
please use quote
function as someone potentially can put quotes in variable
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.
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've tested with quote
and I noticed that it adds \
before special characters. I used this in following way:
{{- $match_with_quotes := $match | quote }}
and then in help templates there was following form:
annotation_match ["sumologic\\.com.*","tailing-sidecar.sumologic\\.com.*","test-sumologic\\.com.*","test-tailing-sidecar.sumologic\\.com.*"]
and in fluend logs I saw that Pod had following configuration
<filter containers.**>
@type kubernetes_metadata
@log_level "error"
annotation_match ["sumologic\\.com.*","tailing-sidecar.sumologic\\.com.*","test-sumologic\\.com.*","test-tailing-sidecar.sumologic\\.com.*"]
de_dot false
watch true
ca_file ""
verify_ssl true
client_cert ""
client_key ""
bearer_token_file ""
cache_size 10000
cache_ttl 7200
tag_to_kubernetes_name_regexp ".+?\\.containers\\.(?<pod_name>[^_]+)_(?<namespace>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\\.log$"
</filter>
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.
Thanks!
quote function is not use as it automatically adds
\
before special charactersExample tested configuration:
values.yaml
pod1.yaml
pod2.yaml
fluentd configuration in helm templates (
helm --dry-run
)fluentd configuration captured by fluentd pod (
kubectl logs collection-sumologic-fluentd-logs-2
)