Skip to content

Commit

Permalink
put mutex around installplan creation
Browse files Browse the repository at this point in the history
Signed-off-by: akihikokuroda <akihikokuroda2020@gmail.com>
  • Loading branch information
akihikokuroda committed Jan 3, 2022
1 parent bee0b68 commit a9daa11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type Operator struct {
installPlanTimeout time.Duration
bundleUnpackTimeout time.Duration
clientFactory clients.Factory
muInstallPlan sync.Mutex
}

type CatalogSourceSyncFunc func(logger *logrus.Entry, in *v1alpha1.CatalogSource) (out *v1alpha1.CatalogSource, continueSync bool, syncError error)
Expand Down Expand Up @@ -1168,6 +1169,9 @@ func (o *Operator) ensureInstallPlan(logger *logrus.Entry, namespace string, gen
return nil, err
}

o.muInstallPlan.Lock()
defer o.muInstallPlan.Unlock()

for _, installPlan := range installPlans {
if installPlan.Spec.Generation == gen {
return reference.GetReference(installPlan)
Expand Down

0 comments on commit a9daa11

Please sign in to comment.