Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #29 from cbws/quorum-lost-failed
Browse files Browse the repository at this point in the history
Mark cluster status failed when no pods are running or quorum is lost
  • Loading branch information
Wouter0100 committed Nov 23, 2019
2 parents 57f75ae + 2268cb2 commit 542657e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
var (
reconcileInterval = 8 * time.Second
podTerminationGracePeriod = int64(5)
errAllPodsDead = newFatalError("all etcd pods are dead.")
)

type clusterEventType string
Expand Down Expand Up @@ -246,8 +247,8 @@ func (c *Cluster) run() {
continue
}
if len(running) == 0 {
// TODO: how to handle this case?
c.logger.Warningf("all etcd pods are dead.")
// All pods are dead, cluster cannot recover so return error
rerr = errAllPodsDead
break
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/cluster/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package cluster

import (
"context"
"errors"
"fmt"

api "github.com/coreos/etcd-operator/pkg/apis/etcd/v1beta2"
Expand All @@ -30,7 +29,7 @@ import (
)

// ErrLostQuorum indicates that the etcd cluster lost its quorum.
var ErrLostQuorum = errors.New("lost quorum")
var ErrLostQuorum = newFatalError("lost quorum")

// reconcile reconciles cluster current state to desired state specified by spec.
// - it tries to reconcile the cluster to desired size.
Expand Down

0 comments on commit 542657e

Please sign in to comment.