Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth: Switch to observing identity changes #26375

Merged

Conversation

mhofstetter
Copy link
Member

@mhofstetter mhofstetter commented Jun 20, 2023

Observe the identity changes via the CachingIdentityAllocator instead of using CiliumIdentity CRD directly. This both fixes the issue of having two informers (and thus double the bandwidth), but it also allows auth to work with the kvstore identity allocation
backend.

In addition, the the auth map garbage collection has been refactored to use the events (deleted nodes, deleted
identities) only to update the internal state - whereas the actual GC is combined to a timer based job. This way we prevent events resulting in errors - that wouldn't be retried in case of the observable identity allocator (therefore this refactoring has become mandatory).

It's recommended to review the individual commits for more clarity & more context.

Depends on: #26373
Fixes: #25898

@mhofstetter mhofstetter added kind/bug This is a bug in the Cilium logic. release-note/misc This PR makes changes that have no direct user impact. dont-merge/blocked Another PR must be merged before this one. area/servicemesh GH issues or PRs regarding servicemesh release-blocker/1.14 This issue will prevent the release of the next version of Cilium. feature/authentication labels Jun 20, 2023
@mhofstetter mhofstetter force-pushed the pr/mhofstetter/auth-observable-id-allocator branch 5 times, most recently from 20766fc to 2bdb5ab Compare June 22, 2023 10:42
@joestringer joestringer added release-note/bug This PR fixes an issue in a previous release of Cilium. and removed release-note/misc This PR makes changes that have no direct user impact. labels Jun 22, 2023
@mhofstetter mhofstetter force-pushed the pr/mhofstetter/auth-observable-id-allocator branch 5 times, most recently from bbfc60c to eb5eb6f Compare June 27, 2023 09:57
@mhofstetter
Copy link
Member Author

dependent PR #26373 (making the identity allocator observable) has been merged

-> will remove dont-merge/blocked and undraft

@mhofstetter mhofstetter removed the dont-merge/blocked Another PR must be merged before this one. label Jun 27, 2023
@mhofstetter mhofstetter marked this pull request as ready for review June 27, 2023 09:58
@mhofstetter mhofstetter requested review from a team as code owners June 27, 2023 09:58
@mhofstetter
Copy link
Member Author

/test

joamaki and others added 10 commits June 27, 2023 22:45
Observe the identity changes via the CachingIdentityAllocator
instead of using CiliumIdentity CRD directly. This both fixes
the issue of having two informers (and thus double the bandwidth),
but it also allows auth to work with the kvstore identity allocation
backend.

Co-authored-by: Marco Hofstetter <marco.hofstetter@isovalent.com>

Signed-off-by: Jussi Maki <jussi@isovalent.com>
This commit renames the helm value `authentication.expiredGCInterval` to
`authentication.gcInterval` as it will be used for multiple types of
auth related GC's.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Latest changes reflect deleted identities and nodes only in the internal state of the
garbage collector without deleting the related entries immediately.

Therefore, this commit changes the auth map gc interval from `15m` to
`5m` which reflects the changes faster in the map itself.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Currently, auth map entries related to a deleted cilium identity are
immediately deleted when the event has been received. The actual
deletion might result in errors, which no longer can be reported back to
the IdentityAllocator which emits the events.

To prevent events result in errors, the events should no
longer delete auth map entries.

Therefore, this commit refactors that the deletion information is stored
within the garbage collector, and the actual garbage collection run uses
these information to cleanup the map.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
This commit reorders the functions within the garbage collector

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Currently, auth map entries related to a deleted node are
immediately deleted when the event has been received.

To prevent events result in errors, the events should no
longer delete auth map entries.

Therefore, this commit refactors that the deletion information is stored
within the garbage collector, and the actual garbage collection run uses
these information to cleanup the map.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
This commit combines the different timer based auth map gc jobs into a
single job.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
This commit separates the existing auth map gc tests into multiple tests
per "type"

* identities
* nodes
* policies
* expiration

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
This commit cleans up the auth module.

* improve comments
* renamed newAuthManager -> registerAuthManager
* grouped params in authManagerParams
* rename gc job names
* split registration into instantiation & job/lifecycle registration
  sections

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
@sayboras sayboras force-pushed the pr/mhofstetter/auth-observable-id-allocator branch from eb5eb6f to 734794b Compare June 27, 2023 12:45
@sayboras
Copy link
Member

/test

@mhofstetter
Copy link
Member Author

/ci-multicluster

Copy link
Member

@jrajahalme jrajahalme left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Member

@meyskens meyskens left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

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

LGTM ✔️

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 30, 2023
@sayboras sayboras merged commit 28de75d into cilium:main Jun 30, 2023
65 checks passed
@sayboras
Copy link
Member

This PR was marked as release-blocker for 1.14, so nominate it for backport. Feel free to let us know if you think otherwise. Thanks.

@sayboras sayboras added the needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch label Jun 30, 2023
@mhofstetter mhofstetter deleted the pr/mhofstetter/auth-observable-id-allocator branch July 3, 2023 05:31
@joamaki joamaki mentioned this pull request Jul 5, 2023
23 tasks
@joamaki joamaki added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Jul 5, 2023
@jibi jibi added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/servicemesh GH issues or PRs regarding servicemesh backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. feature/authentication kind/bug This is a bug in the Cilium logic. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-blocker/1.14 This issue will prevent the release of the next version of Cilium. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auth: Support garbage collection for KVStore Identity Backend
7 participants