-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fixing incomplete execution of the configuration issue #521
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jay Sheth <[email protected]>
8636445
to
51f8fda
Compare
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.
Line 780: Replace with combinedError = errors.Join(combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %v", err))
Line 796: Replace with return combinedError
bpfprogs/nfconfig.go
Outdated
if combinedError == nil { // saving all the errors for c.Deploy c.SaveConfigsToConfigStore to combinedError instead of returning right away. | ||
combinedError = fmt.Errorf("deploy eBPF Programs failed to save configs %w", err) | ||
} else { | ||
combinedError = fmt.Errorf("%v; %v", combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)) | ||
} |
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.
if combinedError == nil { // saving all the errors for c.Deploy c.SaveConfigsToConfigStore to combinedError instead of returning right away. | |
combinedError = fmt.Errorf("deploy eBPF Programs failed to save configs %w", err) | |
} else { | |
combinedError = fmt.Errorf("%v; %v", combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)) | |
} | |
combinedError = combinedError.Join(combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)) | |
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.
combinedError is of type error, which does not have Join function
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.
For reference https://go.dev/play/p/l__RgsxAU2e
bpfprogs/nfconfig.go
Outdated
} | ||
if combinedError == nil { | ||
combinedError = fmt.Errorf("deploy eBPF Programs failed to save configs %w", err) | ||
} else { | ||
combinedError = fmt.Errorf("%v; %v", combinedError, fmt.Errorf("failed to deploy BPF program on iface %s with error: %w", bpfProg.Iface, err)) |
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.
Can we remove this SaveConfigsToConfigStore(); call ? we have to save config at the end with the good state only.
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.
Removed the SaveConfigsToConfigStore() call
bpfprogs/nfconfig.go
Outdated
@@ -782,6 +796,8 @@ func (c *NFConfigs) DeployeBPFPrograms(bpfProgs []models.L3afBPFPrograms) error | |||
return nil | |||
} | |||
|
|||
// function to combine all errors in []error and return a single error |
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.
Can we remove these comments that are no longer relevant?
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.
Addressed
Signed-off-by: Jay Sheth <[email protected]>
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.
Looks good
Signed-off-by: Jay Sheth <[email protected]>
bpfprogs/nfconfig.go
Outdated
@@ -779,7 +781,7 @@ func (c *NFConfigs) DeployeBPFPrograms(bpfProgs []models.L3afBPFPrograms) error | |||
if err := c.SaveConfigsToConfigStore(); err != nil { | |||
return fmt.Errorf("deploy eBPF Programs failed to save configs %w", err) |
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.
return fmt.Errorf("deploy eBPF Programs failed to save configs %w", err) | |
combinedError = errors.Join(combinedError, fmt.Errorf("deploy eBPF Programs failed to save configs %w", err)) |
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
Signed-off-by: Jay Sheth <[email protected]>
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.
LGTM
Addressing #520
In case the payload consist of the configuration which requires eBPF programs for multiple interfaces to be loaded (for example, eth1, eth2, and eth3).
In the scenario where eth2 exists no more:
In this PR, we remove the return statements in the for loop and instead save individual error messages to single variable. This variable is then returned after the for loop is completed.