Skip to content

Lint Rules

The Kubernetes lexicon ships lint rules that run during chant lint and post-synth checks that validate the serialized YAML after chant build.

Lint rules analyze your TypeScript source code before build.

Severity: warning | Category: correctness

Flags hardcoded namespace strings in resource constructors. Namespaces should be parameterized or derived from configuration.

// Bad — hardcoded namespace
new Deployment({ metadata: { namespace: "production" } });
// Good — parameterized
new Deployment({ metadata: { namespace: config.namespace } });

Post-synth checks run against the serialized YAML after build.

RuleDescription
WK8005Hardcoded secrets in environment variables
WK8041API keys detected in env values
WK8042Private keys in ConfigMaps or Secrets
WK8202Privileged container (privileged: true)
WK8203Writable root filesystem (readOnlyRootFilesystem not set)
WK8204Container running as root (runAsNonRoot not set)
WK8205Capabilities not dropped (drop: ["ALL"] missing)
WK8207Host network access (hostNetwork: true)
WK8208Host PID namespace (hostPID: true)
WK8209Host IPC namespace (hostIPC: true)
RuleDescription
WK8006Latest image tag or untagged image
WK8101Deployment selector doesn’t match template labels
WK8102Resource missing metadata.labels
WK8103Container missing name
WK8104Unnamed container ports
WK8105Missing imagePullPolicy
RuleDescription
WK8201Container missing resource limits
WK8301Container missing health probes (skips Jobs/CronJobs)
WK8302Single replica Deployment
WK8303HA Deployment without PodDisruptionBudget
Terminal window
# Lint your chant project
chant lint
# Build (also runs post-synth checks)
chant build

To suppress a rule on a specific line:

// chant-disable-next-line WK8001
export const deploy = new Deployment({ metadata: { namespace: "prod" } });

To suppress globally in chant.config.ts:

export default {
lint: {
rules: {
WK8001: "off",
},
},
};