From 1a48e38edeb02f1d180b18820ac9d8b235e81926 Mon Sep 17 00:00:00 2001 From: Thomas McGinniss Date: Thu, 29 Jun 2023 16:18:06 -0600 Subject: [PATCH] Support providing custom Registries --- pkg/validator/validator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/validator/validator.go b/pkg/validator/validator.go index f4827c8..86ea437 100644 --- a/pkg/validator/validator.go +++ b/pkg/validator/validator.go @@ -61,6 +61,7 @@ type Opts struct { KubernetesVersion string // Kubernetes Version - has to match one in https://github.com/instrumenta/kubernetes-json-schema Strict bool // thros an error if resources contain undocumented fields IgnoreMissingSchemas bool // skip a resource if no schema for that resource can be found + Registries []registry.Registry // Custom Registries to include for accessing schemas. } // New returns a new Validator @@ -71,7 +72,7 @@ func New(schemaLocations []string, opts Opts) (Validator, error) { schemaLocations = []string{"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json"} } - registries := []registry.Registry{} + registries := opts.Registries for _, schemaLocation := range schemaLocations { reg, err := registry.New(schemaLocation, opts.Cache, opts.Strict, opts.SkipTLS, opts.Debug) if err != nil {