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 5, 2022
1 parent 20a4381 commit f29ae6d
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 @@ -1162,6 +1163,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 f29ae6d

Please sign in to comment.