Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #121142: Modify test PVC to detect concurrent map write bug #121184

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/controller/statefulset/stateful_set_control_test.go
Expand Up @@ -2927,6 +2927,7 @@ func TestParallelScale(t *testing.T) {
} {
t.Run(tc.desc, func(t *testing.T) {
set := burst(newStatefulSet(0))
set.Spec.VolumeClaimTemplates[0].ObjectMeta.Labels = map[string]string{"test": "test"}
parallelScale(t, set, tc.replicas, tc.desiredReplicas, assertBurstInvariants)
})
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/statefulset/stateful_set_utils.go
Expand Up @@ -339,8 +339,8 @@ func getPersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) map[string]v1
templates := set.Spec.VolumeClaimTemplates
claims := make(map[string]v1.PersistentVolumeClaim, len(templates))
for i := range templates {
claim := templates[i]
claim.Name = getPersistentVolumeClaimName(set, &claim, ordinal)
claim := templates[i].DeepCopy()
claim.Name = getPersistentVolumeClaimName(set, claim, ordinal)
claim.Namespace = set.Namespace
if claim.Labels != nil {
for key, value := range set.Spec.Selector.MatchLabels {
Expand All @@ -349,7 +349,7 @@ func getPersistentVolumeClaims(set *apps.StatefulSet, pod *v1.Pod) map[string]v1
} else {
claim.Labels = set.Spec.Selector.MatchLabels
}
claims[templates[i].Name] = claim
claims[templates[i].Name] = *claim
}
return claims
}
Expand Down