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

feat: support allocating IP with index from node chunk #55

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vasrem
Copy link
Collaborator

@vasrem vasrem commented Oct 9, 2024

This feature enables us to allocate the IP that is offset by index from the start of the range allocated for a particular node using CNI args. It is useful when a particular workload that runs as DaemonSet wants to allocate always the same IP, even if it's recreated.

This feature enables us to allocate the IP that is offset by index from
the start of the range allocated for a particular node using CNI args.
It is useful when a particular workload that runs as DaemonSet wants to
allocate always the same IP, even if it's recreated.

Signed-off-by: Vasilis Remmas <[email protected]>
@coveralls
Copy link

coveralls commented Oct 9, 2024

Coverage Status

coverage: 70.108% (-0.01%) from 70.122%
when pulling cb88c3f on vasrem:feature/support-request-for-specific-ip-index-in-chunk
into 6649bfc on Mellanox:main.

if len(n.IPAM.RequestedIPs) > 0 {
return nil, fmt.Errorf("allocateIPWithIndex can't be used together with static IP request")
}
if n.IPAM.Features.AllocateDefaultGateway {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like we will never reach this code. This condition is already handled on line 209

}

// IPOffsetBy returns the IP that is offseted by index from the given IP
func IPOffsetBy(ip net.IP, index int32) net.IP {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use this one

func NextIPWithOffset(ip net.IP, offset int64) net.IP {

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.

3 participants