-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipcache: Introduce new asynchronous API
Introduce a new generic API for associating information with the IPs in the IPCache, which accounts for multiple sources of information such as labels coming from different resources (eg Services -> reserved:kube-apiserver, NetPol -> CIDR labels). The primary core of this API is the UpsertMetadata(...) function, which takes the following parameters: - prefix: IP (range) that this info applies to; - src: info source of the information; - resource: specific resource name in the information source, - aux: variable length list of information to associate with the prefix. 'aux' is typed as IPMetadata, which is effectively just an interface{} to allow any information to be associated with the IPCache. Developers should read the comments around IPMetadata and expand the IPCache package in the relevant areas (particularly pkg/ipcache/types.go and the InjectLabels() call) to ensure that the IPCache package correctly handles the new information and effectively merges the different sources of info correctly. After info is upserted into the IPCache via this new API, it will automatically trigger an out-of-band resolution of what the new IPCache entry for the prefix should look like, taking into account each piece of source information from various resources. In this patch, we switch the current kube-apiserver logic over to the new API as an initial example, removing the need for the caller to trigger label injection since the new API will automatically schedule this. Future work will expand this to switch other subsystems over to the new APIs, introducing new resourceInfo fields and merging logic in the ipcache package to decide how complementary (or even conflicting) information should be combined in order to generate IPCache entries. Signed-off-by: Joe Stringer <joe@cilium.io> Signed-off-by: Chris Tarazi <chris@isovalent.com>
- Loading branch information
1 parent
454df0c
commit e637814
Showing
6 changed files
with
50 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters