From a7a6d6da7cf71eefc2a6a82aec527be0c710467e Mon Sep 17 00:00:00 2001 From: jklein Date: Sun, 23 Aug 2026 19:34:41 +0200 Subject: [PATCH] Add strict values.schema.json and the ingress gate to patchmon Two changes of the same class - values that do not do what they promise: 1. values.schema.json (#68): additionalProperties: false on every chart-owned object level, so a key the chart does not read is rejected at render time instead of being silently ignored. Objects passed verbatim into the pod spec (probes, securityContext, global) stay open. 2. Ingress gate (#93): the Ingress template is wrapped in {{- if .Values.ingress.enabled }} and the key is added to values.yaml with default true, so behaviour is unchanged. Without the gate the value did not exist at all and could not switch the Ingress off. Major bump: a schema can break existing deployments that carry dead keys. --- patchmon/Chart.yaml | 2 +- patchmon/templates/patchmon.ingress.yaml | 2 + patchmon/values.schema.json | 226 +++++++++++++++++++++++ patchmon/values.yaml | 4 + 4 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 patchmon/values.schema.json diff --git a/patchmon/Chart.yaml b/patchmon/Chart.yaml index 8c77df2..7696585 100644 --- a/patchmon/Chart.yaml +++ b/patchmon/Chart.yaml @@ -5,7 +5,7 @@ icon: https://raw.githubusercontent.com/PatchMon/PatchMon/main/frontend/public/a type: application -version: 5.2.0+up2.1.3 +version: 6.0.0+up2.1.3 appVersion: "2.1.3" maintainers: diff --git a/patchmon/templates/patchmon.ingress.yaml b/patchmon/templates/patchmon.ingress.yaml index a7de9c6..fc33cb7 100644 --- a/patchmon/templates/patchmon.ingress.yaml +++ b/patchmon/templates/patchmon.ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -26,3 +27,4 @@ spec: - hosts: - {{ required "A Domain/Host must be provided" .Values.ingress.domain }} secretName: tls-{{ .Release.Name }}-{{ .Chart.Name }}-ingress +{{- end }} diff --git a/patchmon/values.schema.json b/patchmon/values.schema.json new file mode 100644 index 0000000..f7bac62 --- /dev/null +++ b/patchmon/values.schema.json @@ -0,0 +1,226 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "patchmon values", + "description": "Strict values schema (issue #68). additionalProperties is false on every chart-owned object level, so a key that the chart does not read is rejected at render time instead of being silently ignored. The only objects that stay open are the ones passed verbatim into the Kubernetes pod spec (probes, security contexts, global) - the chart does not interpret their contents, so it cannot judge which keys are meaningful.", + "type": "object", + "additionalProperties": false, + "properties": { + "global": { + "description": "Helm's conventional cross-chart values. Unused by this chart, kept open so an umbrella install cannot break on it.", + "type": "object" + }, + "scaleDown": { + "type": "boolean" + }, + "patchmon": { + "type": "object", + "additionalProperties": false, + "properties": { + "server": { + "type": "object", + "additionalProperties": false, + "properties": { + "replicas": { + "description": "The server registers itself under a stable identity (the pinned pod hostname); more than one replica is not supported by this chart.", + "type": "integer", + "minimum": 0 + }, + "securityContext": { + "$ref": "#/definitions/securityContext" + }, + "livenessProbe": { + "$ref": "#/definitions/probe" + }, + "readinessProbe": { + "$ref": "#/definitions/probe" + }, + "startupProbe": { + "$ref": "#/definitions/probe" + }, + "env": { + "$ref": "#/definitions/env" + }, + "resources": { + "$ref": "#/definitions/resources" + } + } + }, + "guacd": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "image": { + "description": "guacd is an independent upstream application, so its image is pinned here instead of following the chart's appVersion.", + "type": "string" + }, + "securityContext": { + "description": "guacd is a sidecar in the server pod, so only a container context applies - the pod context is the server's.", + "type": "object", + "additionalProperties": false, + "properties": { + "container": { + "description": "Rendered verbatim as the container's securityContext; kept open because the chart does not interpret it.", + "type": "object" + } + } + }, + "livenessProbe": { + "$ref": "#/definitions/probe" + }, + "readinessProbe": { + "$ref": "#/definitions/probe" + }, + "startupProbe": { + "$ref": "#/definitions/probe" + }, + "env": { + "$ref": "#/definitions/env" + }, + "resources": { + "$ref": "#/definitions/resources" + } + } + } + } + }, + "ingress": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "description": "Gates the whole Ingress template (issue #93). false omits the Ingress, and the required domain/clusterIssuer values are then not needed either.", + "type": "boolean" + }, + "clusterIssuer": { + "type": ["string", "null"] + }, + "domain": { + "type": ["string", "null"] + }, + "className": { + "type": ["string", "null"] + }, + "annotations": { + "description": "Extra Ingress annotations, merged with the cert-manager annotation the chart always sets. Free-form keys by nature.", + "type": "object" + } + } + }, + "secrets": { + "type": "object", + "additionalProperties": false, + "properties": { + "redisSecretRef": { + "type": ["string", "null"] + }, + "postgresSecretRef": { + "type": ["string", "null"] + }, + "oidcSecretRef": { + "type": ["string", "null"] + }, + "patchmonSecretRef": { + "type": ["string", "null"] + } + } + } + }, + "definitions": { + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "limitFactor": { + "type": "number", + "exclusiveMinimum": 0 + }, + "requests": { + "$ref": "#/definitions/resourceList" + }, + "limits": { + "$ref": "#/definitions/resourceList" + } + } + }, + "resourceList": { + "type": "object", + "additionalProperties": false, + "properties": { + "cpu": { + "type": ["string", "number", "null"] + }, + "memory": { + "type": ["string", "number", "null"] + }, + "ephemeral-storage": { + "type": ["string", "number", "null"] + }, + "ephemeralStorage": { + "type": ["string", "number", "null"] + } + } + }, + "env": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueFrom": { + "type": "object", + "additionalProperties": false, + "properties": { + "secretKeyRef": { + "$ref": "#/definitions/keyRef" + }, + "configMapKeyRef": { + "$ref": "#/definitions/keyRef" + } + } + } + } + } + }, + "keyRef": { + "type": "object", + "additionalProperties": false, + "required": ["name", "key"], + "properties": { + "name": { + "type": "string" + }, + "key": { + "type": "string" + } + } + }, + "securityContext": { + "type": "object", + "additionalProperties": false, + "properties": { + "pod": { + "description": "Rendered verbatim as the pod's securityContext; kept open because the chart does not interpret it.", + "type": "object" + }, + "container": { + "description": "Rendered verbatim as the container's securityContext; kept open because the chart does not interpret it.", + "type": "object" + } + } + }, + "probe": { + "description": "Rendered verbatim as a container probe; kept open because the chart does not interpret it.", + "type": "object" + } + } +} diff --git a/patchmon/values.yaml b/patchmon/values.yaml index 30530ec..d8367ab 100644 --- a/patchmon/values.yaml +++ b/patchmon/values.yaml @@ -136,6 +136,10 @@ patchmon: env: [] ingress: + # Set to false to omit the Ingress entirely (the required domain and + # clusterIssuer values are then not needed either, because they are only + # read inside the Ingress template). + enabled: true clusterIssuer: null domain: null className: nginx