Avoid data race syncing secrets
This commit is contained in:
parent
3fe8524318
commit
45326e4c58
2 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,9 @@ import (
|
|||
// disk to allow copy of the content of the secret to disk to be used
|
||||
// by external processes.
|
||||
func (s k8sStore) syncSecret(key string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
glog.V(3).Infof("starting syncing of secret %v", key)
|
||||
|
||||
// TODO: getPemCertificate should not write to disk to avoid unnecessary overhead
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
@ -182,6 +183,8 @@ type k8sStore struct {
|
|||
filesystem file.Filesystem
|
||||
|
||||
updateCh chan Event
|
||||
|
||||
mu *sync.Mutex
|
||||
}
|
||||
|
||||
// New creates a new object store to be used in the ingress controller
|
||||
|
@ -200,6 +203,7 @@ func New(checkOCSP bool,
|
|||
filesystem: fs,
|
||||
updateCh: updateCh,
|
||||
backendConfig: ngx_config.NewDefault(),
|
||||
mu: &sync.Mutex{},
|
||||
}
|
||||
|
||||
eventBroadcaster := record.NewBroadcaster()
|
||||
|
|
Loading…
Reference in a new issue