Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge binaries into one #199

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading