From 6728c622ac90cce179f05df5ec5be26c6f1f3a55 Mon Sep 17 00:00:00 2001 From: runkecheng <1131648942@qq.com> Date: Sat, 9 Oct 2021 10:11:19 +0800 Subject: [PATCH] *: Support extranet access service. #251 --- cluster/syncer/follower_service.go | 4 +++- cluster/syncer/leader_service.go | 4 +++- cluster/syncer/metrics_service.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cluster/syncer/follower_service.go b/cluster/syncer/follower_service.go index fa77b84f1..93d10984b 100644 --- a/cluster/syncer/follower_service.go +++ b/cluster/syncer/follower_service.go @@ -41,7 +41,9 @@ func NewFollowerSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interfac }, } return syncer.NewObjectSyncer("FollowerSVC", c.Unwrap(), service, cli, func() error { - service.Spec.Type = "ClusterIP" + if service.Spec.Type == "" { + service.Spec.Type = "ClusterIP" + } service.Spec.Selector = c.GetSelectorLabels() service.Spec.Selector["role"] = "follower" service.Spec.Selector["healthy"] = "yes" diff --git a/cluster/syncer/leader_service.go b/cluster/syncer/leader_service.go index 31abb73c3..117006ca6 100644 --- a/cluster/syncer/leader_service.go +++ b/cluster/syncer/leader_service.go @@ -41,7 +41,9 @@ func NewLeaderSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface }, } return syncer.NewObjectSyncer("LeaderSVC", c.Unwrap(), service, cli, func() error { - service.Spec.Type = "ClusterIP" + if service.Spec.Type == "" { + service.Spec.Type = "ClusterIP" + } service.Spec.Selector = c.GetSelectorLabels() service.Spec.Selector["role"] = "leader" diff --git a/cluster/syncer/metrics_service.go b/cluster/syncer/metrics_service.go index 466de1f58..196834072 100644 --- a/cluster/syncer/metrics_service.go +++ b/cluster/syncer/metrics_service.go @@ -41,7 +41,9 @@ func NewMetricsSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface }, } return syncer.NewObjectSyncer("MetricsSVC", c.Unwrap(), service, cli, func() error { - service.Spec.Type = "ClusterIP" + if service.Spec.Type == "" { + service.Spec.Type = "ClusterIP" + } service.Spec.Selector = c.GetSelectorLabels() if len(service.Spec.Ports) != 1 {