Skip to content

Commit

Permalink
merge binaries into one (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
jt-dd committed Jun 6, 2024
1 parent 7685753 commit b1395af
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ generate: ## Generate code for the application
build: ## Build the application
cd cmd && go build $(BUILD_FLAGS) -o ../bin/kubehound kubehound/*.go

.PHONY: build-ingestor
build-ingestor: ## Build the ingestor API CLI
cd cmd && go build $(BUILD_FLAGS) -o ../bin/kubehound-ingestor kubehound-ingestor/*.go

.PHONY: kubehound
kubehound: | backend-up build ## Prepare kubehound (deploy backend, build go binary)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kubehound/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ var (
func init() {
cmd.InitGrpcClientCmd(grpcClientIngestCmd, true)

rootCmd.AddCommand(grpcClientIngestCmd)
ingestorCmd.AddCommand(grpcClientIngestCmd)
}
38 changes: 38 additions & 0 deletions cmd/kubehound/ingestor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"fmt"

"github.com/DataDog/KubeHound/pkg/cmd"
"github.com/DataDog/KubeHound/pkg/kubehound/core"
"github.com/spf13/cobra"
)

var (
ingestorCmd = &cobra.Command{
Use: "ingest",
Short: "Kubehound Ingestor Service - exposes a gRPC API to ingest data from cloud storage",
Long: `instance of Kubehound that pulls data from cloud storage`,
SilenceUsage: true,
PersistentPreRunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.InitializeKubehoundConfig(cobraCmd.Context(), cfgFile, true, false)
},
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Passing the Kubehound config from viper
khCfg, err := cmd.GetConfig()
if err != nil {
return fmt.Errorf("get config: %w", err)
}

return core.CoreGrpcApi(cobraCmd.Context(), khCfg)
},
PersistentPostRunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.CloseKubehoundConfig()
},
}
)

func init() {
cmd.InitRootCmd(ingestorCmd)
rootCmd.AddCommand(ingestorCmd)
}
2 changes: 1 addition & 1 deletion cmd/kubehound/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (

var (
rootCmd = &cobra.Command{
Use: "kubehound-local",
Use: "kubehound",
Short: "A local Kubehound instance",
Long: `A local instance of Kubehound - a Kubernetes attack path generator`,
PreRunE: func(cobraCmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit b1395af

Please sign in to comment.