Skip to content

Commit

Permalink
Merge pull request #7 from stakater/handle-update
Browse files Browse the repository at this point in the history
handle proxy injection on resource update
  • Loading branch information
faizanahmad055 authored Nov 15, 2018
2 parents ad439b8 + 7ad7d43 commit 4b10a2c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func NewController(
listWatcher := cache.NewListWatchFromClient(client.ExtensionsV1beta1().RESTClient(), resource, namespace, fields.Everything())

indexer, informer := cache.NewIndexerInformer(listWatcher, kube.ResourceMap[resource], 0, cache.ResourceEventHandlerFuncs{
AddFunc: c.Add,
AddFunc: c.Add,
UpdateFunc: c.Update,
}, cache.Indexers{})
c.indexer = indexer
c.informer = informer
Expand All @@ -57,6 +58,13 @@ func (c *Controller) Add(obj interface{}) {
})
}

// Add function to add a new object to the queue in case of creating a resource
func (c *Controller) Update(old interface{}, new interface{}) {
c.queue.Add(handler.ResourceCreatedHandler{
Resource: new,
})
}

//Run function for controller which handles the queue
func (c *Controller) Run(threadiness int, stopCh chan struct{}) {

Expand Down

0 comments on commit 4b10a2c

Please sign in to comment.