Merge pull request #118995 from pohly/test-integration-race-detection-flowcontrol-II

flowcontrol: copy object before passing it to client-go Create to avoid data race
This commit is contained in:
Kubernetes Prow Robot 2023-06-30 08:18:43 -07:00 committed by GitHub
commit 86fec81606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,7 +269,7 @@ func EnsureConfiguration[ObjectType configurationObjectType](ctx context.Context
}
// we always re-create a missing configuration object
if _, err = ops.Create(ctx, bootstrap, metav1.CreateOptions{FieldManager: fieldManager}); err == nil {
if _, err = ops.Create(ctx, ops.DeepCopy(bootstrap), metav1.CreateOptions{FieldManager: fieldManager}); err == nil {
klog.V(2).InfoS(fmt.Sprintf("Successfully created %s", bootstrap.GetObjectKind().GroupVersionKind().Kind), "type", configurationType, "name", name)
return nil
}