Skip to content

Commit 0f2fa81

Browse files
committed
put mutex block around registry pod creation
Signed-off-by: akihikokuroda <[email protected]>
1 parent ac4de75 commit 0f2fa81

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/controller/registry/reconciler/configmap.go

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package reconciler
44
import (
55
"context"
66
"fmt"
7+
"sync"
78

89
"github.com/pkg/errors"
910
"github.com/sirupsen/logrus"
@@ -166,6 +167,7 @@ type ConfigMapRegistryReconciler struct {
166167
Lister operatorlister.OperatorLister
167168
OpClient operatorclient.ClientInterface
168169
Image string
170+
MuPod sync.RWMutex
169171
}
170172

171173
var _ RegistryEnsurer = &ConfigMapRegistryReconciler{}
@@ -354,6 +356,8 @@ func (c *ConfigMapRegistryReconciler) ensureRoleBinding(source configMapCatalogS
354356

355357
func (c *ConfigMapRegistryReconciler) ensurePod(source configMapCatalogSourceDecorator, overwrite bool) error {
356358
pod := source.Pod(c.Image)
359+
c.MuPod.Lock()
360+
defer c.MuPod.Unlock()
357361
currentPods := c.currentPods(source, c.Image)
358362
if len(currentPods) > 0 {
359363
if !overwrite {

0 commit comments

Comments
 (0)