modify ippool api resource to namespace scope

sync namespace annotation when ippool is deleting

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
This commit is contained in:
Duan Jiong
2021-03-16 19:41:26 +08:00
parent 3a79df0da5
commit ff1587f445
2 changed files with 17 additions and 2 deletions

View File

@@ -402,7 +402,9 @@ func (c *IPPoolController) processNS(name string) error {
}
for _, pool := range pools {
poolsName = append(poolsName, pool.Name)
if pool.Status.Synced {
poolsName = append(poolsName, pool.Name)
}
}
}
@@ -534,6 +536,19 @@ func NewIPPoolController(
}
c.enqueueIPPools(new)
},
DeleteFunc: func(new interface{}) {
_, defaultNew := new.(*networkv1alpha1.IPPool).Labels[networkv1alpha1.IPPoolDefaultLabel]
if defaultNew {
nss, err := c.nsInformer.Lister().List(labels.Everything())
if err != nil {
return
}
for _, ns := range nss {
c.enqueueNamespace(nil, ns)
}
}
},
})
//just for update ippool status