Commit 4a08a693 authored by Nikhita Raghunath's avatar Nikhita Raghunath

fix data race in storage (during addition)

parent 64a984bb
......@@ -343,8 +343,17 @@ func (r *crdHandler) getServingInfoFor(crd *apiextensions.CustomResourceDefiniti
storage: storage,
requestScope: requestScope,
}
storageMap[crd.UID] = ret
r.customStorage.Store(storageMap)
storageMap2 := make(crdStorageMap, len(storageMap))
// Copy because we cannot write to storageMap without a race
// as it is used without locking elsewhere
for k, v := range storageMap {
storageMap2[k] = v
}
storageMap2[crd.UID] = ret
r.customStorage.Store(storageMap2)
return ret
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment