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
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
