k3s/vendor/github.com/k3s-io/kine/pkg/server/server.go

34 lines
830 B
Go
Raw Normal View History

2019-08-22 05:12:46 +00:00
package server
import (
"go.etcd.io/etcd/api/v3/etcdserverpb"
2019-08-22 05:12:46 +00:00
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
)
type KVServerBridge struct {
limited *LimitedServer
}
func New(backend Backend, scheme string) *KVServerBridge {
2019-08-22 05:12:46 +00:00
return &KVServerBridge{
limited: &LimitedServer{
backend: backend,
scheme: scheme,
2019-08-22 05:12:46 +00:00
},
}
}
func (k *KVServerBridge) Register(server *grpc.Server) {
etcdserverpb.RegisterLeaseServer(server, k)
etcdserverpb.RegisterWatchServer(server, k)
etcdserverpb.RegisterKVServer(server, k)
etcdserverpb.RegisterClusterServer(server, k)
etcdserverpb.RegisterMaintenanceServer(server, k)
2019-08-22 05:12:46 +00:00
hsrv := health.NewServer()
hsrv.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
healthpb.RegisterHealthServer(server, hsrv)
}