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

daemon, ipam: omit IPAM mode check before calling ipam.Allocator.RestoreFinished #25041

Merged
merged 1 commit into from Apr 21, 2023

Conversation

tklauser
Copy link
Member

The IPAM modes which were left out of the condition (kubernetes, cluster-pool and delegated-plugin) all implement a noop RestoreFinished method in their allocator.

The kubernetes and cluster-pool modes uses hostscopeAllocator:

cilium/pkg/ipam/ipam.go

Lines 116 to 128 in e84e99f

case ipamOption.IPAMKubernetes, ipamOption.IPAMClusterPool:
log.WithFields(logrus.Fields{
logfields.V4Prefix: nodeAddressing.IPv4().AllocationCIDR(),
logfields.V6Prefix: nodeAddressing.IPv6().AllocationCIDR(),
}).Infof("Initializing %s IPAM", c.IPAMMode())
if c.IPv6Enabled() {
ipam.IPv6Allocator = newHostScopeAllocator(nodeAddressing.IPv6().AllocationCIDR().IPNet)
}
if c.IPv4Enabled() {
ipam.IPv4Allocator = newHostScopeAllocator(nodeAddressing.IPv4().AllocationCIDR().IPNet)
}

and thus its noop RestoreFinished method:

// RestoreFinished marks the status of restoration as done
func (h *hostScopeAllocator) RestoreFinished() {}

The delegated-plugin mode uses noopAllocator:

cilium/pkg/ipam/ipam.go

Lines 147 to 154 in e84e99f

case ipamOption.IPAMDelegatedPlugin:
log.Info("Initializing no-op IPAM since we're using a CNI delegated plugin")
if c.IPv6Enabled() {
ipam.IPv6Allocator = &noOpAllocator{}
}
if c.IPv4Enabled() {
ipam.IPv4Allocator = &noOpAllocator{}
}

and thus its noop RestoreFinished method:

func (n *noOpAllocator) RestoreFinished() {
}

@tklauser tklauser added kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. sig/ipam IP address management, including cloud IPAM labels Apr 21, 2023
@tklauser tklauser requested a review from a team as a code owner April 21, 2023 13:08
@tklauser tklauser requested a review from pippolo84 April 21, 2023 13:08
…oreFinished

The IPAM modes which were left out of the condition (kubernetes,
cluster-pool and delegated-plugin) all implement a noop RestoreFinished
method in their allocator.

The kubernetes and cluster-pool modes uses hostscopeAllocator:

  https://github.com/cilium/cilium/blob/e84e99f16ed0862dc6fd79c09480eb7e08e50ad2/pkg/ipam/ipam.go#L116-L128

and thus its noop RestoreFinished method:

https://github.com/cilium/cilium/blob/e84e99f16ed0862dc6fd79c09480eb7e08e50ad2/pkg/ipam/hostscope.go#L98-L99

The delegated-plugin mode uses noopAllocator:

  https://github.com/cilium/cilium/blob/e84e99f16ed0862dc6fd79c09480eb7e08e50ad2/pkg/ipam/ipam.go#L147-L154

and thus its noop RestoreFinished method:

  https://github.com/cilium/cilium/blob/e84e99f16ed0862dc6fd79c09480eb7e08e50ad2/pkg/ipam/noop_allocator.go#L42-L43

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser force-pushed the pr/tklauser/ipam-restore-finished-noop branch from 01d45b4 to 022eb85 Compare April 21, 2023 13:09
@tklauser
Copy link
Member Author

/test

Copy link
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

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

🚀

@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 Apr 21, 2023
@ldelossa ldelossa merged commit fc697d5 into main Apr 21, 2023
55 of 56 checks passed
@ldelossa ldelossa deleted the pr/tklauser/ipam-restore-finished-noop branch April 21, 2023 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup This includes no functional changes. 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/ipam IP address management, including cloud IPAM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants