Skip to content

Minor endpoint/ipcache/test refactoring for CIDR+L4 work#3884

Merged
tgraf merged 5 commits intocilium:masterfrom
joestringer:submit/cidr-refactor-other
Apr 26, 2018
Merged

Minor endpoint/ipcache/test refactoring for CIDR+L4 work#3884
tgraf merged 5 commits intocilium:masterfrom
joestringer:submit/cidr-refactor-other

Conversation

@joestringer
Copy link
Copy Markdown
Member

@joestringer joestringer commented Apr 25, 2018

[Split out from #3835 for easier review]

This is a short series of misc refactoring patches I picked up on my way towards #1685, split out for easier review.


This change is Reviewable

@joestringer joestringer added pending-review area/daemon Impacts operation of the Cilium daemon. labels Apr 25, 2018
@joestringer joestringer requested review from a team and ianvernon as code owners April 25, 2018 06:33
@joestringer joestringer force-pushed the submit/cidr-refactor-other branch from 9bb8af3 to 99d323b Compare April 25, 2018 06:34
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

Copy link
Copy Markdown
Contributor

@raybejjani raybejjani left a comment

Choose a reason for hiding this comment

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

a small naming change. Don't block merging on me.

Comment thread pkg/ipcache/ipcache.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This name really confused me. I thought it would touch the IPCache (I hadn't realised it was package function). Could we name it UpsertToKVStore or something equally verbose? (same for DeleteIP below)
Since we mention how this change propagates, could we add a similar statement to Upsert? (It's available instantly with Upsert but there can be a delay with UpsertIP).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

funny, in the full PR I ended up doing this anyway, but it wasn't part of the regular refactoring. I'll do this.

Soon, it might be worth splitting the ipcache kvstore push stuff from the in-memory / kvstore event handling piece. That would clarify things a bit.

@joestringer joestringer force-pushed the submit/cidr-refactor-other branch from 99d323b to f554929 Compare April 25, 2018 17:30
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

@joestringer joestringer dismissed raybejjani’s stale review April 25, 2018 17:33

Addressed comments.

Copy link
Copy Markdown
Member

@ianvernon ianvernon left a comment

Choose a reason for hiding this comment

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

LGTM apart from one requested change that doesn't need re-review.

Comment thread pkg/endpoint/policy.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you make DeleteIP mirror UpsertIPToKVStore so that it is clear that it is being deleted from the key-value store, and not the ipcache itself directly?

Copy link
Copy Markdown
Contributor

@raybejjani raybejjani left a comment

Choose a reason for hiding this comment

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

Thanks for switching it up! I'll second @ianvernon on also changing ipcache.DeleteIP but otherwise, ship it!

Comment thread test/runtime/Policies.go Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: Can we make this Failed to clear policy after egress test to make it more obvious in logs that something failed.

Commit 6c35fbe ("pkg/policy: fix merging of L4-related policy")
introduced similar logic to this expansion of the empty endpointselector
slice, so this could should be unused. Remove it.

Signed-off-by: Joe Stringer <joe@covalent.io>
This makes the two lookup functions diverge less.

Signed-off-by: Joe Stringer <joe@covalent.io>
This will improve the code reuse for when IP prefixes need to be pushed
into the kvstore.

Signed-off-by: Joe Stringer <joe@covalent.io>
Signed-off-by: Joe Stringer <joe@covalent.io>
Refactor some of the calls in TestEgressToHost() so that a new test in
the same context can share the same setup / teardown logic.

Signed-off-by: Joe Stringer <joe@covalent.io>
@joestringer joestringer force-pushed the submit/cidr-refactor-other branch from f554929 to c4f4f47 Compare April 25, 2018 18:51
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

@joestringer
Copy link
Copy Markdown
Member Author

Fixed up the minor nits, thanks for the review everyone.

@joestringer joestringer added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. and removed pending-review labels Apr 25, 2018
@tgraf tgraf merged commit 43dd762 into cilium:master Apr 26, 2018
@joestringer joestringer deleted the submit/cidr-refactor-other branch April 26, 2018 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Impacts operation of the Cilium daemon. ready-to-merge This PR has passed all tests and received consensus from code owners to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants