Resource manager: add service lister and remove unused lock. (#559)

* Remove unused lock from the resource manager.

* Add service lister to the resource manager.

This change adds a service lister in the
resource manager.
This will be used to set the service env vars.
Also added a List method to the resource manager
and a simple test to confirm it's a pass through.
This commit is contained in:
Yash Desai
2019-04-03 11:19:30 -07:00
committed by Brian Goff
parent 85292ef4ef
commit 750de3195d
6 changed files with 63 additions and 13 deletions

View File

@@ -312,8 +312,11 @@ func initConfig() {
secretInformer := scmInformerFactory.Core().V1().Secrets()
configMapInformer := scmInformerFactory.Core().V1().ConfigMaps()
// Create a service informer so we can pass its lister to the resource manager.
serviceInformer := scmInformerFactory.Core().V1().Services()
// Create a new instance of the resource manager that uses the listers above for pods, secrets and config maps.
rm, err = manager.NewResourceManager(podInformer.Lister(), secretInformer.Lister(), configMapInformer.Lister())
rm, err = manager.NewResourceManager(podInformer.Lister(), secretInformer.Lister(), configMapInformer.Lister(), serviceInformer.Lister())
if err != nil {
logger.WithError(err).Fatal("Error initializing resource manager")
}