Skip to content

Commit

Permalink
Added logics for quorum loss scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdasgupta committed Sep 8, 2022
1 parent 49c6900 commit 33010f3
Show file tree
Hide file tree
Showing 13 changed files with 602 additions and 126 deletions.
116 changes: 17 additions & 99 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,151 +7,69 @@ metadata:
name: manager-role
rules:
- apiGroups:
- ""
- batch
resources:
- pods
- jobs
verbs:
- list
- watch
- create
- delete
- apiGroups:
- ""
resources:
- secrets
- endpoints
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
- coordination.k8s.io
resources:
- events
- leases
verbs:
- create
- delete
- deletecollection
- get
- list
- watch
- patch
- update
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
- druid.gardener.cloud
resources:
- roles
- rolebindings
- etcds
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
- apps
resources:
- services
- configmaps
- statefulsets
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- batch
resources:
- cronjobs
verbs:
- get
- list
- watch
- delete
- apiGroups:
- druid.gardener.cloud
resources:
- etcds
- etcdcopybackupstasks
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- druid.gardener.cloud
resources:
- etcds/status
- etcds/finalizers
- etcdcopybackupstasks/status
- etcdcopybackupstasks/finalizers
verbs:
- get
- update
- patch
- create
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- deletecollection
- apiGroups:
- ""
- druid.gardener.cloud
resources:
- persistentvolumeclaims
- secrets
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- create
- delete
- get
- list
- watch
- create
- update
- patch
- delete
- update
- watch
2 changes: 2 additions & 0 deletions controllers/config/custodian.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type EtcdCustodianController struct {
EtcdMember EtcdMemberConfig
// SyncPeriod is the duration after which re-enqueuing happens.
SyncPeriod time.Duration
// EnableAutomaticQuorumLossHandling is the flag to enable automatic handling of quorum loss. Set it false by default.
EnableAutomaticQuorumLossHandling bool
}

type EtcdMemberConfig struct {
Expand Down
11 changes: 8 additions & 3 deletions controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (
mgrStopped *sync.WaitGroup

activeDeadlineDuration time.Duration
waitDuration time.Duration
backupCompactionSchedule = "15 */24 * * *"

revertFns []func()
Expand Down Expand Up @@ -102,7 +103,9 @@ var _ = BeforeSuite(func(done Done) {
})
Expect(err).NotTo(HaveOccurred())

er, err := NewEtcdReconcilerWithImageVector(mgr, false)
waitDuration, err = time.ParseDuration("10s")
Expect(err).NotTo(HaveOccurred())
er, err := NewEtcdReconcilerWithImageVector(mgr, false, waitDuration)
Expect(err).NotTo(HaveOccurred())

err = er.SetupWithManager(mgr, 5, true)
Expand All @@ -114,8 +117,10 @@ var _ = BeforeSuite(func(done Done) {
Expect(err).NotTo(HaveOccurred())

custodian := NewEtcdCustodian(mgr, controllersconfig.EtcdCustodianController{
SyncPeriod: 10 * time.Second,
EnableAutomaticQuorumLossHandling: true,
EtcdMember: controllersconfig.EtcdMemberConfig{
EtcdMemberNotReadyThreshold: 1 * time.Minute,
EtcdMemberNotReadyThreshold: 20 * time.Second,
},
})

Expand All @@ -138,7 +143,7 @@ var _ = BeforeSuite(func(done Done) {
})
Expect(err).NotTo(HaveOccurred())

err = lc.SetupWithManager(mgr, 1)
err = lc.SetupWithManager(mgr, 5)
Expect(err).NotTo(HaveOccurred())

mgrStopped = startTestManager(mgrCtx, mgr)
Expand Down
Loading

0 comments on commit 33010f3

Please sign in to comment.