forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (29 loc) · 939 Bytes
/
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
package injector
import (
"context"
"flag"
"fmt"
"github.com/linkerd/linkerd2/controller/k8s"
"github.com/linkerd/linkerd2/controller/webhook"
"github.com/linkerd/linkerd2/pkg/flags"
)
// Main executes the tap-injector subcommand
func Main(args []string) {
cmd := flag.NewFlagSet("tap-injector", flag.ExitOnError)
metricsAddr := cmd.String("metrics-addr", fmt.Sprintf(":%d", 9995), "address to serve scrapable metrics on")
addr := cmd.String("addr", ":8443", "address to serve on")
kubeconfig := cmd.String("kubeconfig", "", "path to kubeconfig")
tapSvcName := cmd.String("tap-service-name", "", "name of the tap service")
enablePprof := cmd.Bool("enable-pprof", false, "Enable pprof endpoints on the admin server")
flags.ConfigureAndParse(cmd, args)
webhook.Launch(
context.Background(),
[]k8s.APIResource{k8s.NS},
Mutate(*tapSvcName),
"tap-injector",
*metricsAddr,
*addr,
*kubeconfig,
*enablePprof,
)
}