Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions pkg/apis/kubeovn/v1/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ type Vpc struct {
}

type VpcSpec struct {
DefaultSubnet string `json:"defaultSubnet,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"`
DefaultSubnet string `json:"defaultSubnet,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"`
// EnableExternal only handle default external subnet

ExtraExternalSubnets []string `json:"extraExternalSubnets,omitempty"`
// ExtraExternalSubnets only handle provider-network vlan subnet

EnableBfd bool `json:"enableBfd,omitempty"`

// optional BFD LRP configuration
// currently the LRP is used for vpc external gateway only
Expand Down
13 changes: 13 additions & 0 deletions pkg/controller/external_gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ var (
)

func (c *Controller) resyncExternalGateway() {
// check if default vpc only use extra external subnet
defaultVPC, err := c.vpcsLister.Get(c.config.ClusterRouter)
if err != nil {
klog.Errorf("failed to get vpc %s, %v", c.config.ClusterRouter, err)
return
}

if defaultVPC.Spec.ExtraExternalSubnets != nil || defaultVPC.Status.ExtraExternalSubnets != nil {
// vpc controller will handle
klog.Infof("default vpc only use extra external subnets: %v", defaultVPC.Spec.ExtraExternalSubnets)
return
}

cm, err := c.configMapsLister.ConfigMaps(c.config.ExternalGatewayConfigNS).Get(util.ExternalGatewayConfig)
if err != nil && !k8serrors.IsNotFound(err) {
klog.Errorf("failed to get ovn-external-gw-config, %v", err)
Expand Down
Loading
Loading