-
Notifications
You must be signed in to change notification settings - Fork 260
Read network configuration from a file on azure stack #369
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #369 +/- ##
==========================================
+ Coverage 40.01% 40.93% +0.91%
==========================================
Files 25 25
Lines 3546 3518 -28
==========================================
+ Hits 1419 1440 +21
+ Misses 1927 1870 -57
- Partials 200 208 +8
Continue to review full report at Codecov.
|
tamilmani1989
left a comment
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.
PR looks good except for minor comments. Can we have few unit tests with multi nic configuration (both sdn and local). One will be primary and rest are secondary
ipam/mas.go
Outdated
| } | ||
|
|
||
| func populateAddressSpace(localAddressSpace *addressSpace, sdnInterfaces *NetworkInterfaces, localInterfaces []net.Interface) error { | ||
|
|
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.
space damage
| // Minimum time interval between consecutive queries. | ||
| masQueryInterval = 10 * time.Second | ||
| defaultLinuxFilePath = "/etc/kubernetes/interfaces.json" | ||
| defaultWindowsFilePath = `c:\k\interfaces.json` |
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.
just a small question -> does this json file exists after reboot?
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.
Yes
ipam/mas.go
Outdated
| decoder := json.NewDecoder(resp.Body) | ||
| err = decoder.Decode(&obj) | ||
| // Set the local address space as active. | ||
| err = source.sink.setAddressSpace(local) |
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.
we moved to this standard few months back. If the function returns only error, we can have this std.
if err := source.sink.setAddressSpace(local); err != nil {
return err
}
ipam/mas.go
Outdated
| return err | ||
| } | ||
|
|
||
| err = populateAddressSpace(local, sdnInterfaces, localInterfaces) |
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.
change this also to below std
ipam/mas.go
Outdated
| } | ||
|
|
||
| interfaces := &NetworkInterfaces{} | ||
| err = json.Unmarshal(data, interfaces) |
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.
change the coding std
| IPAddresses: []IPAddress{ | ||
| {Address: "1.1.1.5", IsPrimary: true}, | ||
| {Address: "1.1.1.6", IsPrimary: false}, | ||
| {Address: "1.1.1.6", IsPrimary: false}, |
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.
can we have one more valid address and check the length of address records as 2?
jaer-tsun
left a comment
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.
general comments
ipam/mas.go
Outdated
| if queryInterval == 0 { | ||
| queryInterval = masQueryInterval | ||
| var filePath string | ||
| if runtime.GOOS == "windows" { |
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.
"windows" can be a const
ipam/mas.go
Outdated
| s.sink = nil | ||
| func (source *masSource) stop() { | ||
| source.sink = nil | ||
| return |
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.
return can be removed
jaer-tsun
left a comment
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
@t-chappl Can you add unit tests that I mentioned ? |
|
@tamilmani1989 did you see the new test I pushed this morning? It has multiple hardware and sdn interfaces. Are there other cases you would like me to cover? |
tamilmani1989
left a comment
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.
Sorry i missed that. unit tests looks good. just a minor comment. Have you tested in windows also(the scenarios you mentioned in email)?
ipam/mas.go
Outdated
| } | ||
|
|
||
| log.Printf("[ipam] Address space successfully populated from config file") | ||
|
|
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.
remove space
|
@tamilmani1989 I initially test the scenarios only on linux but I will try them out on windows right now. Sorry, I should have done it sooner. |
|
@tamilmani1989 I tried the scenarios on windows and they worked fine. |
tamilmani1989
left a comment
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.
@t-chappl Thanks for this PR. lgtm.
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: