MCPcopy Index your code
hub / github.com/zalando/postgres-operator / addCluster

Method addCluster

pkg/controller/postgresql.go:161–182  ·  view source on GitHub ↗
(lg *logrus.Entry, clusterName spec.NamespacedName, pgSpec *acidv1.Postgresql)

Source from the content-addressed store, hash-verified

159}
160
161func (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
184func (c *Controller) processEvent(event ClusterEvent) {
185 var clusterName spec.NamespacedName

Callers 2

processEventMethod · 0.95

Calls 7

makeClusterConfigMethod · 0.95
NewFunction · 0.92
NewFunction · 0.92
SetPostgresCRDStatusMethod · 0.80
UnlockMethod · 0.80
LockMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected