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

add resizing operation #231

Closed
wants to merge 2 commits into from
Closed

add resizing operation #231

wants to merge 2 commits into from

Conversation

sevagol
Copy link
Collaborator

@sevagol sevagol commented Jun 4, 2024

added a comparison of pvc size with the existing one, and deletion in case of discrepancy. Should a new statefulset be created automatically after this?

Copy link
Member

@kvaps kvaps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this functionaity before this function

if err := factory.CreateOrUpdateStatefulSet(ctx, cluster, r.Client); err != nil {

It should be separate function eg.:

if isStatefulSetDeletionRequired; {
    if err := factory.DeleteStatefulSet(ctx, cluster, r.Client); err != nil {
    	return err
    }
}

desiredStorage := instance.Spec.Storage.VolumeClaimTemplate.Spec.Resources.Requests[corev1.ResourceStorage]
currentStorage := pvc.Spec.Resources.Requests[corev1.ResourceStorage]

if !reflect.DeepEqual(desiredStorage, currentStorage) {
Copy link
Member

@kvaps kvaps Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use native Kubernetes method for comparing sizes instead of reflect

if desiredStorage.Cmp(currentStorage) != 0 {
    // desiredStorage different, than currentStorage
}

Comment on lines +107 to +108
desiredStorage := instance.Spec.Storage.VolumeClaimTemplate.Spec.Resources.Requests[corev1.ResourceStorage]
currentStorage := pvc.Spec.Resources.Requests[corev1.ResourceStorage]
Copy link
Member

@kvaps kvaps Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to compare storage from specific statefulSet.Spec.VolumeClaimTemplate, not pvc

@makhov
Copy link
Contributor

makhov commented Jun 10, 2024

Do I understand it properly: with this PR we just update the StatefulSet without actual resizing of the PVCs?

Since the PVCs are already created they won't be changed even if the volumeClaimTemplates are changed. Here is the doc on how to resize the PVC:
https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/

@kvaps
Copy link
Member

kvaps commented Jun 10, 2024

Correct, the resizing of PVCs will probably implemented in separate PR

@kvaps
Copy link
Member

kvaps commented Jul 19, 2024

closed if favor #254

@kvaps kvaps closed this Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants