Skip to content

Commit

Permalink
reuse logical_switch namespace annotation instead introducing a new one
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <[email protected]>
  • Loading branch information
cnvergence committed Aug 12, 2024
1 parent 3cc1b7a commit bcf37b6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
7 changes: 2 additions & 5 deletions pkg/controller/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c *Controller) handleAddNamespace(key string) error {
}
namespace := cachedNs.DeepCopy()

var ls, ds, ippool string
var ls, ippool string
var lss, cidrs, excludeIps []string
subnets, err := c.subnetsLister.List(labels.Everything())
if err != nil {
Expand Down Expand Up @@ -159,7 +159,7 @@ func (c *Controller) handleAddNamespace(key string) error {
return err
}
if s.Name == vpc.Spec.DefaultSubnet {
ds = s.Name
lss = []string{s.Name}
}
}
}
Expand Down Expand Up @@ -214,9 +214,6 @@ func (c *Controller) handleAddNamespace(key string) error {
return nil
}

if ds != "" {
namespace.Annotations[util.DefaultSubnetAnnotation] = ds
}
namespace.Annotations[util.LogicalSwitchAnnotation] = strings.Join(lss, ",")
namespace.Annotations[util.CidrAnnotation] = strings.Join(cidrs, ";")
namespace.Annotations[util.ExcludeIpsAnnotation] = strings.Join(excludeIps, ";")
Expand Down
8 changes: 0 additions & 8 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1534,14 +1534,6 @@ func (c *Controller) getPodDefaultSubnet(pod *v1.Pod) (*kubeovnv1.Subnet, error)
klog.Error(err)
return nil, err
}
if _, ok := ns.Annotations[util.DefaultSubnetAnnotation]; ok {
subnet, err = c.subnetsLister.Get(ns.Annotations[util.DefaultSubnetAnnotation])
if err != nil {
klog.Errorf("failed to get subnet %v", err)
return nil, err
}
return subnet, nil
}

subnetNames := ns.Annotations[util.LogicalSwitchAnnotation]
for _, subnetName := range strings.Split(subnetNames, ",") {
Expand Down
1 change: 0 additions & 1 deletion pkg/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const (

PortNameAnnotation = "ovn.kubernetes.io/port_name"
LogicalSwitchAnnotation = "ovn.kubernetes.io/logical_switch"
DefaultSubnetAnnotation = "ovn.kubernetes.io/default_vpc_subnet"

TunnelInterfaceAnnotation = "ovn.kubernetes.io/tunnel_interface"

Expand Down

0 comments on commit bcf37b6

Please sign in to comment.