1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/plugins/selector/static
Jerry c13bb07171
1.fix plugins go get bug. (#2187)
2.update all mode.
3.add tidy tools
2021-06-30 07:21:03 +01:00
..
go.mod 1.fix plugins go get bug. (#2187) 2021-06-30 07:21:03 +01:00
go.sum 1.fix plugins go get bug. (#2187) 2021-06-30 07:21:03 +01:00
README.md add all the plugins 2020-12-26 15:32:45 +00:00
static_test.go add all the plugins 2020-12-26 15:32:45 +00:00
static.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00

Static selector

The Static selector returns the named service as a node for every request. This is useful where you want to offload discovery and balancing to DNS (particularly useful with KubeDNS).

This DOES however require a static port assignment (because we no longer have the ability to look up metadata). This defaults to port 8080, but can be overriddden at runtime using env-vars.

An optional domain-name can be appended too.

Environment variables

  • "STATIC_SELECTOR_DOMAIN_NAME": An optional domain-name to append to the speicified service name.
  • "STATIC_SELECTOR_PORT_NUMBER": Override the default port (8080) for "discovered" services.

Usage

selector := static.NewSelector()

service := micro.NewService(
	client.NewClient(client.Selector(selector))
)