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

K8SPSMDB-1170: set error state on failed reconcile of replset #1651

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/controller/perconaservermongodb/psmdb_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package perconaservermongodb
import (
"context"
"crypto/md5"
stderrors "errors"
"fmt"
"os"
"sort"
Expand Down Expand Up @@ -575,11 +576,13 @@ func (r *ReconcilePerconaServerMongoDB) reconcileReplsets(ctx context.Context, c
return "", errors.Wrap(err, "get pods list for mongos")
}

var errs []error
clusterStatus := api.AppStateNone
for _, replset := range repls {
replsetStatus, err := r.reconcileCluster(ctx, cr, replset, mongosPods.Items)
if err != nil {
log.Error(err, "failed to reconcile cluster", "replset", replset.Name)
errs = append(errs, err)
}

statusPriority := []api.AppState{
Expand All @@ -596,7 +599,7 @@ func (r *ReconcilePerconaServerMongoDB) reconcileReplsets(ctx context.Context, c
}
}
}
return clusterStatus, nil
return clusterStatus, stderrors.Join(errs...)
}

func (r *ReconcilePerconaServerMongoDB) reconcilePause(ctx context.Context, cr *api.PerconaServerMongoDB) error {
Expand Down
Loading