Skip to content

Commit

Permalink
cluster: Support extranet access service. radondb#251
Browse files Browse the repository at this point in the history
  • Loading branch information
runkecheng committed Oct 11, 2021
1 parent 0cee061 commit 38afa99
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cluster/syncer/follower_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func NewFollowerSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interfac
},
}
return syncer.NewObjectSyncer("FollowerSVC", c.Unwrap(), service, cli, func() error {
service.Spec.Type = "ClusterIP"
// Allows to modify the service access method, the default is ClusterIP.
if service.Spec.Type == "" {
service.Spec.Type = "ClusterIP"
}
service.Spec.Selector = c.GetSelectorLabels()
service.Spec.Selector["role"] = "follower"
service.Spec.Selector["healthy"] = "yes"
Expand Down
5 changes: 4 additions & 1 deletion cluster/syncer/leader_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func NewLeaderSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface
},
}
return syncer.NewObjectSyncer("LeaderSVC", c.Unwrap(), service, cli, func() error {
service.Spec.Type = "ClusterIP"
// Allows to modify the service access method, the default is ClusterIP.
if service.Spec.Type == "" {
service.Spec.Type = "ClusterIP"
}
service.Spec.Selector = c.GetSelectorLabels()
service.Spec.Selector["role"] = "leader"

Expand Down
5 changes: 4 additions & 1 deletion cluster/syncer/metrics_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func NewMetricsSVCSyncer(cli client.Client, c *cluster.Cluster) syncer.Interface
},
}
return syncer.NewObjectSyncer("MetricsSVC", c.Unwrap(), service, cli, func() error {
service.Spec.Type = "ClusterIP"
// Allows to modify the service access method, the default is ClusterIP.
if service.Spec.Type == "" {
service.Spec.Type = "ClusterIP"
}
service.Spec.Selector = c.GetSelectorLabels()

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

0 comments on commit 38afa99

Please sign in to comment.