Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jrajahalme
Copy link
Member

@jrajahalme jrajahalme commented May 30, 2024

Reopen ipcache whenever a new NetworkPolicy stream is opened. This way we get access to the new ipcache after cilium agent restart.

@jrajahalme jrajahalme added the bug Something isn't working label May 30, 2024
@jrajahalme jrajahalme requested a review from a team as a code owner May 30, 2024 13:02
@jrajahalme jrajahalme requested review from mhofstetter and removed request for a team May 30, 2024 13:02
@jrajahalme jrajahalme marked this pull request as draft May 30, 2024 13:02
@jrajahalme jrajahalme force-pushed the ipcache-reopen-on-cilium-restart branch from ebcb69f to 178cc0f Compare May 30, 2024 14:19
@jrajahalme jrajahalme requested a review from sayboras May 30, 2024 14:29
@jrajahalme jrajahalme marked this pull request as ready for review May 30, 2024 14:40
@jrajahalme jrajahalme force-pushed the ipcache-reopen-on-cilium-restart branch from 178cc0f to f6c553b Compare May 30, 2024 16:27
Copy link
Member

@mhofstetter mhofstetter left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the detailed commit messages!

Does the same issue exist with the conntrack map? (or does the Agent behaves differently for this map(s) (global & local)?

@jrajahalme
Copy link
Member Author

Does the same issue exist with the conntrack map? (or does the Agent behaves differently for this map(s) (global & local)?

AFAIK conntrack maps are not recreated on agent restart. CT maps are populated by the datapath, so it would be rather hard to create a new one from the userspace.

@jrajahalme jrajahalme force-pushed the ipcache-reopen-on-cilium-restart branch from f6c553b to 8695b08 Compare May 31, 2024 14:34
@jrajahalme
Copy link
Member Author

Also had to move the reopen to happen even if there is no difference in the policy!

@jrajahalme jrajahalme requested a review from sayboras May 31, 2024 14:37
Date:   2024-05-31 16:38:45 +0200

Author: Jarno Rajahalme <[email protected]>
Date:   2024-05-31 16:32:26 +0200

bpf: Allow reopening a map

close any possible existing map before opening a new one. This allows
Open() to be called again to reopen the map.

Store the path passed to open() for later re-try during lookup(), it the
open failed.

Signed-off-by: Jarno Rajahalme <[email protected]>
Move ipcache singleton management from bpf_metadata.cc to ipcache.cc so
that the sigleton can be accessed without going through
bpf_metadata. This avoids Bazel import cycle in following commits.

Add a new static methods to ipcache to create and get the singleton.

Signed-off-by: Jarno Rajahalme <[email protected]>
Make server factory context available by storing it in a member.

Signed-off-by: Jarno Rajahalme <[email protected]>
Add GrpcMuxImpl wrapper class to get access to onStreamEstablished(), and
implement isNewStream() that returns 'true' on the first call after a new
stream has been established.

Signed-off-by: Jarno Rajahalme <[email protected]>
Reopen ipcache map each time after a new gRPC stream has been established
for Network Policy Discovery Service. This is necessary to get access to
the new IP Cache map Cilium Agent creates on restart.

Signed-off-by: Jarno Rajahalme <[email protected]>
@jrajahalme jrajahalme force-pushed the ipcache-reopen-on-cilium-restart branch from 8695b08 to 73dc7da Compare May 31, 2024 14:39
@jrajahalme jrajahalme added this pull request to the merge queue May 31, 2024
Merged via the queue into main with commit c9e6d84 May 31, 2024
@jrajahalme jrajahalme deleted the ipcache-reopen-on-cilium-restart branch May 31, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants