Skip to content

Commit

Permalink
Don't need to add/delete vids to/from mgmt uplink
Browse files Browse the repository at this point in the history
  • Loading branch information
yaocw2020 committed Sep 30, 2022
1 parent 080988c commit 4b01477
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/network/vlan/vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"k8s.io/klog"

"github.com/harvester/harvester-network-controller/pkg/network/iface"
"github.com/harvester/harvester-network-controller/pkg/utils"
)

type Vlan struct {
Expand Down Expand Up @@ -114,8 +115,10 @@ func (v *Vlan) AddLocalArea(la *LocalArea) error {
return nil
}

if err := v.uplink.AddBridgeVlan(la.Vid); err != nil {
return fmt.Errorf("add bridge vlanconfig %d failed, error: %w", la.Vid, err)
if v.name != utils.ManagementClusterNetworkName {
if err := v.uplink.AddBridgeVlan(la.Vid); err != nil {
return fmt.Errorf("add bridge vlanconfig %d failed, error: %w", la.Vid, err)
}
}

if la.Cidr == "" {
Expand All @@ -141,8 +144,10 @@ func (v *Vlan) RemoveLocalArea(la *LocalArea) error {
return nil
}

if err := v.uplink.DelBridgeVlan(la.Vid); err != nil {
return fmt.Errorf("remove bridge vlanconfig %d failed, error: %w", la.Vid, err)
if v.name != utils.ManagementClusterNetworkName {
if err := v.uplink.DelBridgeVlan(la.Vid); err != nil {
return fmt.Errorf("remove bridge vlanconfig %d failed, error: %w", la.Vid, err)
}
}

if la.Cidr == "" {
Expand Down

0 comments on commit 4b01477

Please sign in to comment.