github.com/k8snetworkplumbingwg/sriov-network-operator@v1.2.1-0.20240408194816-2d2e5a45d453/cmd/webhook/main.go (about) 1 package main 2 3 import ( 4 "flag" 5 "os" 6 7 "github.com/spf13/cobra" 8 "sigs.k8s.io/controller-runtime/pkg/log" 9 10 snolog "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/log" 11 ) 12 13 const ( 14 componentName = "sriov-network-operator-webhook" 15 ) 16 17 var ( 18 rootCmd = &cobra.Command{ 19 Use: componentName, 20 Short: "Run SR-IoV Operator Webhook Daemon", 21 Long: "Run Webhook Daemon which validates/mutates the Custom Resource of the SR-IoV Network Operator", 22 } 23 ) 24 25 func init() { 26 snolog.BindFlags(flag.CommandLine) 27 rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) 28 } 29 30 func main() { 31 if err := rootCmd.Execute(); err != nil { 32 log.Log.Error(err, "Error executing sriov-network-operator-webhook") 33 os.Exit(1) 34 } 35 }