mirror of
https://github.com/mariadb-operator/mariadb-operator.git
synced 2025-08-18 08:17:37 +00:00
Consider file system resizing condition to determine whether a PVC is resizing
This commit is contained in:
@ -113,7 +113,7 @@ func (r *MariaDBReconciler) waitForStorageResize(ctx context.Context, mdb *maria
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
for _, p := range pvcs {
|
||||
if pvc.IsResizing(p) {
|
||||
if pvc.IsResizing(&p) {
|
||||
logger.V(1).Info("Waiting for PVC resize", "pvc", p.Name)
|
||||
return ctrl.Result{RequeueAfter: 1 * time.Second}, nil
|
||||
}
|
||||
|
@ -2,7 +2,26 @@ package pvc
|
||||
|
||||
import corev1 "k8s.io/api/core/v1"
|
||||
|
||||
func IsResizing(pvc corev1.PersistentVolumeClaim) bool {
|
||||
// IsResizing returns true if the PVC is resizing
|
||||
func IsResizing(pvc *corev1.PersistentVolumeClaim) bool {
|
||||
return IsPersistentVolumeClaimFileSystemResizePending(pvc) || IsPersistentVolumeClaimResizing(pvc)
|
||||
}
|
||||
|
||||
// IsPersistentVolumeClaimFileSystemResizePending returns true if the PVC has FileSystemResizePending condition set to true
|
||||
func IsPersistentVolumeClaimFileSystemResizePending(pvc *corev1.PersistentVolumeClaim) bool {
|
||||
for _, c := range pvc.Status.Conditions {
|
||||
if c.Status != corev1.ConditionTrue {
|
||||
continue
|
||||
}
|
||||
if c.Type == corev1.PersistentVolumeClaimFileSystemResizePending {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsPersistentVolumeClaimResizing returns true if the PVC has Resizing condition set to true
|
||||
func IsPersistentVolumeClaimResizing(pvc *corev1.PersistentVolumeClaim) bool {
|
||||
for _, condition := range pvc.Status.Conditions {
|
||||
if condition.Status != corev1.ConditionTrue {
|
||||
continue
|
||||
|
Reference in New Issue
Block a user