Skip to content

Commit

Permalink
fix: initialize targets async
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kotzbauer <[email protected]>
  • Loading branch information
ckotzbauer committed Aug 20, 2022
1 parent 36817ad commit addc0ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ func New(k8s *kubernetes.KubeClient, sy *syft.Syft) *Processor {
}

func (p *Processor) ListenForPods() {
if !HasJobImage() {
for _, t := range p.Targets {
t.Initialize()
}
}

var informer cache.SharedIndexInformer
informer, err := p.K8s.StartPodInformer(internal.OperatorConfig.PodLabelSelector, cache.ResourceEventHandlerFuncs{
UpdateFunc: func(old, new interface{}) {
Expand Down Expand Up @@ -306,6 +300,12 @@ func (p *Processor) runInformerAsync(informer cache.SharedIndexInformer) {
}()

go func() {
if !HasJobImage() {
for _, t := range p.Targets {
t.Initialize()
}
}

logrus.Info("Start pod-informer")
informer.Run(stop)
logrus.Info("Pod-informer has stopped")
Expand Down

0 comments on commit addc0ad

Please sign in to comment.