forked from tg123/sshpiper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (33 loc) · 956 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
33
34
35
package main
import (
"github.com/tg123/sshpiper/libplugin"
"github.com/urfave/cli/v2"
)
func main() {
libplugin.CreateAndRunPluginTemplate(&libplugin.PluginTemplate{
Name: "kubernetes",
Usage: "sshpiperd kubernetes plugin",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "all-namespaces",
Usage: "To watch all namespaces in the cluster",
EnvVars: []string{"SSHPIPERD_KUBERNETES_ALL_NAMESPACES"},
Required: false,
},
&cli.StringFlag{
Name: "kubeconfig",
Usage: "Path to kubeconfig file",
EnvVars: []string{"SSHPIPERD_KUBERNETES_KUBECONFIG", "KUBECONFIG"},
Required: false,
},
},
CreateConfig: func(c *cli.Context) (*libplugin.SshPiperPluginConfig, error) {
plugin, err := newKubernetesPlugin(c.Bool("all-namespaces"), c.String("kubeconfig"))
if err != nil {
return nil, err
}
skel := libplugin.NewSkelPlugin(plugin.listPipe)
return skel.CreateConfig(), nil
},
})
}