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

adding nocache flag for dev commands #278

Merged
merged 2 commits into from
Oct 9, 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: 3 additions & 1 deletion cmd/kubehound/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
var (
uiTesting bool
grpcTesting bool
noCache bool
downTesting bool
profiles []string
)
Expand Down Expand Up @@ -71,14 +72,15 @@ func runEnv(ctx context.Context, composePaths []string) error {
return docker.Down(ctx)
}

return docker.BuildUp(ctx)
return docker.BuildUp(ctx, noCache)
}

func init() {
envCmd.AddCommand(envTestingCmd)
envCmd.PersistentFlags().BoolVar(&downTesting, "down", false, "Tearing down the kubehound dev stack and deleting the data associated with it")
envCmd.Flags().BoolVar(&uiTesting, "ui", false, "Include the UI in the dev stack")
envCmd.Flags().BoolVar(&grpcTesting, "grpc", false, "Include Grpc Server (ingestor) in the dev stack")
envCmd.Flags().BoolVar(&noCache, "no-cache", false, "Disable the cache when building the images")

rootCmd.AddCommand(envCmd)
}
2 changes: 1 addition & 1 deletion cmd/kubehound/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
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)
return cmd.InitializeKubehoundConfig(cobraCmd.Context(), cfgFile, false, false)
},
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Passing the Kubehound config from viper
Expand Down
2 changes: 1 addition & 1 deletion deployments/kubehound/docker-compose.dev.ui.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: kubehound-dev
services:
ui-jupyter:
build: ./notebook/
build: ./ui/
restart: unless-stopped
volumes:
- ./notebook/shared:/root/notebooks/shared
8 changes: 4 additions & 4 deletions pkg/backend/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ func newDockerCli() (*command.DockerCli, error) {
return dockerCli, nil
}

func BuildUp(ctx context.Context) error {
return currentBackend.buildUp(ctx)
func BuildUp(ctx context.Context, noCache bool) error {
return currentBackend.buildUp(ctx, noCache)
}

func (b *Backend) buildUp(ctx context.Context) error {
func (b *Backend) buildUp(ctx context.Context, noCache bool) error {
log.I.Infof("Building the kubehound stack")
err := b.composeService.Build(ctx, b.project, api.BuildOptions{
NoCache: true,
NoCache: noCache,
Pull: true,
})
if err != nil {
Expand Down
Loading