-
Notifications
You must be signed in to change notification settings - Fork 16.7k
[stable/fluent-bit] add extraLuaScripts config and inject lua script to dedot kube- labels and annotations #22328
Conversation
…keys lua filter implementation Signed-off-by: Dmitry Gadeev <[email protected]>
Hi @kruftik. Thanks for your PR. I'm waiting for a helm member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Dmitry Gadeev <[email protected]>
009e9af
to
2647e3a
Compare
Signed-off-by: Dmitry Gadeev <[email protected]>
b98ddea
to
e8c7302
Compare
/assign @hectorj2f |
local new_map = {} | ||
local changed_keys = {} | ||
for k, v in pairs(map) do | ||
local deslashed = string.gsub(k, "%/", "_") |
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.
Since this is removing slashes too, I don't think filter.enableDedotKeys
as the value name is appropriate, but filter.enableDedotAndDeslashKeys
feels too verbose and specific.
Maybe we could abstract this functionality into a generic filter.kubeRemapMetaKeys
value so the Lua code here would look as follows:
{{- with .Values.filter.kubeRemapMetaKeys }}
local remapped = string.gsub(k, {{ .pattern | quote }}, {{ .replacement | quote }})
{{- end }}
Now a user can specify exactly how they'd like to remap K8s labels and annotations. The documentation would have to clarify the pattern has to be a valid Lua pattern as per https://www.lua.org/pil/20.2.html though, but for the most part regex is okay too.
Removing both slashes and dots as a chart consumer would then look like:
filter.kubeRemapMetaKeys:
pattern: '[/.]'
replacement: ''
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.
sounds reasonable. now the proposed implementation is used. in addition, made kubeRemapMetaKeys as a list to allow multiple different remappings.
@@ -151,6 +151,7 @@ fullConfigMap: false | |||
## | |||
existingConfigMap: "" | |||
|
|||
extraLuaScripts: {} |
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.
This new value is missing in the README.
Disregarding that though, how would one use this value? I guess what's the benefit over just using extraVolumeMounts
?
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.
fixed.
imo, the extraLuaScripts value is a quite simple way to inject additional Lua scripts to the container while existing extraVolumeMounts is not. the main "problem" here is the need to place the scripts content by some way into the volume where extraLuaScripts is a simple plain-text setting.
Signed-off-by: Dmitry Gadeev <[email protected]>
e1e830d
to
87f036d
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions. |
Signed-off-by: Dmitry Gadeev <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kruftik The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @hectorj2f |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions. |
This issue is being automatically closed due to inactivity. |
What this PR does / why we need it:
Fixes fluent/fluent-bit#1134. Injects lua function from fluent/fluent-bit#1134 (comment) to fluent-bit containers and use it to replace dots in the keys of kubernetes labels and annotations with underscore to fix data type-related conflicts
Special notes for your reviewer:
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
[stable/mychartname]
)