Skip to content

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

Merged
merged 3 commits into from
Mar 22, 2018
Merged

Fix security list rules leak #151

merged 3 commits into from
Mar 22, 2018

Conversation

prydie
Copy link
Contributor

@prydie prydie commented Mar 20, 2018

Fixes: #150.

Mar 20 16:47:04.102: INFO: Running AfterSuite actions on all node

Ran 9 of 9 Specs in 439.089 seconds
SUCCESS! -- 9 Passed | 0 Failed | 0 Pending | 0 Skipped PASS

Ginkgo ran 1 suite in 7m28.29592898s
Test Suite Passed

@prydie prydie added this to the 0.3.0 milestone Mar 20, 2018
@prydie prydie requested review from owainlewis and jhorwit2 March 20, 2018 17:06
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.
Copy link
Member

@owainlewis owainlewis Mar 22, 2018

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

@owainlewis owainlewis self-assigned this Mar 22, 2018
@@ -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
Copy link
Member

@owainlewis owainlewis Mar 22, 2018

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo deleteing => deleting

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 {
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prydie prydie force-pushed the ap/seclist-rule-leak branch from 0aca03c to d734152 Compare March 22, 2018 12:38
@owainlewis owainlewis merged commit b3ba47d into master Mar 22, 2018
@owainlewis owainlewis deleted the ap/seclist-rule-leak branch March 22, 2018 12:41
ayushverma14 pushed a commit to ayushverma14/oci-cloud-controller-manager that referenced this pull request Jul 18, 2022
* Delete seclist rules based on actual lb state
* Fix leak of security list rules on NodePort update
* Fix health checker changed logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants