Skip to content

Commit

Permalink
Manually requeue configmap reconcile when no nodes have reconciled sn…
Browse files Browse the repository at this point in the history
…apshots

Silences error message from lasso - this is a normal startup condition
when no snapshots exist so we shouldn't log nasty looking errors.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
  • Loading branch information
brandond committed Oct 18, 2023
1 parent 3db1d33 commit 5b6b968
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/etcd/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (

var (
snapshotConfigMapName = version.Program + "-etcd-snapshots"
errNotReconciled = errors.New("no nodes have reconciled ETCDSnapshotFile resources")
)

type etcdSnapshotHandler struct {
Expand All @@ -58,7 +59,13 @@ func registerSnapshotHandlers(ctx context.Context, etcd *ETCD) {

func (e *etcdSnapshotHandler) sync(key string, esf *apisv1.ETCDSnapshotFile) (*apisv1.ETCDSnapshotFile, error) {
if key == reconcileKey {
return nil, e.reconcile()
err := e.reconcile()
if err == errNotReconciled {
logrus.Debugf("Failed to reconcile snapshot ConfigMap: %v, requeuing", err)
e.snapshots.Enqueue(key)
return nil, nil
}
return nil, err
}
if esf == nil || !esf.DeletionTimestamp.IsZero() {
return nil, nil
Expand Down Expand Up @@ -190,7 +197,7 @@ func (e *etcdSnapshotHandler) reconcile() error {
}

if len(syncedNodes) == 0 {
return errors.New("no nodes have reconciled ETCDSnapshotFile resources")
return errNotReconciled
}

// Get a list of existing snapshots
Expand Down

0 comments on commit 5b6b968

Please sign in to comment.