-
Notifications
You must be signed in to change notification settings - Fork 25
/
agent.go
65 lines (59 loc) · 1.87 KB
/
agent.go
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
54
55
56
57
58
59
60
61
62
63
64
65
//go:generate swagger generate spec --scan-models --include="github.com/fluxninja*" --include-tag=common-configuration -o ../../docs/gen/config/agent/config-swagger.yaml
// Package main Agent
//
// Aperture Agent
//
// BasePath: /aperture-agent
//
// swagger:meta
package main
import (
"github.com/jonboulle/clockwork"
"go.uber.org/fx"
"github.com/fluxninja/aperture/cmd/aperture-agent/agent"
"github.com/fluxninja/aperture/pkg/agentinfo"
"github.com/fluxninja/aperture/pkg/discovery"
"github.com/fluxninja/aperture/pkg/distcache"
"github.com/fluxninja/aperture/pkg/entitycache"
"github.com/fluxninja/aperture/pkg/flowcontrol"
"github.com/fluxninja/aperture/pkg/k8s"
"github.com/fluxninja/aperture/pkg/log"
"github.com/fluxninja/aperture/pkg/net/grpc"
"github.com/fluxninja/aperture/pkg/notifiers"
"github.com/fluxninja/aperture/pkg/otelcollector"
"github.com/fluxninja/aperture/pkg/peers"
"github.com/fluxninja/aperture/pkg/platform"
"github.com/fluxninja/aperture/pkg/policies/dataplane"
"github.com/fluxninja/aperture/pkg/prometheus"
)
func main() {
app := platform.New(
platform.Config{}.Module(),
notifiers.TrackersConstructor{Name: "entity_trackers"}.Annotate(),
prometheus.Module(),
k8s.Module(),
peers.Constructor{}.Module(),
fx.Provide(
agentinfo.ProvideAgentInfo,
clockwork.NewRealClock,
agent.ProvidePeersPrefix,
),
fx.Invoke(
agent.AddAgentInfoAttribute,
),
entitycache.Module(),
flowcontrol.Module,
distcache.Module(),
dataplane.PolicyModule(),
otelcollector.Module(),
agent.ModuleForAgentOTEL(),
discovery.Module(),
grpc.ClientConstructor{Name: "flowcontrol-grpc-client", ConfigKey: "flowcontrol.client.grpc"}.Annotate(),
)
if err := app.Err(); err != nil {
visualize, _ := fx.VisualizeError(err)
log.Panic().Err(err).Msg("fx.New failed: " + visualize)
}
log.Info().Msg("aperture-agent app created")
platform.Run(app)
}