mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #117107 from pohly/test-integration-race-detection-flowcontrol
pkg/registry/flowcontrol: avoid race condition during Create
This commit is contained in:
commit
f5e361e4e6
@ -118,7 +118,10 @@ type fsEnsurer struct {
|
||||
|
||||
func (e *fsEnsurer) Ensure(flowSchemas []*flowcontrolv1beta3.FlowSchema) error {
|
||||
for _, flowSchema := range flowSchemas {
|
||||
if err := ensureConfiguration(e.wrapper, e.strategy, flowSchema); err != nil {
|
||||
// This code gets called by different goroutines. To avoid race conditions when
|
||||
// https://github.com/kubernetes/kubernetes/blob/330b5a2b8dbd681811cb8235947557c99dd8e593/staging/src/k8s.io/apimachinery/pkg/runtime/helper.go#L221-L243
|
||||
// temporarily modifies the TypeMeta, we have to make a copy here.
|
||||
if err := ensureConfiguration(e.wrapper, e.strategy, flowSchema.DeepCopy()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,10 @@ type plEnsurer struct {
|
||||
|
||||
func (e *plEnsurer) Ensure(priorityLevels []*flowcontrolv1beta3.PriorityLevelConfiguration) error {
|
||||
for _, priorityLevel := range priorityLevels {
|
||||
if err := ensureConfiguration(e.wrapper, e.strategy, priorityLevel); err != nil {
|
||||
// This code gets called by different goroutines. To avoid race conditions when
|
||||
// https://github.com/kubernetes/kubernetes/blob/330b5a2b8dbd681811cb8235947557c99dd8e593/staging/src/k8s.io/apimachinery/pkg/runtime/helper.go#L221-L243
|
||||
// temporarily modifies the TypeMeta, we have to make a copy here.
|
||||
if err := ensureConfiguration(e.wrapper, e.strategy, priorityLevel.DeepCopy()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user