-
Notifications
You must be signed in to change notification settings - Fork 434
/
ip.go
43 lines (37 loc) · 1.04 KB
/
ip.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package controller
import (
"strings"
"github.com/kubeovn/kube-ovn/pkg/util"
"k8s.io/klog/v2"
kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
)
func (c *Controller) enqueueAddOrDelIP(obj interface{}) {
if !c.isLeader() {
return
}
if _, ok := obj.(*kubeovnv1.IP); !ok {
klog.Errorf("object is not an IP, ignore it")
return
}
ipObj := obj.(*kubeovnv1.IP)
klog.V(3).Infof("enqueue update status subnet %s", ipObj.Spec.Subnet)
if strings.HasPrefix(ipObj.Name, util.U2OInterconnName[0:19]) {
return
}
c.updateSubnetStatusQueue.Add(ipObj.Spec.Subnet)
for _, as := range ipObj.Spec.AttachSubnets {
klog.V(3).Infof("enqueue update status subnet %s", as)
c.updateSubnetStatusQueue.Add(as)
}
}
func (c *Controller) enqueueUpdateIP(old, new interface{}) {
if !c.isLeader() {
return
}
ipObj := new.(*kubeovnv1.IP)
klog.V(3).Infof("enqueue update status subnet %s", ipObj.Spec.Subnet)
for _, as := range ipObj.Spec.AttachSubnets {
klog.V(3).Infof("enqueue update status subnet %s", as)
c.updateSubnetStatusQueue.Add(as)
}
}