diff --git a/pkg/util/expectations/resource_version_expectation.go b/pkg/util/expectations/resource_version_expectation.go index b01e2e798..00e237467 100644 --- a/pkg/util/expectations/resource_version_expectation.go +++ b/pkg/util/expectations/resource_version_expectation.go @@ -36,7 +36,7 @@ func NewResourceVersionExpectation() ResourceVersionExpectation { } type realResourceVersionExpectation struct { - sync.RWMutex + sync.Mutex objectVersions map[types.UID]string } @@ -57,8 +57,8 @@ func (r *realResourceVersionExpectation) Observe(obj metav1.Object) { } func (r *realResourceVersionExpectation) IsSatisfied(obj metav1.Object) bool { - r.RLock() - defer r.RUnlock() + r.Lock() + defer r.Unlock() if isResourceVersionNewer(r.objectVersions[obj.GetUID()], obj.GetResourceVersion()) { delete(r.objectVersions, obj.GetUID()) } diff --git a/pkg/util/expectations/scale_expectations.go b/pkg/util/expectations/scale_expectations.go index ee342fc71..e9ee5e810 100644 --- a/pkg/util/expectations/scale_expectations.go +++ b/pkg/util/expectations/scale_expectations.go @@ -33,7 +33,7 @@ func NewScaleExpectations() ScaleExpectations { } type realScaleExpectations struct { - sync.RWMutex + sync.Mutex // key: parent key, workload namespace/name controllerCache map[string]*realControllerScaleExpectations } diff --git a/pkg/util/expectations/update_expectations.go b/pkg/util/expectations/update_expectations.go index 35b839384..aca90871d 100644 --- a/pkg/util/expectations/update_expectations.go +++ b/pkg/util/expectations/update_expectations.go @@ -41,7 +41,7 @@ func NewUpdateExpectations(getRevision func(metav1.Object) string) UpdateExpecta } type realUpdateExpectations struct { - sync.RWMutex + sync.Mutex // key: parent key, workload namespace/name controllerCache map[string]*realControllerUpdateExpectations // how to get pod revision