()
| 25 | ) |
| 26 | |
| 27 | func (c *Component) initCluster() (err error) { |
| 28 | clusterOpts := []cluster.Option{ |
| 29 | cluster.WithConn(c.LoopbackConn()), |
| 30 | cluster.WithDialOptions(rpcclient.DefaultDialOptions), |
| 31 | } |
| 32 | for _, svc := range c.grpcSubsystems { |
| 33 | clusterOpts = append(clusterOpts, cluster.WithServices(svc)) |
| 34 | } |
| 35 | if tlsConfig, err := c.GetTLSClientConfig(c.Context()); err == nil { |
| 36 | clusterOpts = append(clusterOpts, cluster.WithTLSConfig(tlsConfig)) |
| 37 | } |
| 38 | ctx := log.NewContextWithField(c.ctx, "namespace", "cluster") |
| 39 | c.cluster, err = c.clusterNew(ctx, &c.config.ServiceBase.Cluster, clusterOpts...) |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | return nil |
| 44 | } |
| 45 | |
| 46 | // ClusterTLS returns whether the cluster uses TLS for cluster connections. |
| 47 | func (c *Component) ClusterTLS() bool { |
no test coverage detected