-
Notifications
You must be signed in to change notification settings - Fork 313
Safeguard gcpfirewalls cr creation to not return sync errors in Shadow run #2905
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?
Safeguard gcpfirewalls cr creation to not return sync errors in Shadow run #2905
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: maciejriedl The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @maciejriedl. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
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.
The change looks okay to me. However wanted to clarify why we aren't returning an error.
The flag flip should result in a test change. Do we have an unit tests?
pkg/firewalls/firewalls_l7_cr.go
Outdated
@@ -41,7 +41,8 @@ type FirewallCR struct { | |||
// all the port ranges to open with each call to Sync() | |||
nodePortRanges []string | |||
firewallClient firewallclient.Interface | |||
dryRun bool | |||
// If firewalls are still reconciled by l7LB. |
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.
nit: this comment isn't clear. Can you expand this?
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.
done
@@ -116,7 +121,11 @@ func ensureFirewallCR(client firewallclient.Interface, expectedFWCR *gcpfirewall | |||
con.Reason == string(gcpfirewallv1.FirewallRuleReasonSyncError) { | |||
// Use recorder to emit the cmd in Sync() | |||
logger.V(3).Info("ensureFirewallCR: Could not enforce Firewall CR", "currentFirewallCRName", currentFWCR.Name, "reason", con.Reason) | |||
return fmt.Errorf(con.Reason) | |||
if dryRun { | |||
return nil |
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.
why do we not want to return this 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.
This is the point of the dryRun - If we are in the "testing" flow, we don't want CRs to eventually cause disruptions to the L7LB (error in PFW could cause L7LB to receive infinte errors)
8bdef7c
to
b1a9981
Compare
…eturned in Shadow run (when l7LB still reconciles the FWs). Also fix dryRun flag to properly mean "testing" flow (the logic of the flag usage has not been changed)
b1a9981
to
be9d90c
Compare
Make sure that during gcpfirewalls cr creation, sync errors are not returned in Shadow run (when l7LB still reconciles the FWs).
Also fix dryRun flag to properly mean "testing" flow (the logic of the flag usage has not been changed)