Skip to content

Conversation

@rbtr
Copy link
Collaborator

@rbtr rbtr commented Nov 17, 2021

Signed-off-by: Evan Baker rbtr@users.noreply.github.com

Reason for Change:

When scaling up, we should account for the IPs we have requested when we calculate our free. But when scaling down, we should only account for the IPs that we have when calculating free.

Issue Fixed:

Requirements:

Notes:

@rbtr rbtr requested a review from neaggarwMS November 17, 2021 01:34
unallocatedIPConfigCount := cnsPodIPConfigCount - allocatedPodIPCount
freeIPConfigCount := requestedIPConfigCount - int64(allocatedPodIPCount)
currentFree := cnsPodIPConfigCount - allocatedPodIPCount
futureFree := requestedIPConfigCount - allocatedPodIPCount
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename it something else, futureFree is little confusing specially when it is being used for ScaleUP. You will scaleup if you dont have ips left. Cant think of a better name too :)

May be "ipsToBeAssignedToCNS"...I'm sure you will come with a better name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually can't think of a better name...can we move forward with this one and I will follow up with a change to clean up the way this state is gathered and passed around?

Copy link
Member

Choose a reason for hiding this comment

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

How About "totalIpsToBeAssignedToCNS"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we're using assigned and allocated backwards. It should be:
"IPs are allocated to CNS"
"CNS assigns IPs to Pods"

Then, the total number of IPs that CNS has are the its "allocated" IPs, and the total number if IPs in use are how many that CNS has "assigned" to specific Pods.
"currentFree" becomes unassigned := allocated - assigned
"futureFree" becomes something like requestedUnassigned := requested - assigned

Copy link
Member

Choose a reason for hiding this comment

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

I like the above analogy.
However, since we have defined allocated => CNS assigned ips to pod

lets rename currentFree = unAllocated
FutureFree = requestedUnAllocated

IMO, FutureFree is really hard to explain to a new pair of eyes.

unallocatedIPConfigCount := cnsPodIPConfigCount - allocatedPodIPCount
freeIPConfigCount := requestedIPConfigCount - int64(allocatedPodIPCount)
currentFree := cnsPodIPConfigCount - allocatedPodIPCount
futureFree := requestedIPConfigCount - allocatedPodIPCount
Copy link
Member

Choose a reason for hiding this comment

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

How About "totalIpsToBeAssignedToCNS"

availableIPConfigCount := len(pm.httpService.GetAvailableIPConfigs()) // TODO: add pending allocation count to real cns
requestedIPConfigCount := pm.spec.RequestedIPCount
requestedIPConfigCount := int(pm.spec.RequestedIPCount)
unallocatedIPConfigCount := cnsPodIPConfigCount - allocatedPodIPCount
Copy link
Member

Choose a reason for hiding this comment

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

We can avoid this, it is same as CurrentFree

unallocatedIPConfigCount := cnsPodIPConfigCount - allocatedPodIPCount
freeIPConfigCount := requestedIPConfigCount - int64(allocatedPodIPCount)
currentFree := cnsPodIPConfigCount - allocatedPodIPCount
futureFree := requestedIPConfigCount - allocatedPodIPCount
Copy link
Member

Choose a reason for hiding this comment

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

I like the above analogy.
However, since we have defined allocated => CNS assigned ips to pod

lets rename currentFree = unAllocated
FutureFree = requestedUnAllocated

IMO, FutureFree is really hard to explain to a new pair of eyes.

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
@rbtr rbtr merged commit 22906eb into Azure:master Nov 22, 2021
@rbtr rbtr deleted the fix/pool-scaling branch November 22, 2021 18:22
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.

2 participants