File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
1616 "sigs.k8s.io/kustomize/kyaml/kio"
1717 "sigs.k8s.io/kustomize/kyaml/resid"
1818 "sigs.k8s.io/kustomize/kyaml/yaml"
19+ yamltojson "sigs.k8s.io/yaml"
1920)
2021
2122//
@@ -96,9 +97,11 @@ func (kcv *KubeconformValidator) Filter(rlItems []*yaml.RNode) ([]*yaml.RNode, e
9697 kc .loadResourceListItems (rlItems )
9798 cfg , out := kc .configure (& kcv .Spec )
9899
99- // Run Kubeconform validate.
100+ // Run Kubeconform validate
101+ // and convert kc.IO stream to YAML.
100102 if err := kubeconform .Validate (cfg , out ); err != nil {
101- return nil , errors .Wrap (errors .Errorf ("Kubeconform validation output: %s" , kc .IO ))
103+ outYAML , _ := yamltojson .JSONToYAML (kc .IO .(* bytes.Buffer ).Bytes ())
104+ return nil , errors .WrapPrefixf (err , "Kubeconform validation failed: %s" , string (outYAML ))
102105 }
103106
104107 return rlItems , nil
You can’t perform that action at this time.
0 commit comments