(lg *logrus.Entry, clusterName spec.NamespacedName, pgSpec *acidv1.Postgresql)
| 159 | } |
| 160 | |
| 161 | func (c *Controller) addCluster(lg *logrus.Entry, clusterName spec.NamespacedName, pgSpec *acidv1.Postgresql) (*cluster.Cluster, error) { |
| 162 | if c.opConfig.EnableTeamIdClusternamePrefix { |
| 163 | if _, err := acidv1.ExtractClusterName(clusterName.Name, pgSpec.Spec.TeamID); err != nil { |
| 164 | c.KubeClient.SetPostgresCRDStatus(clusterName, acidv1.ClusterStatusInvalid) |
| 165 | return nil, err |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | cl := cluster.New(c.makeClusterConfig(), c.KubeClient, *pgSpec, lg, c.eventRecorder) |
| 170 | cl.Run(c.stopCh) |
| 171 | teamName := strings.ToLower(cl.Spec.TeamID) |
| 172 | |
| 173 | defer c.clustersMu.Unlock() |
| 174 | c.clustersMu.Lock() |
| 175 | |
| 176 | c.teamClusters[teamName] = append(c.teamClusters[teamName], clusterName) |
| 177 | c.clusters[clusterName] = cl |
| 178 | c.clusterLogs[clusterName] = ringlog.New(c.opConfig.RingLogLines) |
| 179 | c.clusterHistory[clusterName] = ringlog.New(c.opConfig.ClusterHistoryEntries) |
| 180 | |
| 181 | return cl, nil |
| 182 | } |
| 183 | |
| 184 | func (c *Controller) processEvent(event ClusterEvent) { |
| 185 | var clusterName spec.NamespacedName |
no test coverage detected