Skip to content

Conversation

@matmerr
Copy link
Member

@matmerr matmerr commented Sep 16, 2020

Reason for Change:

Issue Fixed:

Adds the pending release from the CRD to CNS on start

Requirements:

Notes:

}
}

ctx := context.Background()
Copy link
Member Author

@matmerr matmerr Sep 16, 2020

Choose a reason for hiding this comment

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

need a cancellable context, but this parent is short lived, potentially pass in context to initCNS

Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, why is this being moved from main? It seems like in this scope (ReconcileNCState) the monitor would get "started" multiple times rather than just once.

@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #672 into master will decrease coverage by 0.91%.
The diff coverage is 64.28%.

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
- Coverage   42.63%   41.72%   -0.92%     
==========================================
  Files          72       72              
  Lines       10392     9488     -904     
==========================================
- Hits         4431     3959     -472     
+ Misses       5482     5058     -424     
+ Partials      479      471       -8     

Copy link
Contributor

@ramiro-gamarra ramiro-gamarra left a comment

Choose a reason for hiding this comment

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

Couple of questions

}
}

ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, why is this being moved from main? It seems like in this scope (ReconcileNCState) the monitor would get "started" multiple times rather than just once.

ipconfig.State = cns.PendingRelease
service.PodIPConfigState[id] = ipconfig
} else {
return fmt.Errorf("Inconsistent state, ipconfig with ID [%v] marked as pending release, but does not exist in state", id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, would it be better to try to fix the spec at this point (i.e. garbage collect the ip id that is not referenced anywhere else)? Maybe that's done somewhere else but I'm not aware.

Copy link
Member

Choose a reason for hiding this comment

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

This can be an expected state. say during reconcile, spec had some stale ToBeDeleted ips list which were already cleanup in status. Thus, PodIpConfigState wont have that ip. We can log this but this is not an error.

}
}

ctx := context.Background()
Copy link
Member

Choose a reason for hiding this comment

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

+1 on Ramiro's feedback. This should be called from main only after Reconcile is completed. It could be possible that reconcile api is skipped if CRD is not available but IPAM pool monitor should still start.

logger.Errorf(returnMessage)
}

err = service.MarkExistingIPsAsPending(spec.IPsNotInUse)
Copy link
Member

Choose a reason for hiding this comment

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

We dont need to call this during all createOrUpdateNC calls. This only needs to be marked one time during Reconcile. Can we move this to the caller API (ReconcileNCState)

ipconfig.State = cns.PendingRelease
service.PodIPConfigState[id] = ipconfig
} else {
return fmt.Errorf("Inconsistent state, ipconfig with ID [%v] marked as pending release, but does not exist in state", id)
Copy link
Member

Choose a reason for hiding this comment

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

This can be an expected state. say during reconcile, spec had some stale ToBeDeleted ips list which were already cleanup in status. Thus, PodIpConfigState wont have that ip. We can log this but this is not an error.

for _, id := range pendingIPIDs {
if ipconfig, exists := service.PodIPConfigState[id]; exists {
if ipconfig.State == cns.Allocated {
return fmt.Errorf("Failed to mark IP [%v] as pending, currently allocated", id)

Choose a reason for hiding this comment

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

I am not super familiar with this but should we still try to set PendingRelease for subsequent IPs when one of them has allocated state?

@matmerr matmerr merged commit edb2833 into Azure:master Sep 28, 2020
neaggarwMS pushed a commit to neaggarwMS/azure-container-networking that referenced this pull request Nov 13, 2020
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.

4 participants