Repository navigation
Migration Guide
Franklin Garcia edited this page Dec 1, 2025
·
4 revisions
This guide helps you migrate existing Timonel charts from legacy helpers to modern type-safe helpers.
| Legacy | Modern | Purpose |
|---|---|---|
helmInclude() |
valuesRef() or direct values |
Template inclusion |
helmIf() |
v.if() |
Conditionals |
helmRange() |
v.range() |
Iteration |
helmWith() |
v.with() |
Field-level scoping |
createHelmExpression as helm |
valuesRef() |
Value interpolation |
Before:
import { Rutter, helmInclude, createHelmExpression as helm } from 'timonel';
chart.addManifest({
metadata: {
name: helmInclude('chart.fullname', '.'),
labels: helmInclude('chart.labels', '.', { pipe: 'nindent 4' })
}
}, 'deployment');After:
import { Rutter, valuesRef } from 'timonel';
chart.addManifest({
metadata: {
name: 'my-app',
labels: { app: 'my-app' }
}
}, 'deployment');Before:
import { Rutter, helmIf, createHelmExpression as helm } from 'timonel';
chart.addManifest({
spec: {
replicas: helmIf('.Values.production',
helm('{{ .Values.replicaCount | default 5 }}'),
helm('1')
)
}
}, 'deployment');After:
import { Rutter, v } from 'timonel';
chart.addManifest({
spec: {
replicas: v.if('production', 5, 1)
}
}, 'deployment');Before:
import { Rutter, helmRange, createHelmExpression as helm } from 'timonel';
chart.addManifest({
data: helmRange('$key, $value', '.Values.envVars',
helm('{{ $key }}: {{ $value | quote }}')
)
}, 'config');After:
import { Rutter, v } from 'timonel';
chart.addManifest({
data: v.range('envVars', (item) => ({
[item.key]: item.value
}))
}, 'config');Before:
import { Rutter, helmWith, createHelmExpression as helm } from 'timonel';
chart.addManifest({
spec: {
containers: [
helmWith('container',
helm('{{ toYaml . | nindent 8 }}')
)
]
}
}, 'pod');After:
import { Rutter, v } from 'timonel';
chart.addManifest({
spec: {
containers: [
v.with('container', {
name: 'app',
image: 'myapp:latest'
})
]
}
}, 'pod');Before:
import { Rutter, createHelmExpression as helm } from 'timonel';
chart.addManifest({
spec: {
replicas: helm('{{ .Values.replicas }}'),
template: {
spec: {
containers: [{
image: helm('{{ .Values.image.repository }}:{{ .Values.image.tag }}')
}]
}
}
}
}, 'deployment');After:
import { Rutter, valuesRef } from 'timonel';
chart.addManifest({
spec: {
replicas: valuesRef('replicas'),
template: {
spec: {
containers: [{
image: valuesRef('image.repository', 'image.tag', (repo, tag) => `${repo}:${tag}`)
}]
}
}
}
}, 'deployment');import { Rutter, helmInclude, helmIf, helmRange, createHelmExpression as helm } from 'timonel';
const chart = new Rutter({
meta: { name: 'my-app', version: '1.0.0' },
defaultValues: {
replicas: 3,
image: { repository: 'myapp', tag: 'latest' },
production: false,
envVars: { LOG_LEVEL: 'info', PORT: '8080' }
}
});
chart.addManifest({
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: helmInclude('chart.fullname', '.'),
labels: helmInclude('chart.labels', '.', { pipe: 'nindent 4' })
},
spec: {
replicas: helmIf('.Values.production',
helm('{{ .Values.replicas | default 5 }}'),
helm('1')
),
template: {
spec: {
containers: [{
name: 'app',
image: helm('{{ .Values.image.repository }}:{{ .Values.image.tag }}'),
env: helmRange('$key, $value', '.Values.envVars',
helm('{{ $key }}: {{ $value | quote }}')
)
}]
}
}
}
}, 'deployment');import { Rutter, valuesRef, v } from 'timonel';
const chart = new Rutter({
meta: { name: 'my-app', version: '1.0.0' },
defaultValues: {
replicas: 3,
image: { repository: 'myapp', tag: 'latest' },
production: false,
envVars: { LOG_LEVEL: 'info', PORT: '8080' }
}
});
chart.addManifest({
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'my-app',
labels: { app: 'my-app' }
},
spec: {
replicas: v.if('production', 5, 1),
template: {
spec: {
containers: [{
name: 'app',
image: valuesRef('image.repository', 'image.tag', (repo, tag) => `${repo}:${tag}`),
env: v.range('envVars', (item) => ({
name: item.key,
value: item.value
}))
}]
}
}
}
}, 'deployment');import { Rutter, createHelmExpression as helm } from 'timonel';
chart.addManifest({
spec: {
containers: [{
env: [
{ name: 'VERSION', value: helm('{{ .Values.global.env.VERSION | default "1.0.0" }}') },
{ name: 'LOG_LEVEL', value: helm('{{ .Values.global.env.LOG_LEVEL | default "info" }}') }
]
}]
}
}, 'deployment');import { Rutter, loadAndGenerateEnvVars } from 'timonel';
const chart = new Rutter({
defaultValues: {
global: {
env: {
VERSION: '1.0.0',
LOG_LEVEL: 'info'
}
}
}
});
const envVars = loadAndGenerateEnvVars(chart.defaultValues, 'global.env');
chart.addManifest({
spec: {
containers: [{
env: envVars
}]
}
}, 'deployment');- ✅ Compile-time validation
- ✅ IDE autocomplete support
- ✅ No runtime template errors
- ✅ Cleaner, more readable code
- ✅ Less boilerplate
- ✅ Better maintainability
- ✅ Full IntelliSense support
- ✅ Easier debugging
- ✅ Better error messages
- Update imports to use
valuesRef,vinstead of legacy helpers - Replace
helmInclude()calls with direct values orvaluesRef() - Replace
helmIf()withv.if() - Replace
helmRange()withv.range() - Replace
helmWith()withv.with() - Replace
helm()expressions withvaluesRef() - Test generated Helm charts with
helm lint - Verify deployment with
helm template - Update documentation and examples
Solution: Ensure Timonel is installed:
npm install timonel
# or
pnpm add timonelSolution: Import from correct module:
import { valuesRef } from 'timonel';Solution: Import v from timonel:
import { v } from 'timonel';Solution: Validate with Helm:
helm lint ./dist
helm template my-app ./dist --debug- Check API Reference for complete documentation
- See Examples for real-world use cases
- Review Best Practices for recommended patterns
- Open an issue on GitHub
After migration:
- Review Best Practices guide
- Explore Advanced Examples
- Consider Environment Variables setup
- Check Umbrella Charts for complex deployments
Timonel documentation · Repository · npm · Issues