-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (31 loc) · 1.16 KB
/
main.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
package main
import (
"github.com/argoproj-labs/rollouts-plugin-metric-honeycomb/internal/plugin"
rolloutsPlugin "github.com/argoproj/argo-rollouts/metricproviders/plugin/rpc"
goPlugin "github.com/hashicorp/go-plugin"
log "github.com/sirupsen/logrus"
)
// handshakeConfigs are used to just do a basic handshake between
// a plugin and host. If the handshake fails, a user friendly error is shown.
// This prevents users from executing bad plugins or executing a plugin
// directory. It is a UX feature, not a security feature.
var handshakeConfig = goPlugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "ARGO_ROLLOUTS_RPC_PLUGIN",
MagicCookieValue: "metricprovider",
}
func main() {
logCtx := *log.WithFields(log.Fields{"plugin": "honeycomb"})
rpcPluginImp := &plugin.HoneycombProvider{
LogCtx: logCtx,
}
// pluginMap is the map of plugins we can dispense.
pluginMap := map[string]goPlugin.Plugin{
"RpcMetricProviderPlugin": &rolloutsPlugin.RpcMetricProviderPlugin{Impl: rpcPluginImp},
}
logCtx.Debug("initializing honeycomb metrics plugin")
goPlugin.Serve(&goPlugin.ServeConfig{
HandshakeConfig: handshakeConfig,
Plugins: pluginMap,
})
}