Skip to content

Conversation

squeed
Copy link
Contributor

@squeed squeed commented Nov 6, 2023

The "new" ipcache API (InjectLabels()) will delete a prefix if there are no metadata entries left. However, this behavior is not desirable when a user of the old APIs has taken control of this prefix. In order to prevent this, the field "createdFromMetadata" is set on all "new-style" prefixes to indicate they are safe to delete.

However, in the case where a prefix is first injected via the metadata layer, then transitions to the old APIs, it should not be deleted. In other words:

  1. UpsertMetadata(A)
  2. UpsertGeneratedIdentities(A)
  3. RemoveMetadata(A)

should not delete A from the bpf ipcache, just the metadata layer.

This change prevents that by ensuring the bit is always set.

The "new" ipcache API (InjectLabels()) will delete a prefix if there are
no metadata entries left. However, this behavior is not desirable when a
user of the old APIs has taken control of this prefix. In order to
prevent this, the field "createdFromMetadata" is set on all "new-style"
prefixes to indicate they are safe to delete.

However, in the case where a prefix is first injected via the metadata
layer, then transitions to the old APIs, it should not be deleted. In
other words:

1. UpsertMetadata(A)
2. UpsertGeneratedIdentities(A)
3. RemoveMetadata(A)

should *not* delete A from the bpf ipcache, just the metadata layer.

This change prevents that by ensuring the bit is always set.

Signed-off-by: Casey Callendrello <cdc@isovalent.com>
@squeed squeed added the release-note/misc This PR makes changes that have no direct user impact. label Nov 6, 2023
@squeed squeed requested a review from a team as a code owner November 6, 2023 21:09
@squeed squeed requested a review from jrajahalme November 6, 2023 21:09
@squeed
Copy link
Contributor Author

squeed commented Nov 6, 2023

Split out from #28673 on @christarazi's request.

@squeed squeed requested review from gandro and removed request for jrajahalme November 6, 2023 21:11
@squeed
Copy link
Contributor Author

squeed commented Nov 6, 2023

Requesting @gandro's review, as he approved the original commit.

@squeed
Copy link
Contributor Author

squeed commented Nov 6, 2023

/test

@christarazi christarazi added area/daemon Impacts operation of the Cilium daemon. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. kind/bug This is a bug in the Cilium logic. labels Nov 6, 2023
Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Thanks!

@squeed squeed closed this Nov 7, 2023
@squeed squeed reopened this Nov 7, 2023
@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 Nov 7, 2023
@christarazi christarazi merged commit e40fd08 into cilium:main Nov 7, 2023
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. 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-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants