Conversation
egegunes
reviewed
Apr 28, 2026
Comment on lines
+222
to
+234
| if configured.Cmp(requested) <= 0 { | ||
| if configured.Cmp(requested) == 0 { | ||
| return nil | ||
| } | ||
|
|
||
| log.Info("Deleting statefulset to reconcile volume claim template", "configured", configured.String(), "requested", requested.String(), "actual", actual.String()) | ||
| if err := r.client.Delete(ctx, sts, client.PropagationPolicy("Orphan")); err != nil { | ||
| if !k8serrors.IsNotFound(err) { | ||
| return errors.Wrapf(err, "delete statefulset/%s", sts.Name) | ||
| } | ||
| } | ||
| return nil | ||
| } |
Contributor
There was a problem hiding this comment.
i don't understand why this is needed, wasn't the issue caused by rounding the value up and fixed by removing rounding logic?
Contributor
Author
There was a problem hiding this comment.
Without this part the operator tries to update the StatefulSet template with the value specified in the cr.yaml. If we are going to remove this part then we should fix the problem with sts update by setting the actual size of the PVC in the pxc.StatefulSet function. So I think that the current version is a cleaner fix
Collaborator
commit: e171efa |
nmarukovich
reviewed
Apr 30, 2026
| configured: "1Gi", | ||
| actual: "6G", | ||
| }, | ||
| } |
Contributor
There was a problem hiding this comment.
Maybe it make sense to add the case with configured=1.2Gi, actual=2Gi requested=2Gi ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/K8SPXC-1648
DESCRIPTION
Problem:
When
volumeSpec.persistentVolumeClaim.resources.requests.storageis set to1.2Gioperator creates a statefulset with the same size, but2GiPVC is created. After updating thecr.yamlto the2Githe operator should recreate the statefulset with the new size, but it tries to update statefulset instead and gets the following error:...update error: StatefulSet.apps "minimal-cluster-pxc" is invalid: spec: Forbidden: updates to statefulset spec for fields other than ...Cause:
The storage provisioners may create a
2GiPVC for a1.2Girequest because it allocates storage in larger chunks.The operator logic rounded the requested size to GiB and then checked for an exact match, but the actual PVC may have a larger size than the value from the
cr.yaml.Because of that, after changing the CR to 2Gi, the operator wasn't able to check if PVC resize update is needed and tried to update the StatefulSet template instead.
Solution:
The operator now uses the exact value from
cr.yamland treats the pvc as correct when its actual size is greater than or equal to the requested size.It also checks whether the StatefulSet template still has an old storage value. If the PVC already has enough space but the template is different, the operator deletes and recreates the StatefulSet instead of trying to update it
This PR should also fix https://perconadev.atlassian.net/browse/K8SPXC-1438
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability