From 61e708277df13d5b8707d602119b99c9b594d34f Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 24 Jan 2021 01:17:35 +0100 Subject: [PATCH] Use a custom, more up-to-date fork of kubernetes-json-schema by default --- Readme.md | 4 ++-- pkg/validator/validator.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index 5d46663..ebc1e3e 100644 --- a/Readme.md +++ b/Readme.md @@ -28,8 +28,8 @@ and break it down into multiple JSON schemas, stored in github at [instrumenta/kubernetes-json-schema](https://github.com/instrumenta/kubernetes-json-schema) and published on [kubernetesjsonschema.dev](https://kubernetesjsonschema.dev/). -Kubeconform relies on the same JSON schemas from kubernetesjsonschema.dev, and will download required -schemas at runtime as required. +Kubeconform relies on [a fork of kubernetes-json-schema](https://github.com/yannh/kubernetes-json-schema/) +that is more aggressively kept up-to-date, and contains schemas for all recent versions of Kubernetes. ### Limits of Kubeconform validation diff --git a/pkg/validator/validator.go b/pkg/validator/validator.go index d8d96c4..cf5c99d 100644 --- a/pkg/validator/validator.go +++ b/pkg/validator/validator.go @@ -53,9 +53,10 @@ type Opts struct { // New returns a new Validator func New(schemaLocations []string, opts Opts) (Validator, error) { - // Default to kubernetesjsonschema.dev + // Default to our kubernetes-json-schema fork + // raw.githubusercontent.com is frontend by Fastly and very fast if schemaLocations == nil || len(schemaLocations) == 0 { - schemaLocations = []string{"https://kubernetesjsonschema.dev"} + schemaLocations = []string{"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json"} } registries := []registry.Registry{}