Repository navigation
fix(operator): drop identity mapping when allocator no longer knows the identity - #2910
Vedant Burgul (burgulvedant) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Beegii Khurelsukh (@BeegiiK) orangejuice could one of you please run /azp run so the pipelines can start? Happy to fix anything they report. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…he identity DecrementReference returned early when LookupIdentityByID found no identity, leaving the labelIdentities entry in the map for the lifetime of the process. If the allocator no longer has the identity there is nothing left to release, so remove the mapping too.
973e3b7 to
be301e7
Compare
|
Evan Baker (@rbtr) thanks for running /azp run earlier. I have since rebased on main and signed the commit, so the branch is up to date and shows as Verified. Because the commit changed, could you approve the new GitHub Actions workflow runs and trigger /azp run once more? Beegii Khurelsukh (@BeegiiK) orangejuice when CI is green, a review would be appreciated. Happy to adjust the change if you want it done differently. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
Deleting the identity mapping after a lookup miss can strand allocator-local references for Pods sharing an identity, so the release path must preserve the mapping until the final reference is released.
1 open issue
What changed in this PR
This PR targets one source of stale identity mappings in the operator as a partial fix for #2647; it does not claim to resolve the full reported memory growth.
Changes:
- Deletes the label-to-identity mapping when
DecrementReferencecannot look up the identity. - Adds comments explaining the intended cleanup behavior.
| File | Description |
|---|---|
pkg/controllers/operator/cilium-crds/endpoint/identitymanager_linux.go |
Adds mapping cleanup to the identity lookup-miss branch. |
Review effort: Balanced
| // The allocator no longer knows this identity, so there is nothing left to release. | ||
| // Drop our mapping too, otherwise it would be kept for the lifetime of the process. | ||
| im.l.Warn("expected identity for id", "identity", id) | ||
| delete(im.labelIdentities, sortedLabels) | ||
| return |

Related to #2647 (partial fix, does not close it).
What
DecrementReference returned early when LookupIdentityByID found no identity, leaving the labelIdentities entry in the map for the lifetime of the process. If the allocator no longer has the identity there is nothing left to release, so this removes the mapping too.
Scope
This removes one source of stale entries. It is not shown to explain the full memory growth in #2647. The reporter still saw memory held after deleting all CiliumIdentities, so part of it may be in the allocator's local keys or the hourly SyncInterval.
Testing
Not run locally. The change is formatted with gofmt. No unit test is included because I could not confirm how the allocator reaches the state where the lookup returns nothing. Happy to add one if a maintainer can point me to a way to set that up.