Skip to content

Conversation

@chappleg
Copy link
Contributor

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:

@codecov
Copy link

codecov bot commented Jun 24, 2019

Codecov Report

Merging #369 into master will increase coverage by 0.91%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
npm/pod.go 61.85% <0%> (-3.32%) ⬇️
npm/namespace.go 55.76% <0%> (-3%) ⬇️
npm/ipsm/ipsm.go 51.9% <0%> (-0.76%) ⬇️
npm/iptm/iptm.go 40.56% <0%> (-0.24%) ⬇️
telemetry/telemetry.go 23.88% <0%> (ø) ⬆️
log/stdapi.go 0% <0%> (ø) ⬆️
telemetry/cnstelemetry.go 0% <0%> (ø) ⬆️
npm/nwpolicy.go 43.75% <0%> (+1.1%) ⬆️
npm/npm.go 1.88% <0%> (+1.88%) ⬆️
log/logger.go 54.54% <0%> (+7.54%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6bff8e...ac60ad6. Read the comment docs.

Copy link
Member

@tamilmani1989 tamilmani1989 left a 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 {

Copy link
Member

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`
Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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},
Copy link
Member

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?

Copy link
Contributor

@jaer-tsun jaer-tsun left a 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" {
Copy link
Contributor

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
Copy link
Contributor

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 jaer-tsun self-requested a review July 3, 2019 18:28
jaer-tsun
jaer-tsun previously approved these changes Jul 3, 2019
Copy link
Contributor

@jaer-tsun jaer-tsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tamilmani1989
Copy link
Member

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

@t-chappl Can you add unit tests that I mentioned ?

@chappleg
Copy link
Contributor Author

chappleg commented Jul 3, 2019

@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?

Copy link
Member

@tamilmani1989 tamilmani1989 left a 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")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space

@chappleg
Copy link
Contributor Author

chappleg commented Jul 3, 2019

@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.

@chappleg
Copy link
Contributor Author

chappleg commented Jul 3, 2019

@tamilmani1989 I tried the scenarios on windows and they worked fine.

Copy link
Member

@tamilmani1989 tamilmani1989 left a 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.

@tamilmani1989 tamilmani1989 merged commit 34cbf82 into Azure:master Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants