From efec4227e1bdd43201542b6f510dbb380f6e1591 Mon Sep 17 00:00:00 2001 From: Joe Lombrozo Date: Tue, 22 Oct 2024 12:04:58 -0400 Subject: [PATCH] add some debug information for help figure out what's going on --- cmd/controller_cmd.go | 3 +++ cmd/locations.go | 1 + pkg/checks/kubeconform/validate.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/cmd/controller_cmd.go b/cmd/controller_cmd.go index 5b8b0440..4221a6e5 100644 --- a/cmd/controller_cmd.go +++ b/cmd/controller_cmd.go @@ -51,9 +51,12 @@ var ControllerCmd = &cobra.Command{ log.Fatal().Err(err).Msg("failed to initialize git settings") } + log.Info().Strs("locations", cfg.PoliciesLocation).Msg("processing policies locations") if err = processLocations(ctx, ctr, cfg.PoliciesLocation); err != nil { log.Fatal().Err(err).Msg("failed to process policy locations") } + + log.Info().Strs("locations", cfg.SchemasLocations).Msg("processing schemas locations") if err = processLocations(ctx, ctr, cfg.SchemasLocations); err != nil { log.Fatal().Err(err).Msg("failed to process schema locations") } diff --git a/cmd/locations.go b/cmd/locations.go index 47b5774d..ebf1339c 100644 --- a/cmd/locations.go +++ b/cmd/locations.go @@ -24,6 +24,7 @@ func processLocations(ctx context.Context, ctr container.Container, locations [] locations[index] = newLocation } } + log.Debug().Strs("locations", locations).Msg("locations after processing") return nil } diff --git a/pkg/checks/kubeconform/validate.go b/pkg/checks/kubeconform/validate.go index 010959c1..efba18e2 100644 --- a/pkg/checks/kubeconform/validate.go +++ b/pkg/checks/kubeconform/validate.go @@ -32,7 +32,9 @@ func getSchemaLocations(ctr container.Container) []string { for index := range locations { location := locations[index] + oldLocation := location if location == "default" || strings.Contains(location, "{{") { + log.Debug().Str("location", location).Msg("location requires no processing to be valid") continue } @@ -42,6 +44,8 @@ func getSchemaLocations(ctr container.Container) []string { location += "{{ .NormalizedKubernetesVersion }}/{{ .ResourceKind }}{{ .KindSuffix }}.json" locations[index] = location + + log.Debug().Str("old", oldLocation).Str("new", location).Msg("processed schema location") } return locations