-
Notifications
You must be signed in to change notification settings - Fork 93
Fix security list rules leak #151
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
Conversation
err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) | ||
if err != nil { | ||
// FIXME(apryde): This is inelegant and inefficient. Update() should be refactored | ||
// to take the old backend port and handle removal of associated rules. |
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 backends be empty here? If so we'll need a guard against it. Logically this made me a bit uneasy
*action.OldBackendSet.Backends[0].Port
@@ -436,11 +436,17 @@ func (cp *CloudProvider) updateBackendSet(ctx context.Context, lbOCID string, ac | |||
|
|||
workRequestID, err = cp.client.LoadBalancer().CreateBackendSet(ctx, lbOCID, action.Name(), bs) | |||
case Update: | |||
err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) | |||
if err != nil { | |||
// FIXME(apryde): This is inelegant and inefficient. Update() should be refactored |
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.
Create ticket for this so we can track it.
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.
pkg/oci/load_balancer.go
Outdated
if action.OldBackendSet != nil && *action.OldBackendSet.Backends[0].Port != backendPort { | ||
oldBackendPort := *action.OldBackendSet.Backends[0].Port | ||
if err = cp.securityListManager.Delete(ctx, lbSubnets, nodeSubnets, listenerPort, oldBackendPort, healthCheckPort); err != nil { | ||
return errors.Wrapf(err, "deleteing security rule for old node port %d", oldBackendPort) |
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.
typo deleteing => deleting
pkg/oci/load_balancer.go
Outdated
return errors.Wrapf(err, "deleteing security rule for old node port %d", oldBackendPort) | ||
} | ||
} | ||
if err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort); err != 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.
Might be nice to have a concrete structure here as passing around all these individual values is slightly hard to reason about. Perhaps a SecurityListDesiredState struct or similar?
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.
0aca03c
to
d734152
Compare
* Delete seclist rules based on actual lb state * Fix leak of security list rules on NodePort update * Fix health checker changed logic
Fixes: #150.