-
Notifications
You must be signed in to change notification settings - Fork 683
/
main.go
46 lines (37 loc) · 1.46 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
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/datawire/ambassador/pkg/teleproxy"
)
// Version is inserted at build using --ldflags -X
var Version = "(unknown version)"
func main() {
tele := &teleproxy.Teleproxy{}
var tp = &cobra.Command{
Use: "teleproxy",
Short: "teleproxy",
Long: "teleproxy - connect locally running code to a remote kubernetes cluster",
SilenceErrors: true,
SilenceUsage: true,
}
tp.Flags().BoolVar(&tele.Version, "version", false, "alias for '-mode=version'")
tp.Flags().StringVar(&tele.Mode, "mode", "", "mode of operation ('intercept', 'bridge', or 'version')")
tp.Flags().StringVar(&tele.Kubeconfig, "kubeconfig", "", "absolute path to the kubeconfig file")
tp.Flags().StringVar(&tele.Context, "context", "", "context to use (default: the current context)")
tp.Flags().StringVar(&tele.Namespace, "namespace", "",
"namespace to use (default: the current namespace for the context")
tp.Flags().StringVar(&tele.DNSIP, "dns", "", "dns ip address")
tp.Flags().StringVar(&tele.FallbackIP, "fallback", "", "dns fallback")
tp.Flags().BoolVar(&tele.NoSearch, "no-search-override", false, "disable dns search override")
tp.Flags().BoolVar(&tele.NoCheck, "no-check", false, "disable self check")
tp.RunE = func(cmd *cobra.Command, _ []string) error {
return teleproxy.RunTeleproxy(tele, Version)
}
err := tp.Execute()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}