-
Notifications
You must be signed in to change notification settings - Fork 46
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
[PoC] Security Group Filtering #53
Changes from all commits
5cae65b
68a8ef3
3ae62a2
c102bc3
9ca5680
6effbbc
59cd065
3190a5b
b0a4a03
bf7749c
38a37d4
82124a6
229aec2
f8c6902
48ffe35
f6d2ebd
7a608b7
6de772c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ package handlers | |
import ( | ||
"context" | ||
"net/http" | ||
|
||
"code.cloudfoundry.org/auctioneer" | ||
"code.cloudfoundry.org/bbs/db" | ||
"code.cloudfoundry.org/bbs/events" | ||
|
@@ -65,7 +65,7 @@ func (h *DesiredLRPHandler) commonDesiredLRPs(logger lager.Logger, targetVersion | |
|
||
err = parseRequest(logger, req, request) | ||
if err == nil { | ||
filter := models.DesiredLRPFilter{Domain: request.Domain, ProcessGuids: request.ProcessGuids} | ||
filter := models.DesiredLRPFilter{Domain: request.Domain, ProcessGuids: request.ProcessGuids, SkipEgressRules: request.SkipEgressRules,} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned below, I think it is better to introduce new model and new database call, that will only pull the required fields, instead of loading all of this into memory and then nullifying it. |
||
|
||
var desiredLRPs []*models.DesiredLRP | ||
desiredLRPs, err = h.desiredLRPDB.DesiredLRPs(req.Context(), logger, filter) | ||
|
@@ -74,6 +74,9 @@ func (h *DesiredLRPHandler) commonDesiredLRPs(logger lager.Logger, targetVersion | |
if len(desiredLRPs[i].CachedDependencies) == 0 { | ||
desiredLRPs[i].CachedDependencies = nil | ||
} | ||
if filter.SkipEgressRules { | ||
desiredLRPs[i].EgressRules = nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nullifying the Egress Rules results in Desired LRP which is partially instantiated and doesn't represent the real object. Instead I think it is better to introduce new presenter model, e.g. DesiredLRPRouteInfo, that will only have information required by route-emitter. |
||
} | ||
} | ||
|
||
response.DesiredLrps = desiredLRPs | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I would introduce a new endpoint that only gets desired LRP routes information. Because this is not really a filter to select desired LRPs, the SkipEgressRules is a command we want to perform to present the data.