-
Notifications
You must be signed in to change notification settings - Fork 249
Prefix on nicv6 support #3658
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
Open
NihaNallappagari
wants to merge
15
commits into
Azure:master
Choose a base branch
from
NihaNallappagari:prefixOnNicv6Support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Prefix on nicv6 support #3658
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
419d904
Prefix on NIC v6 support
kadevu e9cb405
update dedup comment in ipam
nihanMicrosoft 61784dc
add log for a gatway error scenario
nihanMicrosoft e00a5b7
handle synchostversion sync on pon swiftv2 nic
NihaNallappagari d0e56de
handle gatewayip parse failure or nil scenario
NihaNallappagari 7de69b1
remove unused code
NihaNallappagari 8806489
add test scenario
NihaNallappagari 26be9a4
update test to handle gatway nil case
NihaNallappagari 052330e
remove synchost skip and single ip skip
NihaNallappagari af07e5a
Add missing test scenarios
NihaNallappagari bf539fb
Merge branch 'master' into prefixOnNicv6Support
NihaNallappagari 3aa8e27
fix ipam_test conflicts
NihaNallappagari 9da8675
Merge branch 'master' into prefixOnNicv6Support
NihaNallappagari 14d0336
fix conflits
NihaNallappagari 605770b
fix linting
NihaNallappagari 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 { | ||
// 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 | ||
} | ||
|
||
Comment on lines
+154
to
+165
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. can we add UT for this case with dualstack ips? 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. Added UT for dual stack scenarios |
||
// 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
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.
Uh oh!
There was an error while loading. Please reload this page.