Last month I spent 4 hours debugging why our staging environment kept crashing. Turns out someone set memory: "2GB"
in our YAML config instead of memory: 2048
. The pod scheduler silently failed, defaulted to 128MB, and our Java app kept OOMing.
This is the daily reality of config management. JSON breaks when you need comments. YAML breaks when someone uses tabs instead of spaces. XML breaks your will to live.
The Problem
Configuration lives in this hellish middle ground where it's too complex for static files but too simple for a real programming language. You end up with YAML templates full of ${ENVIRONMENT_VAR}
substitutions that break in creative ways.
The Kubernetes "no"
bug bit us hard - YAML silently converts the string "no" to boolean false, which broke our Norwegian customers' configs. Took three weeks to track down because it only failed for certain countries.
How Pkl Fixes It
Pkl validates everything at build time. Write your config once, generate JSON/YAML for whatever tools you're using:
port: UInt16(this > 1000) // This actually prevents port 80 mistakes
database: String(!isEmpty) // No more empty database URLs in prod
It's sandboxed, so config evaluation can't fuck with your filesystem or make network calls.
What This Actually Means
I switched our team's microservice configs from YAML hell to Pkl about 6 months ago. We had 15 different config files across environments, and keeping them in sync was a nightmare. Someone would update the database timeout in prod config but forget staging, then we'd wonder why staging was timing out.
Now we have 4 Pkl files that generate environment-specific JSON. The type checking caught 3 production bugs in the first week - things like port numbers set to strings, missing required fields, that sort of basic shit that YAML just lets slide.
The Java code generation is solid. Instead of parsing Map<String, Object>
and hoping the keys exist, you get proper typed classes with autocomplete. Saved probably 10 hours of config debugging last month.
The Downsides
The learning curve exists. It's not bad if you know any programming language, but your ops team who's used to editing YAML directly will need time to adjust.
IDE support is good in IntelliJ, okay in VS Code. Error messages are actually helpful, which surprised me coming from other config languages.
Performance is fine for normal configs but can get slow on massive Kubernetes manifests. Apple's working on it since they probably generate a lot of iPhone configs.