diff --git a/controllers/mariadb.go b/controllers/mariadb.go index bcbdc0d..baff2cd 100644 --- a/controllers/mariadb.go +++ b/controllers/mariadb.go @@ -313,7 +313,10 @@ GRANT ALL ON *.* TO root@'%%' WITH GRANT OPTION;`, } } - isReady := stsReady && zuulDBSecret.Data != nil + pvcDataReadiness := r.reconcileExpandPVC(MariaDBIdent+"-"+MariaDBIdent+"-0", r.cr.Spec.MariaDB.DBStorage) + pvcLogsReadiness := r.reconcileExpandPVC(MariaDBIdent+"-logs-"+MariaDBIdent+"-0", r.cr.Spec.MariaDB.LogStorage) + + isReady := stsReady && pvcDataReadiness && pvcLogsReadiness && zuulDBSecret.Data != nil conds.UpdateConditions(&r.cr.Status.Conditions, MariaDBIdent, isReady) diff --git a/controllers/utils.go b/controllers/utils.go index 9e923c7..75f1040 100644 --- a/controllers/utils.go +++ b/controllers/utils.go @@ -447,6 +447,25 @@ func BaseGetStorageConfOrDefault(storageSpec sfv1.StorageSpec, storageDefault sf } } +func (r *SFUtilContext) reconcileExpandPVCs(serviceName string, newStorageSpec sfv1.StorageSpec) bool { + PVCList := &apiv1.PersistentVolumeClaimList{} + err := r.Client.List(r.ctx, PVCList, client.MatchingLabels{"run": serviceName, "app": "sf"}) + if err != nil { + utils.LogE(err, "Unable to get the list of PVC for service "+serviceName) + return false + } + readyList := []bool{} + for _, pvc := range PVCList.Items { + readyList = append(readyList, r.reconcileExpandPVC(pvc.Name, newStorageSpec)) + } + for _, r := range readyList { + if !r { + return false + } + } + return true +} + // reconcileExpandPVC resizes the pvc with the spec func (r *SFUtilContext) reconcileExpandPVC(pvcName string, newStorageSpec sfv1.StorageSpec) bool { newQTY := newStorageSpec.Size @@ -474,7 +493,7 @@ func (r *SFUtilContext) reconcileExpandPVC(pvcName string, newStorageSpec sfv1.S case apiv1.PersistentVolumeClaimResizing, apiv1.PersistentVolumeClaimFileSystemResizePending: - utils.LogI("Volume resizing in progress, not ready") + utils.LogI("Volume " + pvcName + " resizing in progress, not ready") return false } } diff --git a/controllers/zuul.go b/controllers/zuul.go index edb7008..0fa715c 100644 --- a/controllers/zuul.go +++ b/controllers/zuul.go @@ -611,7 +611,9 @@ func (r *SFController) EnsureZuulExecutor(cfg *ini.File) bool { return false } - ready := r.IsStatefulSetReady(current) + pvcReadiness := r.reconcileExpandPVCs("zuul-executor", r.cr.Spec.Zuul.Executor.Storage) + + ready := r.IsStatefulSetReady(current) && pvcReadiness conds.UpdateConditions(&r.cr.Status.Conditions, "zuul-executor", ready) return ready @@ -675,7 +677,9 @@ func (r *SFController) EnsureZuulMerger(cfg *ini.File) bool { return false } - ready := r.IsStatefulSetReady(current) + pvcReadiness := r.reconcileExpandPVCs("zuul-merger", r.cr.Spec.Zuul.Merger.Storage) + + ready := r.IsStatefulSetReady(current) && pvcReadiness conds.UpdateConditions(&r.cr.Status.Conditions, service, ready) return ready diff --git a/doc/reference/CHANGELOG.md b/doc/reference/CHANGELOG.md index ee948cf..97b0659 100644 --- a/doc/reference/CHANGELOG.md +++ b/doc/reference/CHANGELOG.md @@ -10,6 +10,12 @@ All notable changes to this project will be documented in this file. ### Fixed ### Security +## [v0.0.40] - 2024-09-06 + +### Added + +- support for storage (PVC) resize of zuul-executor, zuul-merger and mariadb. + ## [v0.0.39] - 2024-09-04 ### Added