add cluster and controller methods for getting status

This commit is contained in:
Murat Kabilov
2017-08-15 12:11:06 +02:00
parent 4ee28e3818
commit 82f58b57d8
4 changed files with 238 additions and 0 deletions
+39
View File
@@ -4,9 +4,12 @@ import (
"database/sql"
"fmt"
"strings"
"time"
"github.com/Sirupsen/logrus"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/apis/apps/v1beta1"
"k8s.io/client-go/rest"
)
@@ -73,6 +76,42 @@ type UserSyncer interface {
ExecuteSyncRequests(req []PgSyncUserRequest, db *sql.DB) error
}
// LogEntry describes log entry in the RingLogger
type LogEntry struct {
Time time.Time
Level logrus.Level
ClusterName *NamespacedName `json:",omitempty"`
Worker *uint32 `json:",omitempty"`
Message string
}
// ClusterStatus describes status of the cluster
type ClusterStatus struct {
Team string
Cluster string
MasterService *v1.Service
ReplicaService *v1.Service
Endpoint *v1.Endpoints
StatefulSet *v1beta1.StatefulSet
Worker uint32
Status PostgresStatus
Spec PostgresSpec
Error error
}
// ControllerStatus describes status of the controller
type ControllerStatus struct {
LastSyncTime int64
Clusters int
}
// QueueDump describes cache.FIFO queue
type QueueDump struct {
Keys []string
List []interface{}
}
// ControllerConfig describes configuration of the controller
type ControllerConfig struct {
RestConfig *rest.Config `json:"-"`