From 18bb9aad8a2273806f0a34fc2a55ea0b8457c550 Mon Sep 17 00:00:00 2001 From: Karl Quinsland Date: Thu, 3 Jul 2025 11:30:07 -0700 Subject: [PATCH 1/3] Add a basic schema Good for basic validation. More work (and probably some CI automation?) would be needed for correctively validating each of the possible custom checks. --- schemas/kube-lint-config.json | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 schemas/kube-lint-config.json diff --git a/schemas/kube-lint-config.json b/schemas/kube-lint-config.json new file mode 100644 index 000000000..f908de2d5 --- /dev/null +++ b/schemas/kube-lint-config.json @@ -0,0 +1,89 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "KubeLinter Configuration", + "type": "object", + "properties": { + "checks": { + "type": "object", + "description": "Configure which built-in checks to run or skip", + "properties": { + "doNotAutoAddDefaults": { + "type": "boolean", + "description": "Disable all built-in checks" + }, + "addAllBuiltIn": { + "type": "boolean", + "description": "Enable all built-in checks. Takes precedence over doNotAutoAddDefaults" + }, + "ignorePaths": { + "type": "array", + "description": "File or directory globs to skip. Uses https://pkg.go.dev/github.com/bmatcuk/doublestar#Match syntax", + "items": { + "type": "string" + } + }, + "include": { + "type": "array", + "description": "List of specific checks to run. Exclude always takes precedence over include", + "items": { + "type": "string" + } + }, + "exclude": { + "type": "array", + "description": "List of specific checks to skip (takes precedence over include)", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "customChecks": { + "type": "array", + "description": "User-defined checks based on templates", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Unique identifier for this custom check" + }, + "template": { + "type": "string", + "description": "Template name (e.g. required-annotation, required-label)" + }, + "params": { + "type": "object", + "description": "Template-specific parameters", + "additionalProperties": true + }, + "scope": { + "type": "object", + "description": "Limit this check to certain Kubernetes object kinds", + "properties": { + "objectKinds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "E.g. DeploymentLike, Service. Supported values are listed in: https://github.com/stackrox/kube-linter/tree/main/pkg/objectkinds" + } + }, + "additionalProperties": false + }, + "remediation": { + "type": "string", + "description": "Custom message shown when this check fails" + } + }, + "required": [ + "name", + "template" + ], + "additionalProperties": false + } + } + }, + "additionalProperties": false +} From c452431127d59a66e35ac1a6ba518176e47dd12e Mon Sep 17 00:00:00 2001 From: "Karl Q." Date: Fri, 11 Jul 2025 19:38:00 -0700 Subject: [PATCH 2/3] Update schemas/kube-lint-config.json Co-authored-by: Yann Brillouet <91869377+rhybrillou@users.noreply.github.com> --- schemas/kube-lint-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/kube-lint-config.json b/schemas/kube-lint-config.json index f908de2d5..5d7c3d566 100644 --- a/schemas/kube-lint-config.json +++ b/schemas/kube-lint-config.json @@ -13,7 +13,7 @@ }, "addAllBuiltIn": { "type": "boolean", - "description": "Enable all built-in checks. Takes precedence over doNotAutoAddDefaults" + "description": "Enable all built-in checks. Users can explicitly opt-out checks using exclude. Takes precedence over doNotAutoAddDefaults" }, "ignorePaths": { "type": "array", From 3f2e00f89e0ea92700391bcfb64a6e488d357e37 Mon Sep 17 00:00:00 2001 From: "Karl Q." Date: Mon, 14 Jul 2025 18:52:23 -0700 Subject: [PATCH 3/3] Update kube-lint-config.json Add `customChecks.description` --- schemas/kube-lint-config.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schemas/kube-lint-config.json b/schemas/kube-lint-config.json index 5d7c3d566..cb9c25b96 100644 --- a/schemas/kube-lint-config.json +++ b/schemas/kube-lint-config.json @@ -49,6 +49,10 @@ "type": "string", "description": "Unique identifier for this custom check" }, + "description": { + "type": "string", + "description": "Brief explanation of what the custom check does.", + }, "template": { "type": "string", "description": "Template name (e.g. required-annotation, required-label)"