-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add sfswiftv2 middleware support for standalone service fabr…
…ic swiftv2 windows path
- Loading branch information
Showing
11 changed files
with
239 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package middlewares | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/azure-container-networking/cns/configuration" | ||
|
||
"github.com/Azure/azure-container-networking/cns" | ||
Check failure on line 8 in cns/middlewares/SFSwiftV2.go GitHub Actions / Lint (1.21.x, ubuntu-latest)
|
||
"github.com/Azure/azure-container-networking/cns/types" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
type SFSWIFTv2Middleware struct{} | ||
|
||
// IPConfigsRequestHandlerWrapper is the middleware function for handling SWIFT v2 IP config requests for SF standalone scenario. This function wraps the default SWIFT request | ||
// and release IP configs handlers. | ||
func (m *SFSWIFTv2Middleware) IPConfigsRequestHandlerWrapper(ipRequestHandler, _ cns.IPConfigsHandlerFunc) cns.IPConfigsHandlerFunc { | ||
return func(ctx context.Context, req cns.IPConfigsRequest) (*cns.IPConfigsResponse, error) { | ||
ipConfigsResp, err := ipRequestHandler(ctx, req) | ||
if err != nil { | ||
ipConfigsResp.Response.ReturnCode = types.UnexpectedError | ||
return ipConfigsResp, errors.Wrapf(err, "Failed to requestIPConfigs for SF from IPConfigsRequest %v", req) | ||
} | ||
|
||
// SwiftV2-SF will always request for secondaryInterfaces for a pod | ||
req.SecondaryInterfacesExist = true | ||
return ipConfigsResp, nil | ||
} | ||
} | ||
|
||
func (m *SFSWIFTv2Middleware) GetMiddlewareType() configuration.SWIFTV2Mode { | ||
return configuration.SFSWIFTV2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.