Skip to content

Commit

Permalink
ignore core. properties (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasparada authored Aug 13, 2024
1 parent 3fa75cf commit f353a45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ValidateSectionWithSchema(kind SectionKind, props property.Properties, sche
}

for _, p := range props {
if isCommonProperty(p.Key) || isCloudVariable(p.Key) || isCloudVariable(p.Value) {
if isCommonProperty(p.Key) || isCloudVariable(p.Key) || isCloudVariable(p.Value) || isCoreProperty(p.Key) {
continue
}

Expand Down Expand Up @@ -134,6 +134,13 @@ func areProcessors(key string) bool {
return strings.ToLower(key) == "processors"
}

// isCoreProperty tells whether the property is from Core.
// Core properties start with `core.` and are ignored.
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/blob/71795c472bcb1f7e09a7ea121366d5f91df4263f/patches/pwhelan-flb_config-ignore-core-namespaced-properties.patch#L22-L25
func isCoreProperty(key string) bool {
return strings.HasPrefix(key, "core.")
}

func validateProcessorsSectionMaps(sectionMaps []interface{}) error {
for _, section := range sectionMaps {
props := property.Properties{}
Expand Down
10 changes: 10 additions & 0 deletions validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ func TestConfig_Validate(t *testing.T) {
query SELECT 'hello from sqldb' AS message
`,
},
{
name: "custom_core_property",
ini: `
[INPUT]
Name dummy
[OUTPUT]
Name s3
core.metadata name=foo
`,
},
}
for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
Expand Down

0 comments on commit f353a45

Please sign in to comment.