Skip to content

Commit

Permalink
support vpc configuration of multiple external network segments throu…
Browse files Browse the repository at this point in the history
…gh label and crd (#3264)

* add externalSubnet field support for vpc

* custom vpc get chassis from node label

* custom vpc add external based on ExternalSubnets

* support externalsubnets update

* compatible with default external

* fix custom vpc default external localnet create

* update addExternalSubnets status

* crd for addExternalSubnets

* add additionalPrinterColumn extraExternalSubnets


---------

Signed-off-by: zcq98 <zhaocongqi_yewu@cmss.chinamobile.com>
  • Loading branch information
zcq98 authored and bobz965 committed Oct 18, 2023
1 parent 5198037 commit 418d45f
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 69 deletions.
11 changes: 11 additions & 0 deletions charts/templates/kube-ovn-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,9 @@ spec:
- jsonPath: .status.subnets
name: Subnets
type: string
- jsonPath: .status.extraExternalSubnets
name: ExtraExternalSubnets
type: string
- jsonPath: .spec.namespaces
name: Namespaces
type: string
Expand All @@ -1226,6 +1229,10 @@ spec:
items:
type: string
type: array
extraExternalSubnets:
items:
type: string
type: array
staticRoutes:
items:
properties:
Expand Down Expand Up @@ -1301,6 +1308,10 @@ spec:
items:
type: string
type: array
extraExternalSubnets:
items:
type: string
type: array
vpcPeerings:
items:
type: string
Expand Down
11 changes: 11 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,9 @@ spec:
- jsonPath: .status.subnets
name: Subnets
type: string
- jsonPath: .status.extraExternalSubnets
name: ExtraExternalSubnets
type: string
- jsonPath: .spec.namespaces
name: Namespaces
type: string
Expand All @@ -1765,6 +1768,10 @@ spec:
items:
type: string
type: array
extraExternalSubnets:
items:
type: string
type: array
staticRoutes:
items:
properties:
Expand Down Expand Up @@ -1840,6 +1847,10 @@ spec:
items:
type: string
type: array
extraExternalSubnets:
items:
type: string
type: array
vpcPeerings:
items:
type: string
Expand Down
14 changes: 8 additions & 6 deletions pkg/apis/kubeovn/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,13 @@ type Vpc struct {
}

type VpcSpec struct {
Namespaces []string `json:"namespaces,omitempty"`
StaticRoutes []*StaticRoute `json:"staticRoutes,omitempty"`
PolicyRoutes []*PolicyRoute `json:"policyRoutes,omitempty"`
VpcPeerings []*VpcPeering `json:"vpcPeerings,omitempty"`
EnableExternal bool `json:"enableExternal,omitempty"`
EnableBfd bool `json:"enableBfd,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
StaticRoutes []*StaticRoute `json:"staticRoutes,omitempty"`
PolicyRoutes []*PolicyRoute `json:"policyRoutes,omitempty"`
VpcPeerings []*VpcPeering `json:"vpcPeerings,omitempty"`
EnableExternal bool `json:"enableExternal,omitempty"`
ExtraExternalSubnets []string `json:"extraExternalSubnets,omitempty"`
EnableBfd bool `json:"enableBfd,omitempty"`
}

type VpcPeering struct {
Expand Down Expand Up @@ -480,6 +481,7 @@ type VpcStatus struct {
Subnets []string `json:"subnets"`
VpcPeerings []string `json:"vpcPeerings"`
EnableExternal bool `json:"enableExternal"`
ExtraExternalSubnets []string `json:"extraExternalSubnets"`
EnableBfd bool `json:"enableBfd"`
}

Expand Down
6 changes: 0 additions & 6 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1860,12 +1860,6 @@ func (c *Controller) reconcileVlan(subnet *kubeovnv1.Subnet) error {
return nil
}
klog.Infof("reconcile vlan %v", subnet.Spec.Vlan)
isExternalGatewaySwitch := !subnet.Spec.LogicalGateway && subnet.Name == c.config.ExternalGatewaySwitch
if isExternalGatewaySwitch {
// external gw deal this vlan subnet, just skip
klog.Infof("skip reconcile vlan subnet %s", c.config.ExternalGatewaySwitch)
return nil
}

vlan, err := c.vlansLister.Get(subnet.Spec.Vlan)
if err != nil {
Expand Down
Loading

0 comments on commit 418d45f

Please sign in to comment.