Skip to content

Commit

Permalink
Add hive command
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Maki <[email protected]>
  • Loading branch information
joamaki committed Mar 18, 2024
1 parent e2a91aa commit 504d61e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion demo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/cilium/statedb"
"github.com/cilium/statedb/reconciler"
"github.com/cilium/statedb/reflector"
"github.com/spf13/cobra"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -56,8 +57,23 @@ var Hive = hive.New(
),
)

var cmd = &cobra.Command{
Use: "example",
RunE: func(_ *cobra.Command, args []string) error {
return Hive.Run()
},
}

func main() {
Hive.Run()
// Register all configuration flags in the hive to the command
Hive.RegisterFlags(cmd.Flags())

// Add the "hive" sub-command for inspecting the hive
cmd.AddCommand(Hive.Command())

// And finally execute the command to parse the command-line flags and
// run the hive
cmd.Execute()
}

func podReflectorConfig(client *kubernetes.Clientset, pods statedb.RWTable[*Pod]) reflector.KubernetesConfig[*Pod] {
Expand Down

0 comments on commit 504d61e

Please sign in to comment.