Skip to content

Conversation

@vakalapa
Copy link
Contributor

@vakalapa vakalapa commented Feb 1, 2021

This fix involves ignoring any Add, Update or Delete Pod events for Hostnetwork Pods.

@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #776 (bd5c2c8) into master (c133472) will increase coverage by 0.24%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #776      +/-   ##
==========================================
+ Coverage   41.68%   41.93%   +0.24%     
==========================================
  Files         142      142              
  Lines       13778    13789      +11     
==========================================
+ Hits         5744     5782      +38     
+ Misses       7317     7285      -32     
- Partials      717      722       +5     

@vakalapa vakalapa changed the title Ignoring hostnetwork pods from being added into Ipsets [NPM] Ignoring hostnetwork pods from being added into Ipsets Feb 2, 2021

allNs, err := newNs(util.KubeAllNamespacesFlag)
if err != nil {
panic(err.Error)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't panic on tests. use t.Fatal. same for below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logged a work item to fix this for all NPM tests.


ipsMgr := ipsm.NewIpsetManager()
if err := ipsMgr.Save(util.IpsetTestConfigFile); err != nil {
t.Errorf("TestAddHostNetworkPod failed @ ipsMgr.Save")
Copy link
Contributor

Choose a reason for hiding this comment

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

add error to test logging. gives more context as to why something failed. same for below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logged a work item to fix this for all NPM tests.

},
}

npMgr.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

curious about locks being taken, since this variable is scoped to the test. what else could be modifying this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are all compartmentalized tests, in the current state they are in, no two tests (i have to double check) share the npMgr. So the lock should be scop is limited to a given testcase.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose my question is, is it necessary to take locks?

Copy link
Member

@matmerr matmerr left a comment

Choose a reason for hiding this comment

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

approved, the npm test suite needs some help for sure :)

@vakalapa vakalapa merged commit 899c3a3 into master Feb 2, 2021
vakalapa added a commit that referenced this pull request Feb 2, 2021
* Ignoring hostnetwork pods from being added into Ipsets

* generalizing the check on hostnetwork pod

* Adding tests for add, update and delete hostnetwork pods
vakalapa added a commit that referenced this pull request Feb 3, 2021
…777)

* Ignoring hostnetwork pods from being added into Ipsets

* generalizing the check on hostnetwork pod

* Adding tests for add, update and delete hostnetwork pods
@vakalapa vakalapa deleted the vakr/npmhostnetignore branch February 12, 2021 19:02
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.

5 participants