Skip to content
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

add wasm filter piugin #1325

Merged
merged 3 commits into from
Aug 30, 2024
Merged

add wasm filter piugin #1325

merged 3 commits into from
Aug 30, 2024

Conversation

jiuxia211
Copy link
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduced a user-facing change?

The wasm file needs to be mounted to the fluent bit. I tried writing the wasm file to secret or configmap, but it was too long, and I ended up mimicking the way Position DB was mounted.


Additional documentation, usage docs, etc.:


Signed-off-by: jiuxia211 <[email protected]>
@benjaminhuo
Copy link
Member

@wanjunlei @wenchajun pls help to review

apis/fluentbit/v1alpha2/plugins/filter/wasm.go Outdated Show resolved Hide resolved
apis/fluentbit/v1alpha2/plugins/filter/wasm.go Outdated Show resolved Hide resolved
@@ -107,6 +107,8 @@ type FluentBitSpec struct {
SchedulerName string `json:"schedulerName,omitempty"`
// Optional duration in seconds the pod needs to terminate gracefully. Value must be non-negative integer.
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// Storage for wasm file. You will use it if wasm filter is enabled.
WasmFile corev1.VolumeSource `json:"wasmFile,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volumes and VolumesMounts can be used to mount wasm files. Does it need to add additional fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it doesn't need additional fields, just specify the hostPath of the wasm file.
Like this:

wasmFile:
    hostPath:
      path: /etc/wasm/  

})
ds.Spec.Template.Spec.Containers[0].VolumeMounts = append(ds.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
Name: "wasm",
MountPath: "/fluent-bit/wasm",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean the WasmPath must begin with /fluent-bit/wasm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Because I noticed that's what PositionDB does. Maybe more comments should be added or is there a better way?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using Volumes and VolumesMounts to mount wasm files, so you can specify any directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,I have updated it

@benjaminhuo benjaminhuo merged commit 9b31cf2 into fluent:master Aug 30, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants