-
Notifications
You must be signed in to change notification settings - Fork 240
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
refactor: SWIFT v2 Middlewares #2390
Conversation
eb12fea
to
2b93640
Compare
cns/api.go
Outdated
@@ -51,15 +51,13 @@ type HTTPService interface { | |||
AttachSWIFTv2Middleware(middleware SWIFTv2Middleware) |
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.
rename to AttachMiddleware and pass Middleware interface?
4963a3f
to
e2c1b68
Compare
2c89aa1
to
bb52bed
Compare
80dfa6b
to
40a8390
Compare
}, errors.New("failed to validate ip configs request") | ||
} | ||
// If the pod is not v2, return the response from the handler | ||
if !req.SecondaryInterfacesExist { |
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: since we're calling defaultHandler anyway - we can move line 53 above the if statement, and just return ipConfigsResp,err on line 50
40a8390
to
f6cd50d
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.
with suggestions
6e7cb94
to
2284957
Compare
8a5bcb6
to
4a2d293
Compare
4a2d293
to
5c350ca
Compare
26e08f2
to
ac62b62
Compare
f949c48
to
249dd99
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.
lgtm as per refactoring/renaming middleware & funcs, to be tested in standalone to verify changes
* refractor: swift v2 middleware * revert: unexport getTestService * fix: linter * fix: linter issue * refactor: generic renaming of middlewares-related code in cns * refactor: change type of swiftv2middleware * address feedbacks * rename for clarity * missed some renaming * renaming * addressed comments * add UT for no-op releasing ip config for v2 pod even if its mtpnc is not ready * pass in SWIFTv2Mode as string * typed SWIFTV2Mode
Reason for Change:
Currently, our SWIFT v2's middleware for handling IP configs request is not implemented as a "true middleware" but rather, being another branch of code that would be invoke within the default IP configs request handler if CNS is running in SWIFT v2 scenario. This PR aims to refractor our current implementation so that the default handler would be wrapped by the middleware function instead, so there would be no branching within the default handler functions. This is not a blocking requirement for ongoing SWIFT v2 testing.
Issue Fixed:
Requirements:
Notes: