adding slog debug to a few points

Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
pull/30760/head
Robert Sirchia 5 months ago
parent e0fde2bd90
commit 9b9ff12c6d
No known key found for this signature in database
GPG Key ID: C2D40F4D8196E874

@ -19,6 +19,7 @@ package util
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"log/slog"
"strings" "strings"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -31,13 +32,14 @@ import (
func ValidateAgainstSchema(chrt *chart.Chart, values map[string]interface{}) error { func ValidateAgainstSchema(chrt *chart.Chart, values map[string]interface{}) error {
var sb strings.Builder var sb strings.Builder
if chrt.Schema != nil { if chrt.Schema != nil {
slog.Debug("chart name", "chart-name", chrt.Name)
err := ValidateAgainstSingleSchema(values, chrt.Schema) err := ValidateAgainstSingleSchema(values, chrt.Schema)
if err != nil { if err != nil {
sb.WriteString(fmt.Sprintf("%s:\n", chrt.Name())) sb.WriteString(fmt.Sprintf("%s:\n", chrt.Name()))
sb.WriteString(err.Error()) sb.WriteString(err.Error())
} }
} }
slog.Debug("number of dependencies in the chart", "dependencies", len(chrt.Dependencies()))
// For each dependency, recursively call this function with the coalesced values // For each dependency, recursively call this function with the coalesced values
for _, subchart := range chrt.Dependencies() { for _, subchart := range chrt.Dependencies() {
subchartValues := values[subchart.Name()].(map[string]interface{}) subchartValues := values[subchart.Name()].(map[string]interface{})
@ -67,6 +69,7 @@ func ValidateAgainstSingleSchema(values Values, schemaJSON []byte) (reterr error
if err != nil { if err != nil {
return err return err
} }
slog.Debug("unmarshalled JSON schema", "schema", schema)
compiler := jsonschema.NewCompiler() compiler := jsonschema.NewCompiler()
err = compiler.AddResource("file:///values.schema.json", schema) err = compiler.AddResource("file:///values.schema.json", schema)
@ -78,6 +81,7 @@ func ValidateAgainstSingleSchema(values Values, schemaJSON []byte) (reterr error
if err != nil { if err != nil {
return err return err
} }
slog.Debug("validated JSON schema", "validator", validator)
err = validator.Validate(values.AsMap()) err = validator.Validate(values.AsMap())
if err != nil { if err != nil {

Loading…
Cancel
Save