-
Notifications
You must be signed in to change notification settings - Fork 350
Implement skipInvalidResources for syslog-ng logging #2116
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: csatib02 <[email protected]>
Signed-off-by: Bence Csati <[email protected]>
fe29527
to
1d505a4
Compare
for _, cf := range in.ClusterFlows { | ||
if err := validateClusterOutputs(clusterOutputRefs, client.ObjectKeyFromObject(&cf).String(), cf.Spec.GlobalOutputRefs, cf.Kind); err != nil { | ||
if in.SkipInvalidResources { | ||
// Skip this cluster flow and continue with the next one |
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.
@copilot add an error log here that we skipped this resource
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.
Added error logging in commit 7a1f2c3. The code now logs "skipping invalid SyslogNGClusterFlow" with the resource name and namespace when an invalid cluster flow is skipped.
} | ||
if flowErrs != nil { | ||
if in.SkipInvalidResources { | ||
// Skip this flow and continue with the next one |
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.
@copilot add an error log here about the skipped resource
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.
Added error logging in commit 7a1f2c3. The code now logs "skipping invalid SyslogNGFlow" with the resource name and namespace when an invalid flow is skipped.
for _, cf := range in.ClusterFlows { | ||
if err := validateClusterOutputs(clusterOutputRefs, client.ObjectKeyFromObject(&cf).String(), cf.Spec.GlobalOutputRefs, cf.Kind); err != nil { | ||
if in.SkipInvalidResources { | ||
// Skip this cluster flow and continue with the next one |
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.
@copilot add an error log here about the skipped resource
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.
Added error logging in commit 7a1f2c3. The code now logs "skipping invalid SyslogNGClusterFlow" with the resource name and namespace when an invalid cluster flow is skipped.
} | ||
if flowErrs != nil { | ||
if in.SkipInvalidResources { | ||
// Skip this flow and continue with the next one |
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.
@copilot add an error log here about the skipped resource
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.
Added error logging in commit 7a1f2c3. The code now logs "skipping invalid SyslogNGFlow" with the resource name and namespace when an invalid flow is skipped.
Co-authored-by: csatib02 <[email protected]>
Implementation Complete: skipInvalidResources for syslog-ng
✅ All tasks completed successfully
Summary
Successfully implemented
skipInvalidResources
support for syslog-ng logging to match the existing behavior in fluentd. When this flag is enabled in the Logging resource spec, invalid SyslogNGFlows and SyslogNGClusterFlows (e.g., those referencing non-existent outputs) are skipped during configuration rendering instead of causing the entire reconciliation to fail.Changes Made:
SkipInvalidResources
field toconfig.Input
struct inpkg/sdk/logging/model/syslogng/config/config.go
configRenderer
function to:SkipInvalidResources
is trueSkipInvalidResources
is truecontrollers/logging/logging_controller.go
to pass the flag and logger from Logging specconfig_test.go
:Recent Updates:
Logger
field toInput
struct to enable error logginggithub.com/go-logr/logr
packageTesting Results:
Behavior:
The implementation works exactly like the fluentd version:
skipInvalidResources: true
in the Logging spec, invalid flows/clusterflows are skipped with error logsskipInvalidResources: false
(default), errors are accumulated and returned, causing reconciliation to fail✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.