-
Notifications
You must be signed in to change notification settings - Fork 36
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
Healing doesn't work properly in the case of multiple NSCs #1358
Comments
@edwarnicke @denis-tingaikin |
@glazychev-art Is this an issue of both IP addresses being in the response to the Request? I can see this happening one of two ways either:
Which is it? Or is it something else? |
@edwarnicke I think it would be great to use old addresses after healing. |
@glazychev-art That was what I was thinking. There's a tricky bit in there though because right now point2pointipam leaves space for other point2pointipam instances to add IPs. So it can't really tell the difference between "This is a new IP" and "Someone before me in the chain set this IP as part of IPAM". |
@edwarnicke
2A. If NSE receives the first request from the client, ipv4IPAM adds ipv4 addresses to Request.Connection.ConnectionContext.IPContext.DstIP/SrcIP. The next ipv6IPAM sees that Briefly: if we can, we restore the address, if not, we allocate a new one. |
@edwarnicke |
@glazychev-art Whether the IP addresses change on heal will be up to the NSE. I expect many (most?) NSEs will want to provide IP address stability, but maybe not all. From NSMs point of view:
I suspect the best answer for our current point2pointipam would be to simply compare any existing IP in the chain to the prefixes from which its issuing IPs. If the incoming Request has an IP that is in the prefixes a particular p2pipam is issuing from, it could accept that and not issue a new one. Thoughts? |
Yes, I agree. I think that's what I described here - #1358 (comment) |
@glazychev-art Yes, but the prefix check is important. For example:
We don't want IPAM2 deciding it doesn't have to do its work because 10.0.0.1/32 has been assigned already by IPAM1. That's why the prefix checking is important. |
@edwarnicke
Right? |
Exactly :) |
Hey, Maybe we can add the IPAM as a CRD just like NetworkService / NetworkServiceEndpoint? Or maybe reuse the IPAM replica set, used in VL3 in conjunction with a CRD. I would like to think the IPAM works like DHCP. Scenario A: NSC -> NSE, connection is new, ask registry / IPAM CR for new address, store the details like NSC id / other identifier, add expiration Scenario B: NSC -> NSE, refresh, connection exists, but not expired, ask registry. / IPAM CR to update expiry based on the NSC identifier Scenario C: NSC -> NSE, refresh, connection exists, but it is expired, return CONNECTIONEXPIREDERROR, so that the NSC can do The same applies in VL3 if I'm not mistaken. The IPAM replica set has a CIDR, let's say Thanks |
I think it is possible to make IPAM like CRD and it allows us remove https://github.com/networkservicemesh/cmd-ipam-vl3 All concurrency problems are resolvable with k8s. Only one question here: How we'll support IPAM for non-k8s systems? :) |
@yuraxdrumz It would totally be possible to add a crd based ipam chain element. We do need to be cautious to maintain generalizability though because:
So for example having a crdipam chain element would be a fantastic tool for folks to have (and easy to write in sdk-k8s), making it the 'one true ipam' is probably suboptimal :) |
I agree we need to keep it general. I thought about reusing the same design as with registry. By default, we use registry-k8s, but we also have registry-memory and people that use NSM in a non-k8s can implement the interface to interact with the registry. The same can be achieved with the IPAM. We can have IPAM-k8s, IPAM-memory, which is basically the code we have today that the NSE use and if someone wants something custom, we have a simple interface to implement. I am guessing that it will require another proxy for the inter-domain scenario though. What are you're thoughts? |
I think we can do like I suggested with the registry, we can keep the ipam and make it run as ipam-k8s for all the k8s needs, add an ipam-memory to support non-k8s systems. The NSE's, both regular and VL3, will ask the IPAM server for a prefix, almost the same as today. When a client connects to the NSE, the NSE will call the IPAM server again for |
Hey, I talked about the IPAM, because the end result I am looking for is to have client and endpoint addresses unique and preserved across restarts regardless of using 1 NSC, multiple NSC's or using VL3. I did a few steps to check some things out:
Now, I see the endpoints work exactly the same as with vl3 Oct 3 14:56:30.568 [INFO] [cmd:[/bin/app]] Configuration: &{[{tcp :5006 false }] TRACE otel-collector.observability.svc.cluster.local:4317 169.254.0.0/16 24}
Oct 3 14:56:37.107 [INFO] [cmd:[/bin/app]] SVID: "spiffe://example.org/ns/nsm-system/pod/ipam-memory-84845d75f5-fr7rk/012ee2e8-147f-4702-a279-7aebd11524b4"
2022/10/06 09:25:28 [DEBUG] starting to allocate new prefix for endpoint name = nse-inet-57d959775d-vvjgf
2022/10/06 09:25:28 [DEBUG] didn't find prefix, allocating new prefix = 169.254.0.0/24
2022/10/06 09:25:28 [DEBUG] adding request.prefix = 169.254.0.0/24 to excludedPrefixes
2022/10/06 09:25:28 [DEBUG] adding response.prefix = 169.254.0.0/24 to clientsPrefixes
2022/10/06 09:25:28 [DEBUG] excluding prefix from pool, prefix = 169.254.0.0/24
2022/10/06 09:26:52 [DEBUG] starting to allocate new prefix for endpoint name = nse-inet-57d959775d-97bh2
2022/10/06 09:26:52 [DEBUG] didn't find prefix, allocating new prefix = 169.254.1.0/24
2022/10/06 09:26:52 [DEBUG] adding request.prefix = 169.254.1.0/24 to excludedPrefixes
2022/10/06 09:26:52 [DEBUG] adding response.prefix = 169.254.1.0/24 to clientsPrefixes
2022/10/06 09:26:52 [DEBUG] excluding prefix from pool, prefix = 169.254.1.0/24
2022/10/06 09:52:18 [DEBUG] starting to allocate new prefix for endpoint name = nse-inet-57d959775d-rpssj
2022/10/06 09:52:18 [DEBUG] didn't find prefix, allocating new prefix = 169.254.2.0/24
2022/10/06 09:52:18 [DEBUG] adding request.prefix = 169.254.2.0/24 to excludedPrefixes
2022/10/06 09:52:18 [DEBUG] adding response.prefix = 169.254.2.0/24 to clientsPrefixes
2022/10/06 09:52:18 [DEBUG] excluding prefix from pool, prefix = 169.254.2.0/24 My question is, how can we preserve cidrs/addresses across restarts? I see the IPAM flow as something like the image below For example, when an NSE restarts, I have no idea how to identify it in the IPAM. I looked at the implementation of the VL3 IPAM and to my understanding, if I restart a VL3 NSE, it will be allocated a new CIDR from the IPAM and all clients that were connected to it remain with old addresses. Do you think the direction I'm going for, which is having a single IPAM that controls all addresses (both NSE, like today in VL3, but for all types of endpoints, and for NSC's) with an option to fallback to original NSE in memory in case the IPAM is not available, a good one? EDIT: I just restarted my NSE:
This got me thinking, We don't really care about client addresses, only on NSE cidr block. We do, however, care about the same client receiving the same ip it had to avoid the double ip scenarios. If an NSE restarts, we want 2 things to happen:
I saw commits regarding keeping the same client IPs from the past week OR
OR
|
I have another thing that needs checking. I have 2 NSC's and 2 NSEs, all on different k8s nodes. The NSE's offer the same NetworkService. Both NSE's have a static cidr block env:
- name: NSM_CIDR_PREFIX
value: 172.16.1.100/28 The NSC's connect in a round robin manner to the NSE's. I got a scenario, like the following: NSC1 src: 172.16.1.97, NSE1 dst: 172.16.1.96 Now, NSE1 goes offline / rescheduled. NSC1 tries to connect to NSE2 with the same address as NSC2 and it causes forwarder errors until it retries enough to connect back to NSE1. Now, if I understand correctly, even if we use dynamic CIDR generation, or static but non-overlapping CIDR's between NSE's, for example: NSC1 src: 172.16.1.97, NSE1 dst: 172.16.1.96 We still hit a scenario during healing, where the NSC will have 172.16.1.97, but the NSE will have CIDR 172.16.2.96. What happens / should happen in this scenario? Do we need to have a single CIDR block with an external store (like the IPAM we talked about) for several NSE's, or can we do healing / |
Description
Related to: #1357
Currently, healing doesn't work properly if we have several NSCs, because when the NSE is restarted,
point2pointipam
loses information about the issued IP addresses.After the restart, the order of servicing and issuing addresses during the healing process may not coincide with the initial request (before death).
For example:
Possible solution:
We can try to recover IP addresses from the Request inside
point2pointipam
.In this case, clients will only have old addresses.
The text was updated successfully, but these errors were encountered: