-
Notifications
You must be signed in to change notification settings - Fork 260
Prefix on NIC v6 support #3526
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
Closed
+601
−307
Closed
Prefix on NIC v6 support #3526
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -115,7 +115,7 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error { | |
| p.logger.Debug("Received CNS IP config response", zap.Any("response", resp)) | ||
|
|
||
| // Get Pod IP and gateway IP from ip config response | ||
| podIPNet, err := ipconfig.ProcessIPConfigsResp(resp) | ||
| podIPNet, gatewayIP, err := ipconfig.ProcessIPConfigsResp(resp) | ||
| if err != nil { | ||
| p.logger.Error("Failed to interpret CNS IPConfigResponse", zap.Error(err), zap.Any("response", resp)) | ||
| return cniTypes.NewError(ErrProcessIPConfigResponse, err.Error(), "failed to interpret CNS IPConfigResponse") | ||
|
|
@@ -136,9 +136,33 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error { | |
| Mask: net.CIDRMask(ipNet.Bits(), 128), // nolint | ||
| } | ||
| } | ||
| ipConfig.Gateway = (*gatewayIP)[i] | ||
| cniResult.IPs[i] = ipConfig | ||
| } | ||
|
|
||
| cniResult.Interfaces = []*types100.Interface{} | ||
| seenInterfaces := map[string]bool{} | ||
|
|
||
| for _, podIPInfo := range resp.PodIPInfo { | ||
|
Contributor
Author
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. Add a comment to clarify that we need to do dedup as there is one podipinfo for each of the ipfamily |
||
| // Skip if interface already seen | ||
| // This is to avoid duplicate interfaces in the result | ||
| // Deduplication is necessary because there is one podIPInfo entry for each IP family(IPv4 and IPv6), and both may point to the same interface or if multiple interfaces are assigned to the same pod | ||
| if podIPInfo.MacAddress == "" || seenInterfaces[podIPInfo.MacAddress] { | ||
| continue | ||
| } | ||
|
|
||
| infMac, err := net.ParseMAC(podIPInfo.MacAddress) | ||
| if err != nil { | ||
| p.logger.Error("Failed to parse interface MAC address", zap.Error(err), zap.String("macAddress", podIPInfo.MacAddress)) | ||
| return cniTypes.NewError(cniTypes.ErrUnsupportedField, err.Error(), "failed to parse interface MAC address") | ||
| } | ||
|
|
||
| cniResult.Interfaces = append(cniResult.Interfaces, &types100.Interface{ | ||
| Mac: infMac.String(), | ||
| }) | ||
| seenInterfaces[podIPInfo.MacAddress] = true | ||
| } | ||
|
|
||
| // Get versioned result | ||
| versionedCniResult, err := cniResult.GetAsVersion(nwCfg.CNIVersion) | ||
| if err != nil { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what this gatewayIP is? why its required?