sshpiper/plugin/kubernetes/main.go
Josh Bleecher Snyder 297b8c60e7
extract skel into its own package (#596)
This breaks the dependency of libplugin
on x/crypto, enabling people to use libplugin
without having conflicts over the crypto module.
2025-05-23 12:42:44 -07:00

36 lines
995 B
Go

package main
import (
"github.com/tg123/sshpiper/libplugin"
"github.com/tg123/sshpiper/libplugin/skel"
"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 := skel.NewSkelPlugin(plugin.listPipe)
return skel.CreateConfig(), nil
},
})
}