Skip to content

Commit

Permalink
adding nocache flag for dev commands (#278)
Browse files Browse the repository at this point in the history
* adding nocache flag for dev commands

* typo build path
  • Loading branch information
jt-dd authored Oct 9, 2024
1 parent f802174 commit 5f215eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
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

0 comments on commit 5f215eb

Please sign in to comment.