Conversation
90a5883 to
4b760a4
Compare
Move code to iterate over interfaces and addresses into the InstanceMap. This allows to defer deep copying until it is really necessary. This also allows to move the logic to reserve IPs of all interfaces of all instances into the generic GroupPoolAllocator for reuse in future IPAM code. Signed-off-by: Thomas Graf <thomas@cilium.io>
Fixes:
```
WARNING: DATA RACE
Read at 0x00c0001b48c0 by goroutine 37:
github.com/cilium/cilium/pkg/ipam.(*nodeOperationsMock).PrepareIPAllocation()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager_test.go:103 +0x1c5
github.com/cilium/cilium/pkg/ipam.(*Node).determineMaintenanceAction()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:492 +0x184
github.com/cilium/cilium/pkg/ipam.(*Node).maintainIPPool()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:528 +0x53
github.com/cilium/cilium/pkg/ipam.(*Node).MaintainIPPool()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:613 +0x69
github.com/cilium/cilium/pkg/ipam.(*NodeManager).Update.func1()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager.go:205 +0x8b
github.com/cilium/cilium/pkg/trigger.(*Trigger).waiter()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/trigger/trigger.go:206 +0x4b9
Previous write at 0x00c0001b48c0 by goroutine 35:
github.com/cilium/cilium/pkg/ipam.(*nodeOperationsMock).AllocateIPs()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager_test.go:111 +0x117
github.com/cilium/cilium/pkg/ipam.(*Node).maintainIPPool()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:564 +0xa0d
github.com/cilium/cilium/pkg/ipam.(*Node).MaintainIPPool()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:613 +0x69
github.com/cilium/cilium/pkg/ipam.(*NodeManager).Update.func1()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager.go:205 +0x8b
github.com/cilium/cilium/pkg/trigger.(*Trigger).waiter()
/home/vagrant/go/src/github.com/cilium/cilium/pkg/trigger/trigger.go:206 +0x4b9
```
Signed-off-by: Thomas Graf <thomas@cilium.io>
Don't hold any locks when calling into IPAM specific operations. Use node.mutex exclusively to protect data access and keep locking periods as short as possible. Signed-off-by: Thomas Graf <thomas@cilium.io>
This removes the need to track the CiliumNode resource in the Azure specific code entirely. Signed-off-by: Thomas Graf <thomas@cilium.io>
There is no point in attempting recalculation of required addresses unless the resource has been attached. Signed-off-by: Thomas Graf <thomas@cilium.io>
Ideally, the pool ID is known. If not known, the list of pools can be searched to identify the correct pool. Signed-off-by: Thomas Graf <thomas@cilium.io>
Signed-off-by: Thomas Graf <thomas@cilium.io>
Signed-off-by: Thomas Graf <thomas@cilium.io>
4b760a4 to
71f1000
Compare
Signed-off-by: Thomas Graf <thomas@cilium.io>
Contributor
Author
|
test-me-please |
Contributor
Author
|
test-me-please |
errordeveloper
approved these changes
Mar 26, 2020
HadrienPatte
added a commit
that referenced
this pull request
Apr 14, 2026
While going through the `pkg/ipam` package, I noticed a typo in a comment that drew my attention to a specific struct definition, `InterfaceRevision`. While reading about its `Fingerprint` field, I got curious about how and where that field was used. After a deeper investigation, I discovered that not only is this `Fingerprint` field currently never set or read, but it has never been ever since its introduction 6 years ago (#10691). At that point I figured that there is no short or long term plans to start using that field so it can be removed, but since `InterfaceRevision` only had two fields, removing one of them makes it an unnecessary wrapper struct. So this PR removes the `InterfaceRevision` struct that used to have an `Resource` (`Interface`) and a `Fingerprint` (`string`) fields and replace it with that `Interface`. This eliminates the `.Resource` indirection at every call site. Also since the whole struct definition is now gone, the typo that started this whole thing is gone as well. Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 16, 2026
While going through the `pkg/ipam` package, I noticed a typo in a comment that drew my attention to a specific struct definition, `InterfaceRevision`. While reading about its `Fingerprint` field, I got curious about how and where that field was used. After a deeper investigation, I discovered that not only is this `Fingerprint` field currently never set or read, but it has never been ever since its introduction 6 years ago (#10691). At that point I figured that there is no short or long term plans to start using that field so it can be removed, but since `InterfaceRevision` only had two fields, removing one of them makes it an unnecessary wrapper struct. So this PR removes the `InterfaceRevision` struct that used to have an `Resource` (`Interface`) and a `Fingerprint` (`string`) fields and replace it with that `Interface`. This eliminates the `.Resource` indirection at every call site. Also since the whole struct definition is now gone, the typo that started this whole thing is gone as well. Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.