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 9, 2021
1 parent 0cee061 commit 030ce1f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cluster/syncer/follower_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion cluster/syncer/leader_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 3 additions & 1 deletion cluster/syncer/metrics_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 030ce1f

Please sign in to comment.