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

Avoid unnecessary PVCs updates when updating ownerRefs #5451

Closed
pebrc opened this issue Mar 9, 2022 · 0 comments · Fixed by #5459
Closed

Avoid unnecessary PVCs updates when updating ownerRefs #5451

pebrc opened this issue Mar 9, 2022 · 0 comments · Fixed by #5459
Assignees
Labels
>bug Something isn't working

Comments

@pebrc
Copy link
Collaborator

pebrc commented Mar 9, 2022

Related to #5450

in

for _, pvc := range pvcs.Items {
pvc := pvc
switch es.Spec.VolumeClaimDeletePolicyOrDefault() {
case esv1.DeleteOnScaledownOnlyPolicy:
k8s.RemoveOwner(&pvc, &es)
case esv1.DeleteOnScaledownAndClusterDeletionPolicy:
if err := controllerutil.SetOwnerReference(&es, &pvc, scheme.Scheme); err != nil {
return fmt.Errorf("while setting owner during owner ref reconciliation: %w", err)
}
}
if err := c.Update(context.Background(), &pvc); err != nil {
return fmt.Errorf("while updating pvc during owner ref reconciliation: %w", err)
}
}

we do not check whether a update of the PVC is actually necessary. We should use a similar approach here as in other cases whereby we compare the current state with the desired state and only issue the update if they differ.

This should significantly reduce the number updates on PVCs the operator does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant