diff --git a/config/context.go b/config/context.go index 013e5ef1..229a742b 100644 --- a/config/context.go +++ b/config/context.go @@ -23,6 +23,7 @@ import ( projectSchema "github.com/rancher/types/apis/project.cattle.io/v3/schema" rbacv1 "github.com/rancher/types/apis/rbac.authorization.k8s.io/v1" "github.com/rancher/types/config/dialer" + "github.com/rancher/types/peermanager" "github.com/rancher/types/user" "github.com/sirupsen/logrus" "k8s.io/api/core/v1" @@ -51,7 +52,7 @@ type ScaledContext struct { AccessControl types.AccessControl Dialer dialer.Factory UserManager user.Manager - Leader bool + PeerManager peermanager.PeerManager Management managementv3.Interface Project projectv3.Interface diff --git a/peermanager/peermanager.go b/peermanager/peermanager.go new file mode 100644 index 00000000..b71a1a6a --- /dev/null +++ b/peermanager/peermanager.go @@ -0,0 +1,15 @@ +package peermanager + +type Peers struct { + SelfID string + IDs []string + Ready bool + Leader bool +} + +type PeerManager interface { + IsLeader() bool + Leader() + AddListener(l chan<- Peers) + RemoveListener(l chan<- Peers) +}