minecraft-router: strict values.schema.json and null-safe hardening

No ingress gate: this chart has no Ingress at all (clients reach it via a
NodePort), and ingress.domain appears neither in its templates nor in its
values.

1. values.schema.json (#68): additionalProperties: false on every
   chart-owned object level, including the entries of the mappings list,
   where domain and internalUrl are required.

2. Null-safety for hardening, probes and resources (#99). Two things a
   rebuilt default probe must not lose, both verified:
   - the API port is addressed by NAME ("api-port"), so the probe keeps
     working when server.apiPort is overridden.
   - mc-router still has no /health endpoint in 1.46.4, so GET /routes is
     the health signal, and the "Accept: application/json" header belongs
     to that request.

   The pod context keeps pinning uid/gid 10000 even though the image
   declares USER 65532 since 1.46.0, so the runtime identity does not
   silently change with the base image.

mappings stays deliberately not null-safe: the chart fails loudly on a
missing or empty routing table, which is the loud class #99 excludes - a
router without routes is not operable and has no sensible default.

Rendering with normal values is byte-identical to 2.0.0.
This commit is contained in:
jklein committed 2026-08-23 21:49:18 +02:00
1 parent 4e63e8c164
commit a76accf7ad
4 files changed
+363 -7

No files matched your search

+189
View File
@@ -0,0 +1,189 @@
{
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "minecraft-router 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. The hardening, probe and resources blocks additionally accept null, because an erased block falls back to the chart defaults (issue #99).",
"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"
},
"mappings": {
"description": "Routing table: which client-facing hostname is proxied to which backend. Required and must not be empty - the chart fails loudly on a missing or empty list, so this block is deliberately NOT null-safe (issue #99 covers only the silent class). A change here rolls the router pod via the checksum/config annotation.",
"type": ["array", "null"],
"items": {
"type": "object",
"additionalProperties": false,
"required": ["domain", "internalUrl"],
"properties": {
"domain": {
"description": "Client-facing hostname the Minecraft client connects to.",
"type": ["string", "null"]
},
"internalUrl": {
"description": "Cluster-internal address of the backend server.",
"type": ["string", "null"]
},
"port": {
"description": "Overrides server.backendPort for this single backend.",
"type": ["integer", "null"],
"minimum": 1,
"maximum": 65535
}
}
}
},
"server": {
"type": "object",
"additionalProperties": false,
"properties": {
"replicas": {
"type": "integer",
"minimum": 0
},
"outwardPort": {
"description": "nodePort of the router Service. 25565 is deliberately outside the Kubernetes default node-port range - the cluster runs an extended --service-node-port-range, and Minecraft clients connect to this exact port.",
"type": ["integer", "null"],
"minimum": 1,
"maximum": 65535
},
"port": {
"type": ["integer", "null"],
"minimum": 1,
"maximum": 65535
},
"backendPort": {
"type": ["integer", "null"],
"minimum": 1,
"maximum": 65535
},
"apiPort": {
"description": "Port of the mc-router HTTP API. Not exposed by the Service; only the probes talk to it.",
"type": ["integer", "null"],
"minimum": 1,
"maximum": 65535
},
"resources": {
"$ref": "#/definitions/resources"
},
"livenessProbe": {
"$ref": "#/definitions/probe"
},
"readinessProbe": {
"$ref": "#/definitions/probe"
},
"startupProbe": {
"$ref": "#/definitions/probe"
},
"securityContext": {
"$ref": "#/definitions/securityContext"
},
"env": {
"description": "Extra environment variables. This is also how every mc-router option the chart does not model explicitly is set: mc-router parses its flags with go-flagsfiller, so \"--some-flag\" is settable as \"SOME_FLAG\".",
"$ref": "#/definitions/env"
}
}
}
},
"definitions": {
"resources": {
"description": "May be null / empty: the chart then falls back to its default requests and computed limits (issue #99) instead of rendering a container without resource accounting.",
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"limitFactor": {
"type": "number",
"exclusiveMinimum": 0
},
"requests": {
"$ref": "#/definitions/resourceList"
},
"limits": {
"$ref": "#/definitions/resourceList"
}
}
},
"resourceList": {
"type": ["object", "null"],
"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": {
"description": "May be null / empty at any level: the chart then falls back to its hardening defaults (issue #99) instead of rendering an unhardened workload.",
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"pod": {
"description": "Merged onto the chart's pod hardening defaults and rendered as the pod's securityContext; kept open because the chart does not interpret the individual fields.",
"type": ["object", "null"]
},
"container": {
"description": "Merged onto the chart's container hardening defaults and rendered as the container's securityContext; kept open because the chart does not interpret the individual fields.",
"type": ["object", "null"]
}
}
},
"probe": {
"description": "Merged onto the chart's probe defaults and rendered as a container probe; kept open because the chart does not interpret the individual fields. May be null / empty, which means the defaults apply (issue #99) rather than the probe disappearing.",
"type": ["object", "null"]
}
}
}