Skip to content

Commit

Permalink
set default UnderlayGateway to true in vlan mode
Browse files Browse the repository at this point in the history
(cherry picked from commit 3a4347b)
  • Loading branch information
zhangzujian authored and oilbeater committed Jun 10, 2021
1 parent f11cdf9 commit 00e2e00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ func (c *Controller) initDefaultLogicalSwitch() error {
}
if c.config.NetworkType == util.NetworkTypeVlan {
defaultSubnet.Spec.Vlan = c.config.DefaultVlanName
if c.config.DefaultVlanID == 0 {
defaultSubnet.Spec.UnderlayGateway = true
}
defaultSubnet.Spec.UnderlayGateway = true
}

_, err = c.config.KubeOvnClient.KubeovnV1().Subnets().Create(context.Background(), &defaultSubnet, metav1.CreateOptions{})
Expand Down
6 changes: 2 additions & 4 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,9 @@ func formatSubnet(subnet *kubeovnv1.Subnet, c *Controller) error {
if subnet.Spec.Default && subnet.Name != c.config.DefaultLogicalSwitch {
subnet.Spec.Default = false
}
if util.IsNetworkVlan(c.config.NetworkType) && subnet.Spec.Vlan == "" {
if c.config.NetworkType == util.NetworkTypeVlan && subnet.Spec.Vlan == "" {
subnet.Spec.Vlan = c.config.DefaultVlanName
if c.config.DefaultVlanID == 0 {
subnet.Spec.UnderlayGateway = true
}
subnet.Spec.UnderlayGateway = true
}
if subnet.Spec.Vlan != "" {
if _, err := c.vlansLister.Get(subnet.Spec.Vlan); err != nil {
Expand Down

0 comments on commit 00e2e00

Please sign in to comment.