Skip to content

Commit

Permalink
start evpc ph1
Browse files Browse the repository at this point in the history
  • Loading branch information
lut777 committed Jun 17, 2021
1 parent e3a3d96 commit a5fef59
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/controller/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func (c *Controller) enqueueAddVpc(obj interface{}) {
return
}
klog.V(3).Infof("enqueue add vpc %s", key)
c.addOrUpdateVpcQueue.Add(key)
vpc := obj.(*kubeovnv1.Vpc)
if _, ok := vpc.Labels[util.VpcExternalLabel]; !ok {
c.addOrUpdateVpcQueue.Add(key)
}
}

func (c *Controller) enqueueUpdateVpc(old, new interface{}) {
Expand All @@ -48,13 +51,17 @@ func (c *Controller) enqueueUpdateVpc(old, new interface{}) {
return
}

if !newVpc.DeletionTimestamp.IsZero() {
_, oldOk := oldVpc.Labels[util.VpcExternalLabel]
_, newOk := newVpc.Labels[util.VpcExternalLabel]

if !newVpc.DeletionTimestamp.IsZero() && (!oldOk && !newOk) {
c.addOrUpdateVpcQueue.Add(key)
return
}

if !reflect.DeepEqual(oldVpc.Spec.Namespaces, newVpc.Spec.Namespaces) ||
!reflect.DeepEqual(oldVpc.Spec.StaticRoutes, newVpc.Spec.StaticRoutes) {
if (!reflect.DeepEqual(oldVpc.Spec.Namespaces, newVpc.Spec.Namespaces) ||
!reflect.DeepEqual(oldVpc.Spec.StaticRoutes, newVpc.Spec.StaticRoutes)) &&
(!oldOk && !newOk) {
klog.V(3).Infof("enqueue update vpc %s", key)
c.addOrUpdateVpcQueue.Add(key)
}
Expand All @@ -71,7 +78,8 @@ func (c *Controller) enqueueDelVpc(obj interface{}) {
return
}
vpc := obj.(*kubeovnv1.Vpc)
if !vpc.Status.Default {
_, ok := vpc.Labels[util.VpcExternalLabel]
if !vpc.Status.Default || !ok {
klog.V(3).Infof("enqueue delete vpc %s", key)
c.delVpcQueue.Add(obj)
}
Expand Down

0 comments on commit a5fef59

Please sign in to comment.