-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add wasm filter piugin Signed-off-by: jiuxia211 <[email protected]> * feat: update AccessiblePaths type to string[] and correct Event_Format field Signed-off-by: jiuxia211 <[email protected]> * delete the WASM file mounting in Fluent Bit DaemonSet Signed-off-by: jiuxia211 <[email protected]> --------- Signed-off-by: jiuxia211 <[email protected]>
- Loading branch information
Showing
13 changed files
with
481 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package filter | ||
|
||
import ( | ||
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" | ||
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params" | ||
) | ||
|
||
// +kubebuilder:object:generate:=true | ||
|
||
// Wasm Filter allows you to modify the incoming records using Wasm technology. | ||
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/filters/wasm** | ||
type Wasm struct { | ||
plugins.CommonParams `json:",inline"` | ||
// Path to the built Wasm program that will be used. This can be a relative path against the main configuration file. | ||
WasmPath string `json:"wasmPath,omitempty"` | ||
// Define event format to interact with Wasm programs: msgpack or json. Default: json | ||
EventFormat string `json:"eventFormat,omitempty"` | ||
// Wasm function name that will be triggered to do filtering. It's assumed that the function is built inside the Wasm program specified above. | ||
FunctionName string `json:"functionName,omitempty"` | ||
// Specify the whitelist of paths to be able to access paths from WASM programs. | ||
AccessiblePaths []string `json:"accessiblePaths,omitempty"` | ||
// Size of the heap size of Wasm execution. Review unit sizes for allowed values. | ||
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" | ||
WasmHeapSize string `json:"wasmHeapSize,omitempty"` | ||
// Size of the stack size of Wasm execution. Review unit sizes for allowed values. | ||
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" | ||
WasmStackSize string `json:"wasmStackSize,omitempty"` | ||
} | ||
|
||
// Name is the name of the filter plugin. | ||
func (*Wasm) Name() string { | ||
return "wasm" | ||
} | ||
|
||
// Params represents the config options for the filter plugin. | ||
func (w *Wasm) Params(_ plugins.SecretLoader) (*params.KVs, error) { | ||
kvs := params.NewKVs() | ||
err := w.AddCommonParams(kvs) | ||
if err != nil { | ||
return kvs, err | ||
} | ||
if w.WasmPath != "" { | ||
kvs.Insert("Wasm_Path", w.WasmPath) | ||
} | ||
if w.EventFormat != "" { | ||
kvs.Insert("Event_Format", w.EventFormat) | ||
} | ||
if w.FunctionName != "" { | ||
kvs.Insert("Function_Name", w.FunctionName) | ||
} | ||
for _, p := range w.AccessiblePaths { | ||
kvs.Insert("Accessible_Paths", p) | ||
} | ||
if w.WasmHeapSize != "" { | ||
kvs.Insert("Wasm_Heap_Size", w.WasmHeapSize) | ||
} | ||
if w.WasmStackSize != "" { | ||
kvs.Insert("Wasm_Stack_Size", w.WasmStackSize) | ||
} | ||
|
||
return kvs, nil | ||
} |
21 changes: 21 additions & 0 deletions
21
apis/fluentbit/v1alpha2/plugins/filter/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# WASM | ||
|
||
The Wasm Filter allows you to modify the incoming records using Wasm technology. <br /> **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/filters/wasm** | ||
|
||
|
||
| Field | Description | Scheme | | ||
| ----- | ----------- | ------ | | ||
| wasmPath | Path to the built Wasm program that will be used. This can be a relative path against the main configuration file. | string | | ||
| eventFormat | Define event format to interact with Wasm programs: msgpack or json. Default: json | string | | ||
| functionName | Wasm function name that will be triggered to do filtering. It's assumed that the function is built inside the Wasm program specified above. | string | | ||
| accessiblePaths | Specify the whitelist of paths to be able to access paths from WASM programs. | string | | ||
| wasmHeapSize | Size of the heap size of Wasm execution. Review unit sizes for allowed values. | string | | ||
| wasmStackSize | Size of the stack size of Wasm execution. Review unit sizes for allowed values. | string | | ||
|
Oops, something went wrong.