-
Notifications
You must be signed in to change notification settings - Fork 364
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
Support Pod to Pod connectivity in Antrea Multi-cluster #4219
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4219 +/- ##
==========================================
+ Coverage 62.26% 62.58% +0.32%
==========================================
Files 385 385
Lines 54501 55017 +516
==========================================
+ Hits 33933 34433 +500
- Misses 18069 18073 +4
- Partials 2499 2511 +12
*This pull request uses carry forward flags. Click here to find out more.
|
5b336c6
to
0c694e9
Compare
Hi @hjiajing your DCO info is missing, and the unit test is failed, please fix them. |
return err | ||
} | ||
for _, node := range nodeList.Items { | ||
podCIDRs = append(podCIDRs, node.Spec.PodCIDRs...) |
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.
Could you check if this can handle empty PodCIDRs properly?
@@ -142,7 +143,17 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. | |||
return ctrl.Result{}, err | |||
} | |||
} | |||
return ctrl.Result{}, nil | |||
|
|||
// When a Node is added to a member cluster or removed from a member cluster. |
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.
I feel this comment should be updated, this block also handles Node update case.
Can we compare existing CIDRs so we can skip refresh Gateway unnecessarily?
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.
The reason I used node list rather than other annotations such as "lastUpdateTime" is that we will compare the node list to skip the unnecessary refresh in the updateActiveGateway
method.
If we need to compare the CIDRs, maybe we need to set the store the CIDRs in the Gateway.Spec or Annotations. I'm not sure if it's necessary since we store it in the ClusterInfo.
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.
Do you guys think we can just ask users to provide the PodCIDRs? I want not to add much complexity for auto-discovering Pod CIDRs? @luolanzone
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.
Yes, I think this is also workable. Maybe add a config item clusterCIDRs
the same as Antrea agent?
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.
Yeah, maybe still podCIDRs
for easier understanding.
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.
@luolanzone @jianjuns Maybe we can add a new field PodCIDRs
in struct options
inmulticluster/cmd/multicluster-controller/options.go
. And the user must edit the antrea-multicluster-member.yml
to specify the CIDR.
The CIDR must be the cluster Pod CIDRs or a superset of it, should we add a check about it?
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.
I think no need to check. But wonder if we should check no overlapping among clusters. At least we should check in each cluster that remote cluster CIDRs cannot overlap with the local cluster, and reject that import if it does overlap. We can do a separate PR for that.
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.
@hjiajing Yes, I think a new option field is required for PodCIDRs, and you should also add a config item here https://github.com/antrea-io/antrea/blob/main/multicluster/apis/multicluster/v1alpha1/multiclusterconfig_types.go#L38.
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.
@luolanzone Thanks for the reminder. The item PodCIDRs
was added to MulticlusterConfig
.
Sure. I'll fix it. Thanks |
bb5f668
to
51f0332
Compare
39f7227
to
cedc9ee
Compare
5e15dd8
to
dfd766e
Compare
LGTM |
klog.V(2).InfoS("No difference between new and installed ClusterInfoImports, skip updating", "clusterinfoimport", ciImport.Name) | ||
return nil | ||
} | ||
} | ||
|
||
klog.InfoS("Adding/updating remote Gateway Node flows for Multi-cluster", "gateway", klog.KObj(activeGW), | ||
"node", c.nodeConfig.Name, "peer", tunnelPeerIPToRemoteGW) | ||
allCIDRs := []string{ciImport.Spec.ServiceCIDR} | ||
allCIDRs := append([]string{ciImport.Spec.ServiceCIDR}, ciImport.Spec.PodCIDRs...) |
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.
If you add all Pod CIDRs here like Service CIDR, I think it will also add a SNAT flow to perform SNAT for Pod-to-Pod connectivity, I feel it would be OK to keep the behavior consistent, but seems we didn't discuss this before. @jianjuns it this expected to do SNAT for Pod to Pod access?
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.
I feel we can do SNAT for now. @luolanzone Maybe you can also reach to Tao to understand his requirements?
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.
sure, @hjiajing let's do SNAT for 1.9, I will check with Tao for the details.
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.
LGTM
/test-all |
/test-multicluster-e2e |
@hjiajing @luolanzone : this PR did not reach the UT coverage target. Could you check any way to improve? |
@jianjuns Sure. I'll check and improve the unit test coverage. |
@jianjuns I added some UT for the |
multicluster/cmd/multicluster-controller/testdata/antrea-mc-config-with-empty-podcidrs.yml
Outdated
Show resolved
Hide resolved
multicluster/cmd/multicluster-controller/testdata/antrea-mc-config-with-invalid-podcidrs.yml
Outdated
Show resolved
Hide resolved
multicluster/cmd/multicluster-controller/testdata/antrea-mc-config-with-valid-podcidrs.yml
Outdated
Show resolved
Hide resolved
@jianjuns Discussed with Wenqi. The total coverage decreased because some tests was still running, and some tests wasn't triggered. After more unit tests added, the unit test coverage of this PR is 93% reached the target now (70%) |
Hi, @hjiajing After checking the Codecov links. I think you should just keep an eye on this patch/status data. And 93.75% is a good coverage rate. |
Yes, the coverage rate is good now. @luolanzone : do you have extra comments? |
/test-all |
@jianjuns no more comments from me. thanks. |
Seems there are some problems with github checks. re-trigger test-all to see if it helps. |
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.
LGTM
/test-all |
2 similar comments
/test-all |
/test-all |
Signed-off-by: hujiajing <[email protected]>
Each member cluster exports cluster PodCIDRs with ClusterInfo. antrea-agent programs flows to route traffic to remote cluster Pods through the tunnels between Gateway Nodes. Signed-off-by: hujiajing <[email protected]>
Add a new field
PodCIDRs
in theClusterInfo
for a member cluster to export its Pod CIDRs to other clusters. antrea-agent adds flows to route traffic to remote cluster Pods through Gateway Nodes.Signed-off-by: hujiajing [email protected]