Add a mutex to protect against simultaneous read/write to backend config

This addresses issues found by race detector.
This commit is contained in:
Archangel_SDY 2018-12-06 21:24:41 +08:00
parent 9122c08b3e
commit d58dbde5e3
3 changed files with 20 additions and 9 deletions

View file

@ -36,8 +36,8 @@ import (
// syncSecret synchronizes the content of a TLS Secret (certificate(s), secret
// key) with the filesystem. The resulting files can be used by NGINX.
func (s k8sStore) syncSecret(key string) {
s.mu.Lock()
defer s.mu.Unlock()
s.syncSecretMu.Lock()
defer s.syncSecretMu.Unlock()
klog.V(3).Infof("Syncing Secret %q", key)