-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Gateway and ClusterInfoImport CRDs (#3689)
* Add Gateway and ClusterInfoImport CRDs and update corresponding manifests - A sample of Gateway is 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 ``` - A sample of 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 gatewayNodeInfos: - gatewayIP: 10.10.10.10 name: k8s-node-1 serviceCIDR: 10.19.0.0/18 ``` * Two new fields 'ServiceCIDR' and 'GatewayIPPrecedence' are added in MultiClusterConfig. - By default, MC controller will detect ClusterIP range automatically. If admin set the ServiceCIDR config manually, MC controller will use the value in the config. - By default, MC controller will chose InternalIP of a Node as the GatewayIP, if admin set GatewayIPPrecedence config as 'public', it will use ExternalIP as the GatewayIP. Signed-off-by: Lan Luo <luola@vmware.com>
- Loading branch information
1 parent
00f9d98
commit 2023829
Showing
44 changed files
with
3,834 additions
and
59 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
multicluster/apis/multicluster/v1alpha1/clusterinfoimport_types.go
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright 2022 Antrea Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// ClusterInfoImportStatus defines the observed state of ClusterInfoImport. | ||
type ClusterInfoImportStatus struct { | ||
Conditions []ResourceCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +genclient | ||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
type ClusterInfoImport struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ClusterInfo `json:"spec,omitempty"` | ||
Status ClusterInfoImportStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
type ClusterInfoImportList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ClusterInfoImport `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ClusterInfoImport{}, &ClusterInfoImportList{}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Copyright 2022 Antrea Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GatewayInfo includes information of a Gateway. | ||
type GatewayInfo struct { | ||
GatewayIP string `json:"gatewayIP,omitempty"` | ||
} | ||
|
||
// +genclient | ||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// Gateway includes information of a Multi-cluster Gateway. | ||
type Gateway struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Tunnel IP of the Gateway. It might be assigned by user manually | ||
// through a Node annotation. | ||
GatewayIP string `json:"gatewayIP,omitempty"` | ||
// Internal tunnel IP of the Gateway. | ||
InternalIP string `json:"internalIP,omitempty"` | ||
} | ||
|
||
type ClusterInfo struct { | ||
// ClusterID of the member cluster. | ||
ClusterID string `json:"clusterID,omitempty"` | ||
// ServiceCIDR is the IP ranges used by Service ClusterIP. | ||
ServiceCIDR string `json:"serviceCIDR,omitempty"` | ||
// GatewayInfos has information of Gateways | ||
GatewayInfos []GatewayInfo `json:"gatewayInfos,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
type GatewayList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Gateway `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Gateway{}, &GatewayList{}) | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright 2022 Antrea Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type ResourceConditionType string | ||
|
||
const ( | ||
ResourceReady ResourceConditionType = "Ready" | ||
) | ||
|
||
// ResourceCondition indicates the readiness condition of a Resource. | ||
type ResourceCondition struct { | ||
// Type is the type of the condition. | ||
Type ResourceConditionType `json:"type,omitempty"` | ||
// Status of the condition, one of True, False, Unknown. | ||
Status v1.ConditionStatus `json:"status,omitempty"` | ||
|
||
// +optional | ||
// Last time the condition transited from one status to another. | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
// +optional | ||
// A human readable message indicating details about the transition. | ||
Message string `json:"message,omitempty"` | ||
// +optional | ||
// Unique, one-word, CamelCase reason for the condition's last transition. | ||
Reason string `json:"reason,omitempty"` | ||
} |
Oops, something went wrong.