Skip to content

Commit

Permalink
Merge pull request #338 from alauda/refactor/subnet
Browse files Browse the repository at this point in the history
feat: refactor subnet and allow cidr change
  • Loading branch information
oilbeater authored May 11, 2020
2 parents 9f2e718 + 13283da commit 462aa15
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 427 deletions.
4 changes: 4 additions & 0 deletions dist/images/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install.sh
cleanup.sh
kubectl-ko
*.yaml
2 changes: 2 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,9 @@ diagnose(){
case $type in
all)
echo "### kube-ovn-controller recent log"
set +e
kubectl logs -n $KUBE_OVN_NS -l app=kube-ovn-controller --tail=100 | grep E$(date +%m%d)
set -e
echo ""
pingers=$(kubectl get pod -n $KUBE_OVN_NS | grep kube-ovn-pinger | awk '{print $1}')
for pinger in $pingers
Expand Down
2 changes: 2 additions & 0 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ diagnose(){
case $type in
all)
echo "### kube-ovn-controller recent log"
set +e
kubectl logs -n $KUBE_OVN_NS -l app=kube-ovn-controller --tail=100 | grep E$(date +%m%d)
set -e
echo ""
pingers=$(kubectl get pod -n $KUBE_OVN_NS | grep kube-ovn-pinger | awk '{print $1}')
for pinger in $pingers
Expand Down
10 changes: 3 additions & 7 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ type Controller struct {

subnetsLister kubeovnlister.SubnetLister
subnetSynced cache.InformerSynced
addSubnetQueue workqueue.RateLimitingInterface
addOrUpdateSubnetQueue workqueue.RateLimitingInterface
deleteSubnetQueue workqueue.RateLimitingInterface
deleteRouteQueue workqueue.RateLimitingInterface
updateSubnetQueue workqueue.RateLimitingInterface
updateSubnetStatusQueue workqueue.RateLimitingInterface

ipsLister kubeovnlister.IPLister
Expand Down Expand Up @@ -127,10 +126,9 @@ func NewController(config *Configuration) *Controller {

subnetsLister: subnetInformer.Lister(),
subnetSynced: subnetInformer.Informer().HasSynced,
addSubnetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "AddSubnet"),
addOrUpdateSubnetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "AddSubnet"),
deleteSubnetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "DeleteSubnet"),
deleteRouteQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "DeleteRoute"),
updateSubnetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "UpdateSubnet"),
updateSubnetStatusQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "UpdateSubnetStatus"),

ipsLister: ipInformer.Lister(),
Expand Down Expand Up @@ -282,8 +280,7 @@ func (c *Controller) shutdown() {

c.addNamespaceQueue.ShutDown()

c.addSubnetQueue.ShutDown()
c.updateSubnetQueue.ShutDown()
c.addOrUpdateSubnetQueue.ShutDown()
c.deleteSubnetQueue.ShutDown()
c.deleteRouteQueue.ShutDown()
c.updateSubnetStatusQueue.ShutDown()
Expand Down Expand Up @@ -356,7 +353,6 @@ func (c *Controller) startWorkers(stopCh <-chan struct{}) {
go wait.Until(c.runUpdatePodWorker, time.Second, stopCh)

go wait.Until(c.runDeleteSubnetWorker, time.Second, stopCh)
go wait.Until(c.runUpdateSubnetWorker, time.Second, stopCh)
go wait.Until(c.runDeleteRouteWorker, time.Second, stopCh)
go wait.Until(c.runUpdateSubnetStatusWorker, time.Second, stopCh)

Expand Down
Loading

0 comments on commit 462aa15

Please sign in to comment.