-
Notifications
You must be signed in to change notification settings - Fork 242
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
CNS - consider multiple IPs for a pod in reconciliation after restart #2079
Merged
ramiro-gamarra
merged 9 commits into
Azure:master
from
ramiro-gamarra:cns-reconcile-ipv6
Aug 2, 2023
Merged
CNS - consider multiple IPs for a pod in reconciliation after restart #2079
ramiro-gamarra
merged 9 commits into
Azure:master
from
ramiro-gamarra:cns-reconcile-ipv6
Aug 2, 2023
Conversation
This file contains 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
ashvindeodhar
requested changes
Jul 26, 2023
cns/restserver/internalapi.go
Outdated
@@ -325,6 +342,24 @@ func (service *HTTPRestService) ReconcileNCState(ncRequest *cns.CreateNetworkCon | |||
return 0 | |||
} | |||
|
|||
func podInfoByIPToPodInfoExtByInterfaceID(podInfoByIP map[string]cns.PodInfo) map[string]podInfoExt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add comment explaining the purpose of this func?
ramiro-gamarra
commented
Jul 26, 2023
rbtr
reviewed
Jul 31, 2023
cns/restserver/internalapi.go
Outdated
// to pod IPs indexed by pod key (interface or name+namespace, depending on scenario): | ||
// | ||
// { | ||
// "aaa-eth0": podIPs{IPs:["10.0.0.1","fe80::1"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pls update this to reflect the latest changes such as ipv4, ipv6?
ashvindeodhar
previously approved these changes
Aug 1, 2023
thatmattlong
reviewed
Aug 1, 2023
thatmattlong
reviewed
Aug 1, 2023
thatmattlong
reviewed
Aug 1, 2023
…need this because for reconciliation in dual stack cases both IPs for a pod which can come from distinct ncs must be added at the same time
…ead of empty strings since we need distinct interface ids
… pod, which is not allowed
…econcile flows using information from kubernetes instead of cni
…dability of error handling on ip parsing
rbtr
requested changes
Aug 1, 2023
rbtr
approved these changes
Aug 1, 2023
paulyufan2
pushed a commit
that referenced
this pull request
Aug 2, 2023
…#2079) * modifying reconcile function to take multiple ncs instead of one. we need this because for reconciliation in dual stack cases both IPs for a pod which can come from distinct ncs must be added at the same time * adding comments, and renaming functions and types, to make the intent clearer * adding some dummy values to cns.NewPodInfo invocations in tests, instead of empty strings since we need distinct interface ids * adding a basic test for dual stack reconciliation * adding validation for multiple ips for the same ip family on the same pod, which is not allowed * changing direct use of interface id to pod key, which is better for reconcile flows using information from kubernetes instead of cni * fixing comments to use host network terminology instead of system pod * improving error message on duplicate ip from cni found; improving readability of error handling on ip parsing * only checking for pod ips that are actually set on a pod
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.
Reason for Change:
Reconciliation after CNS restart is currently not handling dual stack scenarios correctly. There's 2 bugs:
This PR modifies the main reconciliation function such that it takes multiple NCs as input, and processes all IPs for a single pod key (interface or name+namespace, depending on reconcile flow) at the same time, such that both ipv4 and ipv6 can be inserted once as
DesiredIPAddresses
.