Skip to content

Commit

Permalink
Merge pull request #2141 from cyclinder/coordinator_podClusterType
Browse files Browse the repository at this point in the history
spidercoordinator: support setting podCIDRType to none
  • Loading branch information
weizhoublue authored Aug 8, 2023
2 parents e343da4 + fe16e9a commit 222da0e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ spec:
- cluster
- calico
- cilium
- none
type: string
podDefaultRouteNIC:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ spec:
- cluster
- calico
- cilium
- none
type: string
podDefaultRouteNIC:
type: string
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/crd-spidercoordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This is the Spidercoordinators spec for users to configure.
| Field | Description | Schema | Validation | Values | Default |
|--------------------|--------------------------------------------------------------|----------------------|------------|------------------------------|------------------------------|
| mode | The mode in which the coordinator. underlay: coordinator creates veth devices to solve the problem that CNIs such as macvlan cannot communicate with clusterIP. overlay: fix the problem that CNIs such as Macvlan cannot access ClusterIP through the Calico network card attached to the pod,coordinate policy route between interfaces to ensure consistence data path of request and reply packets | string | require | underlay,overlay | underlay |
| podCIDRType | The ways to fetch the CIDR of the cluster | string | require | cluster,calico,cilium | cluster |
| podCIDRType | The ways to fetch the CIDR of the cluster | string | require | cluster,calico,cilium,none | cluster |
| tunePodRoutes | tune pod's route while the pod is attached to multiple NICs | bool | optional | true,false | true |
| podDefaultRouteNIC | The NIC where the pod's default route resides | string | optional | "",eth0,net1... | underlay: eth0,overlay: net1 |
| detectGateway | enable detect gateway while launching pod, If the gateway is unreachable, pod will be failed to created; Note: We use ARP probes to detect if the gateway is reachable, and some gateway routers may warn about this | boolean | optional | true,false | false |
Expand Down
7 changes: 6 additions & 1 deletion pkg/coordinatormanager/coordinator_informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ const (
cluster = "cluster"
calico = "calico"
cilium = "cilium"
none = "none"
)

var SupportedPodCIDRType = []string{cluster, calico, cilium}
var SupportedPodCIDRType = []string{cluster, calico, cilium, none}

const (
calicoConfig = "calico-config"
Expand Down Expand Up @@ -441,6 +442,10 @@ func (cc *CoordinatorController) syncHandler(ctx context.Context, coordinatorNam
if ipam == "kubernetes" {
coordCopy.Status.OverlayPodCIDR = k8sPodCIDR
}
case none:
coordCopy.Status.Phase = synced

Check failure on line 446 in pkg/coordinatormanager/coordinator_informer.go

View workflow job for this annotation

GitHub Actions / lint-golang

undefined: synced
coordCopy.Status.OverlayPodCIDR = []string{}
coordCopy.Status.ServiceCIDR = []string{}
}

coordCopy.Status.ServiceCIDR = k8sServiceCIDR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type CoordinatorSpec struct {
// in spidermultusconfig CRD , podCIDRType should not be required, which could be merged from SpiderCoordinator CR
// but in SpiderCoordinator CRD, podCIDRType should be required
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=cluster;calico;cilium
// +kubebuilder:validation:Enum=cluster;calico;cilium;none
PodCIDRType *string `json:"podCIDRType,omitempty"`

// +kubebuilder:validation:Optional
Expand Down
10 changes: 6 additions & 4 deletions test/doc/coordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
| C00002 | coordinator in tuneMode: overlay works well | p1 | smoke | done | |
| C00003 | coordinator in tuneMode: underlay with two NIC | p1 | smoke | | |
| C00004 | coordinator in tuneMode: overlay with two NIC | p1 | smoke | | |
| C00005 | specify the NIC where the default route is located | p2 | done | | |
| C00006 | ip conflict detection (ipv4, ipv6) | p2 | done | | |
| C00007 | override pod mac prefix | p2 | | done | |
| C00008 | gateway connection detection | p2 | done | | |
| C00005 | specify the NIC where the default route is located | p2 | | done | |
| C00006 | ip conflict detection (ipv4, ipv6) | p2 | | done | |
| C00007 | override pod mac prefix | p2 | | done | |
| C00008 | gateway connection detection | p2 | | done | |
| C00009 | auto clean up the dirty rules(routing\neighborhood) while pod starting | p2 | | |
| C00010 | testing spidercoordinator.podCIDRType changes if works | p2 | | |

0 comments on commit 222da0e

Please sign in to comment.