Skip to content

Commit 38afa99

Browse files
committed
cluster: Support extranet access service. #251
1 parent 0cee061 commit 38afa99

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

cluster/syncer/follower_service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ func NewFollowerSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interfac
4141
},
4242
}
4343
return syncer.NewObjectSyncer("FollowerSVC", c.Unwrap(), service, cli, func() error {
44-
service.Spec.Type = "ClusterIP"
44+
// Allows to modify the service access method, the default is ClusterIP.
45+
if service.Spec.Type == "" {
46+
service.Spec.Type = "ClusterIP"
47+
}
4548
service.Spec.Selector = c.GetSelectorLabels()
4649
service.Spec.Selector["role"] = "follower"
4750
service.Spec.Selector["healthy"] = "yes"

cluster/syncer/leader_service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ func NewLeaderSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface
4141
},
4242
}
4343
return syncer.NewObjectSyncer("LeaderSVC", c.Unwrap(), service, cli, func() error {
44-
service.Spec.Type = "ClusterIP"
44+
// Allows to modify the service access method, the default is ClusterIP.
45+
if service.Spec.Type == "" {
46+
service.Spec.Type = "ClusterIP"
47+
}
4548
service.Spec.Selector = c.GetSelectorLabels()
4649
service.Spec.Selector["role"] = "leader"
4750

cluster/syncer/metrics_service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ func NewMetricsSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface
4141
},
4242
}
4343
return syncer.NewObjectSyncer("MetricsSVC", c.Unwrap(), service, cli, func() error {
44-
service.Spec.Type = "ClusterIP"
44+
// Allows to modify the service access method, the default is ClusterIP.
45+
if service.Spec.Type == "" {
46+
service.Spec.Type = "ClusterIP"
47+
}
4548
service.Spec.Selector = c.GetSelectorLabels()
4649

4750
if len(service.Spec.Ports) != 1 {

0 commit comments

Comments
 (0)