Skip to content

Commit

Permalink
add some debug information for help figure out what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus committed Oct 22, 2024
1 parent 1c98c73 commit efec422
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/controller_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/checks/kubeconform/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
Expand Down

0 comments on commit efec422

Please sign in to comment.