Merge pull request #117107 from pohly/test-integration-race-detection-flowcontrol
pkg/registry/flowcontrol: avoid race condition during Create
This commit is contained in:
		| @@ -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 | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot