Skip to content

Commit aeaecf0

Browse files
committed
add exporter port for service
1 parent a01fa97 commit aeaecf0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/resources/services/service.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ func NewHeadLessSvcForCR(cluster *redisv1alpha1.DistributedRedisCluster, name st
2929
}
3030

3131
func NewSvcForCR(cluster *redisv1alpha1.DistributedRedisCluster, name string, labels map[string]string) *corev1.Service {
32+
var ports []corev1.ServicePort
3233
clientPort := corev1.ServicePort{Name: "client", Port: 6379}
3334
gossipPort := corev1.ServicePort{Name: "gossip", Port: 16379}
35+
if cluster.Spec.Monitor == nil {
36+
ports = append(ports, clientPort, gossipPort)
37+
} else {
38+
ports = append(ports, clientPort, gossipPort,
39+
corev1.ServicePort{Name: "prom-http", Port: cluster.Spec.Monitor.Prometheus.Port})
40+
}
41+
3442
svc := &corev1.Service{
3543
ObjectMeta: metav1.ObjectMeta{
3644
Labels: labels,

0 commit comments

Comments
 (0)