Use unified type for the namespaced object names

This commit is contained in:
Murat Kabilov
2017-05-12 11:41:34 +02:00
parent 79fdba4ac7
commit 08c0e3b6dd
10 changed files with 69 additions and 85 deletions
+4 -7
View File
@@ -59,7 +59,7 @@ type Cluster struct {
logger *logrus.Entry
pgUsers map[string]spec.PgUser
podEvents chan spec.PodEvent
podSubscribers map[spec.PodName]chan spec.PodEvent
podSubscribers map[spec.NamespacedName]chan spec.PodEvent
pgDb *sql.DB
mu sync.Mutex
}
@@ -74,18 +74,15 @@ func New(cfg Config, pgSpec spec.Postgresql, logger *logrus.Logger) *Cluster {
logger: lg,
pgUsers: make(map[string]spec.PgUser),
podEvents: make(chan spec.PodEvent),
podSubscribers: make(map[spec.PodName]chan spec.PodEvent),
podSubscribers: make(map[spec.NamespacedName]chan spec.PodEvent),
kubeResources: kubeResources,
}
return cluster
}
func (c *Cluster) ClusterName() spec.ClusterName {
return spec.ClusterName{
Name: c.Metadata.Name,
Namespace: c.Metadata.Namespace,
}
func (c *Cluster) ClusterName() spec.NamespacedName {
return util.NameFromMeta(c.Metadata)
}
func (c *Cluster) TeamName() string {