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 {