在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sercand/kuberesolver开源软件地址(OpenSource Url):https://github.com/sercand/kuberesolver开源编程语言(OpenSource Language):Go 100.0%开源软件介绍(OpenSource Introduction):kuberesolverA Grpc name resolver by using kubernetes API. It comes with a small ~250 LOC kubernetes client to find service endpoints. Therefore it won't bloat your binaries. USAGE// Import the module
import "github.com/sercand/kuberesolver/v3"
// Register kuberesolver to grpc before calling grpc.Dial
kuberesolver.RegisterInCluster()
// it is same as
resolver.Register(kuberesolver.NewBuilder(nil /*custom kubernetes client*/ , "kubernetes"))
// if schema is 'kubernetes' then grpc will use kuberesolver to resolve addresses
cc, err := grpc.Dial("kubernetes:///service.namespace:portname", opts...) An url can be one of the following, grpc naming docs
Using alternative SchemaUse Client Side Load BalancingYou need to pass grpc.WithBalancerName option to grpc on dial: grpc.DialContext(ctx, "kubernetes:///service:grpc", grpc.WithBalancerName("round_robin"), grpc.WithInsecure()) This will create subconnections for each available service endpoints.
How is this different from dialing to |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论