feat: support build tag to reduce binary size w/o k8s (#4323)

This commit is contained in:
Kevin Wan 2024-08-20 19:53:20 +08:00 committed by GitHub
parent e220d3a4cb
commit 9d9c7e0fe0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,5 @@
//go:build !no_k8s
package internal
import (

View File

@ -0,0 +1,8 @@
//go:build no_k8s
package internal
// RegisterResolver registers the direct, etcd and discov schemes to the resolver.
func RegisterResolver() {
register()
}

View File

@ -0,0 +1,13 @@
//go:build !no_k8s
package internal
import "google.golang.org/grpc/resolver"
var k8sResolverBuilder kubeBuilder
// RegisterResolver registers the direct, etcd, discov and k8s schemes to the resolver.
func RegisterResolver() {
register()
resolver.Register(&k8sResolverBuilder)
}

View File

@ -28,15 +28,12 @@ var (
directResolverBuilder directBuilder
discovResolverBuilder discovBuilder
etcdResolverBuilder etcdBuilder
k8sResolverBuilder kubeBuilder
)
// RegisterResolver registers the direct and discov schemes to the resolver.
func RegisterResolver() {
func register() {
resolver.Register(&directResolverBuilder)
resolver.Register(&discovResolverBuilder)
resolver.Register(&etcdResolverBuilder)
resolver.Register(&k8sResolverBuilder)
}
type nopResolver struct {