fix no valid addresses caused by lack of ip's version#4
Merged
rakelkar merged 3 commits intorakelkar:windowsCnifrom Feb 6, 2018
carlory:windowsCni
Merged
fix no valid addresses caused by lack of ip's version#4rakelkar merged 3 commits intorakelkar:windowsCnifrom carlory:windowsCni
rakelkar merged 3 commits intorakelkar:windowsCnifrom
carlory:windowsCni
Conversation
Author
// Convert to the older 0.2.0 CNI spec Result type
func (r *Result) convertTo020() (*types020.Result, error) {
oldResult := &types020.Result{
CNIVersion: types020.ImplementedSpecVersion,
DNS: r.DNS,
}
for _, ip := range r.IPs {
// Only convert the first IP address of each version as 0.2.0
// and earlier cannot handle multiple IP addresses
if ip.Version == "4" && oldResult.IP4 == nil {
oldResult.IP4 = &types020.IPConfig{
IP: ip.Address,
Gateway: ip.Gateway,
}
} else if ip.Version == "6" && oldResult.IP6 == nil {
oldResult.IP6 = &types020.IPConfig{
IP: ip.Address,
Gateway: ip.Gateway,
}
}
if oldResult.IP4 != nil && oldResult.IP6 != nil {
break
}
}
if oldResult.IP4 == nil && oldResult.IP6 == nil {
return nil, fmt.Errorf("cannot convert: no valid IP addresses")
}
} |
rakelkar
reviewed
Feb 5, 2018
| "net" | ||
| "strings" | ||
|
|
||
| "github.com/Microsoft/hcsshim" |
Author
There was a problem hiding this comment.
I changed these codes in the vscode editor. It looks like that my editor auto run the gofmt command for me.
should I manually make it recover as before?
Owner
|
@carlory thanks for your fix! can you help me understand when this issue occurs? is this when you work with a new version of CNI? |
Owner
|
@madhanrm @dineshgovindasamy change looks reasonable to me - please take a look and comment if you disagree. Thanks |
Owner
|
no dont revert, gofmt is required
…On Mon, Feb 5, 2018 at 6:29 PM, 帝俊 ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/hns/endpoint_windows.go
<#4 (comment)>:
> "log"
"net"
"strings"
+
+ "github.com/Microsoft/hcsshim"
@rakelkar <https://github.com/rakelkar>
I changed these codes in the vscode editor. It looks like that my editor
auto run the gofmt command for me.
should I manually make it recover as before?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADQphaY7q-EhBqNlCzL4i4yCF-CthuDFks5tR7kMgaJpZM4R44AB>
.
--
Rakesh Kelkar
|
Author
|
@rakelkar I updated the description of this issue. |
Owner
|
LGTM |
dineshgovindasamy
pushed a commit
that referenced
this pull request
Feb 12, 2018
* fix no valid addresses caused by lack of ip's version * fix nit * fmt err
madhanrm
pushed a commit
that referenced
this pull request
Feb 12, 2018
* fix no valid addresses caused by lack of ip's version * fix nit * fmt err
madhanrm
pushed a commit
that referenced
this pull request
Mar 5, 2018
* fix no valid addresses caused by lack of ip's version * fix nit * fmt err
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I build the win-overlay.exe from the windowsCni branch. but the winoverlay.exe couldn't create the PodSandbox even though it can correctly create hnsendpoints in the vxlan0 overlay network when I
create a deployment resource on my linux master node.
the last step of cmdAdd is printing result. the types.PrintResult finally call this convertTo020 func to get a types020.Result. However this hns.ConstructResult(hnsNetwork, hnsEndpoint) forgot to add the ip's version for current.IPConfig, so we got the err "no valid addresses".