Skip to content

Commit

Permalink
[sc-12837] install flow should wait for static amount of pvcs (#273)
Browse files Browse the repository at this point in the history
Co-authored-by: Steb Veksler <[email protected]>
  • Loading branch information
avivzgroundcover and steb-veksler authored Jan 11, 2024
1 parent 9fcae8c commit 0a1ba6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ We use the following categories for changes:
### Changed

### Fixed
- CLI should expect a static amount of PVCs [#sc-12837]

### Removed

Expand Down
12 changes: 9 additions & 3 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"groundcover.com/pkg/segment"
sentry_utils "groundcover.com/pkg/sentry"
"groundcover.com/pkg/ui"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -308,12 +309,16 @@ func waitForPvcs(ctx context.Context, kubeClient *k8s.Client, releaseName, names
LabelSelector: fmt.Sprintf("app.kubernetes.io/instance=%s", releaseName),
}

var pvcList *v1.PersistentVolumeClaimList
if pvcList, err = kubeClient.CoreV1().PersistentVolumeClaims(namespace).List(ctx, listOptions); err != nil {
var stsList *appsv1.StatefulSetList
if stsList, err = kubeClient.AppsV1().StatefulSets(namespace).List(ctx, listOptions); err != nil {
return err
}

expectedBoundPvcsCount := len(pvcList.Items)
expectedBoundPvcsCount := 0
for _, sts := range stsList.Items {
expectedBoundPvcsCount = expectedBoundPvcsCount + len(sts.Spec.VolumeClaimTemplates)
}

if expectedBoundPvcsCount == 0 {
ui.GlobalWriter.PrintWarningMessageln("No Presistent volumes")
return nil
Expand All @@ -328,6 +333,7 @@ func waitForPvcs(ctx context.Context, kubeClient *k8s.Client, releaseName, names

boundPvcs := make(map[string]bool, 0)

var pvcList *v1.PersistentVolumeClaimList
isPvcsReadyFunc := func() error {
if pvcList, err = kubeClient.CoreV1().PersistentVolumeClaims(namespace).List(ctx, listOptions); err != nil {
return err
Expand Down

0 comments on commit 0a1ba6b

Please sign in to comment.