(namespace, clusterName string)
| 182 | } |
| 183 | |
| 184 | func (c *Controller) addCluster(namespace, clusterName string) { |
| 185 | key := c.buildClusterKey(namespace, clusterName) |
| 186 | if cluster, err := c.getCluster(namespace, clusterName); err == nil && cluster != nil { |
| 187 | return |
| 188 | } |
| 189 | |
| 190 | cluster := NewClusterChecker(c.clusterStore, namespace, clusterName). |
| 191 | WithPingInterval(time.Duration(c.config.FailOver.PingIntervalSeconds) * time.Second). |
| 192 | WithMaxFailureCount(c.config.FailOver.MaxPingCount) |
| 193 | cluster.Start() |
| 194 | |
| 195 | c.mu.Lock() |
| 196 | c.clusters[key] = cluster |
| 197 | c.mu.Unlock() |
| 198 | } |
| 199 | |
| 200 | func (c *Controller) getCluster(namespace, clusterName string) (*ClusterChecker, error) { |
| 201 | key := c.buildClusterKey(namespace, clusterName) |
no test coverage detected