Cloud / HELM Interview Questions
How do you validate Helm values with JSON Schema?
Helm supports JSON Schema validation for values.yaml, helping catch configuration errors early before deployment. Create values.schema.json in chart root.
Basic schema example: { "$schema": "https://json-schema.org/draft-07/schema", "properties": { "replicaCount": { "type": "integer", "minimum": 1, "maximum": 100, "default": 1 }, "image": { "type": "object", "properties": { "repository": {"type": "string", "pattern": "^[a-z0-9-/]+$"}, "tag": {"type": "string", "minLength": 1}, "pullPolicy": { "type": "string", "enum": ["Always", "Never", "IfNotPresent"], "default": "IfNotPresent" } }, "required": ["repository", "tag"] }, "resources": { "type": "object", "properties": { "limits": { "type": "object", "patternProperties": { "^(cpu|memory)$": {"type": "string", "pattern": "^[0-9]+(Mi|Gi|m|)$"} } } } } }, "required": ["image"], "additionalProperties": false }
Conditional validation with if/then: { "if": { "properties": {"environment": {"const": "prod"}} }, "then": { "properties": { "replicaCount": {"minimum": 3}, "resources": {"required": ["limits"]} } } }
Custom error messages: Use errorMessage keyword: "errorMessage": "replicaCount must be between 1 and 100" (requires additional library).
Validation workflow: helm lint automatically validates against schema. helm template --validate (v3.3+) performs server-side validation. Schema validation occurs BEFORE template rendering - invalid values fail fast.
Best practices:
- Keep schema synchronized with values.yaml defaults
- Use pattern properties for regex validation
- Define required fields clearly
- Test schema with
helm lintand invalid test values - Document schema in README for chart users
More Related questions...