forked from wongnai/xds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwire.go
More file actions
53 lines (44 loc) · 1.17 KB
/
wire.go
File metadata and controls
53 lines (44 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//go:build wireinject
package di
import (
"context"
"github.com/google/wire"
"github.com/wongnai/xds/debug"
"github.com/wongnai/xds/snapshot"
"google.golang.org/grpc"
"k8s.io/client-go/kubernetes"
)
type Servers struct {
DevServer
_GrpcHealth SideEffectGrpcHealthRegistered
_Reflection SideEffectGrpcReflectionRegistered
_Channelz SideEffectGrpcChannelzRegistered
DebugServer *debug.Server
}
type DevServer struct {
_Xds XdsAllSideEffects
GrpcServer *grpc.Server
}
func InitializeServer(ctx context.Context, statsIntervalSeconds StatsIntervalSeconds, subZoneLabel snapshot.SubZoneLabel) (Servers, func(), error) {
wire.Build(
KubernetesSet,
GrpcSet,
K8sXdsSet,
XdsSet,
ProvideOtelGrpcServerOptions,
wire.Struct(new(DevServer), "*"),
wire.Struct(new(Servers), "*"),
)
return Servers{}, nil, nil
}
func InitializeTestServer(ctx context.Context, kubeClient kubernetes.Interface, statsIntervalSeconds StatsIntervalSeconds, subZoneLabel snapshot.SubZoneLabel) (TestServer, func(), error) {
wire.Build(
GrpcSet,
K8sXdsSet,
XdsSet,
TestSet,
wire.Struct(new(DevServer), "*"),
wire.Struct(new(TestServer), "*"),
)
return TestServer{}, nil, nil
}