-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add Gateway, ClusterInfo exchange controllers #3463
Conversation
Hi @jianjuns I am still working on refining the codes and unit test, Could you help to take a look at the overview in summary? maybe a quick glance over codes, thanks! |
Codecov Report
@@ Coverage Diff @@
## main #3463 +/- ##
==========================================
- Coverage 64.63% 56.97% -7.66%
==========================================
Files 279 398 +119
Lines 39733 55915 +16182
==========================================
+ Hits 25680 31858 +6178
- Misses 12059 21555 +9496
- Partials 1994 2502 +508
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 have a design doc? I could not understand the functions of TunnelEndpoints and its attributes, just from the code comments (and probably you should add more comments in code too).
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
Hi @jianjuns I have drafted a new google doc with data path design https://docs.google.com/document/d/1Lmm-Vh67QXiyGDftwJfEPS0kpK8oEVZsAjtcLVGrhfw/edit, Could you help to take a look? thanks. |
a8634c9
to
debb541
Compare
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
b047dbb
to
5dd5619
Compare
5dd5619
to
e4bdfe4
Compare
/test-multicluster-e2e |
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpoint_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/multiclusterconfig_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/multiclusterconfig_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/resourceexport_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpointimport_types.go
Outdated
Show resolved
Hide resolved
multicluster/apis/multicluster/v1alpha1/tunnelendpointimport_types.go
Outdated
Show resolved
Hide resolved
2d49415
to
cd9edcd
Compare
@jianjuns Could you help to review again? I have refined codes based on latest design. thanks. |
multicluster/controllers/multicluster/member_clusterset_controller.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/member_clusterset_controller.go
Outdated
Show resolved
Hide resolved
ede610e
to
004393b
Compare
/test-multicluster-e2e |
multicluster/controllers/multicluster/commonarea/clusterinfo_importer_test.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/commonarea/clusterinfo_importer_test.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/commonarea/clusterinfo_importer_test.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/commonarea/clusterinfo_importer_test.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/commonarea/clusterinfo_importer_test.go
Outdated
Show resolved
Hide resolved
multicluster/controllers/multicluster/serviceexport_controller.go
Outdated
Show resolved
Hide resolved
004393b
to
75d8352
Compare
/test-multicluster-e2e |
75d8352
to
73ec2c0
Compare
/test-multicluster-e2e |
bb915c5
to
2e185a9
Compare
/test-multicluster-e2e |
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. @tnqn might have further comments.
multicluster/controllers/multicluster/member_clusterset_controller.go
Outdated
Show resolved
Hide resolved
446142c
to
a4c1986
Compare
* Add a Node controller to watch Node changes in member cluster. It will do following things: * When the Node is annotated with `multicluster.antrea.io/gateway=true`, it will create a new Gateway CR like below: ```yaml apiVersion: multicluster.crd.antrea.io/v1alpha1 kind: Gateway metadata: name: k8s-node-1 namespace: kube-system gatewayIP: 172.16.27.224 internalIP: 172.16.27.224 ``` * When the Node is annotated with both `multicluster.antrea.io/gateway=true` and `multicluster.antrea.io/gateway-ip="10.10.10.10"` ('10.10.10.10' is an IP example), the existing Gateway CR's gatewayIP will be updated like below: ```yaml apiVersion: multicluster.crd.antrea.io/v1alpha1 kind: Gateway metadata: name: k8s-node-1 namespace: kube-system gatewayIP: 10.10.10.10 internalIP: 172.16.27.224 ``` * When the Node's annotation `multicluster.antrea.io/gateway=true` is removed, the corresponding Gateway will be deleted. * Add a Gateway controller to watch Gateway events in member cluster. It will do following things: * When a Gateway is created, a new ClusterInfo type of ResourceExport will be created in leader cluster, a sample yaml is like below: ```yaml apiVersion: multicluster.crd.antrea.io/v1alpha1 kind: ResourceExport metadata: name: test-cluster-west-kube-system-clusterinfo namespace: antrea-mcs-ns spec: clusterID: test-cluster-west clusterinfo: clusterID: test-cluster-west gatewayInfos: - gatewayIP: 10.10.10.10 serviceCIDR: 10.19.0.0/18 kind: ClusterInfo name: test-cluster-west namespace: kube-system ``` * When a Gateway is updated or one of many Gateways are deleted, the corresponding ResourceExport will be updated in leader cluster. Please note, we support one Gateway only for now, so the last created Gateway will be wrapped into ResourceExport if there are multiple Gateways. * When the last Gateway is deleted, the corresponding ResourceExport will be deleted in leader cluster. * There are two new fields `serviceCIDR` and `gatewayIPPrecedence` are added in `MultiClusterConfig`. - By default, MC controller will detect ClusterIP range automatically. If admin sets the `serviceCIDR` config manually, it will use the value of `serviceCIDR` in the config. - By default, MC controller will choose InternalIP of a Node as the GatewayIP, if admin sets `gatewayIPPrecedence` config as `public`, it will use ExternalIP as GatewayIP. * Add a new ClusterInfo kind handler to convert any new or updated ClusterInfo kind of ResourceExports into ResourceImports. * Add a new ClusterInfo importer to watch any new or updated ClusterInfo kind of ResourceImport events. It will create or update a ClusterInfoImport locally. A sample ClusterInfoImport is like below: ```yaml apiVersion: multicluster.crd.antrea.io/v1alpha1 kind: ClusterInfoImport metadata: name: test-cluster-west-kube-system-clusterinfo namespace: kube-system spec: clusterID: test-cluster-west gatewayInfos: - gatewayIP: 10.10.10.10 serviceCIDR: 10.19.0.0/18 ``` Signed-off-by: Lan Luo <luola@vmware.com>
a4c1986
to
a24474f
Compare
/test-multicluster-e2e |
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
/skip-all |
/test-multicluster-e2e |
1 similar comment
/test-multicluster-e2e |
Hi @tnqn there was an e2e stale data issue in the environment, I cleaned them up and rerun job is passed, Could you help to move forward? thanks. |
multicluster.antrea.io/gateway=true
, it willcreate a new Gateway CR like below:
multicluster.antrea.io/gateway=true
andmulticluster.antrea.io/gateway-ip="10.10.10.10"
('10.10.10.10' is an IP example), the existing Gateway CR's gatewayIP will be updated like below:multicluster.antrea.io/gateway=true
is removed, the corresponding Gateway will be deleted.Please note, we support one Gateway only for now, so the last created Gateway will be wrapped into ResourceExport if there are multiple Gateways.
serviceCIDR
andgatewayIPPrecedence
are added inMultiClusterConfig
.serviceCIDR
config manually, it will use the value ofserviceCIDR
in the config.gatewayIPPrecedence
config aspublic
, it will use ExternalIP as GatewayIP.A sample ClusterInfoImport is like below:
Signed-off-by: Lan Luo luola@vmware.com