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

ipam-node: Remove stale pool entries from the store #26

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

ykulazhenkov
Copy link
Collaborator

remove the pool data from the store if the pool has no allocations and if information about the pool is unavailable in the Kubernetes API

closes #25

pkg/ipam-node/cleaner/cleaner.go Show resolved Hide resolved
g.Expect(err).NotTo(HaveOccurred())
defer store.Cancel()
g.Expect(store.GetReservationByID(testPool1, "id1", testIFName)).NotTo(BeNil())
g.Expect(store.GetReservationByID(testPool1, "id2", testIFName)).NotTo(BeNil())
g.Expect(store.GetReservationByID(testPool1, "id3", testIFName)).To(BeNil())
g.Expect(store.GetReservationByID(testPool2, "id4", testIFName)).To(BeNil())
g.Expect(store.GetReservationByID(testPool2, "id5", testIFName)).To(BeNil())
// pool1 has entries, should be kept in the store
Copy link
Collaborator

Choose a reason for hiding this comment

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

imo it would be clearer if we check what pools are left in store by listing and checking the pools.
there is a bit of a "hidden" knowledge here that if last reserved IP is nil then the only reason for this is that the pool does not exist.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, make sense. fixed

remove the pool data from the store if the pool has
no allocations and if information about the pool is
unavailable in the Kubernetes API

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
@adrianchiris adrianchiris merged commit 9bd60b3 into Mellanox:main Aug 8, 2023
9 checks passed
@ykulazhenkov ykulazhenkov deleted the remove-stale-pool branch June 11, 2024 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove stale pool entries from the store
2 participants