Helm Integration Patterns
Common Helm chart integration patterns with TypeKro.
Basic Helm Release
typescript
import { type } from 'arktype';
import { kubernetesComposition, Cel helmRelease, Cel } from 'typekro';
const HelmAppSpec = type({
name: 'string',
chartVersion: 'string',
replicas: 'number',
hostname: 'string'
});
export const helmApp = kubernetesComposition({
{
name: 'helm-app',
apiVersion: 'example.com/v1alpha1',
kind: 'HelmApp',
spec: HelmAppSpec
},
(schema) => ({
release: helmRelease({
name: schema.spec.name,
chart: {
repository: 'https://charts.bitnami.com/bitnami',
name: 'nginx',
version: schema.spec.chartVersion
},
values: {
replicaCount: schema.spec.replicas,
ingress: {
enabled: true,
hostname: schema.spec.hostname
}
}
})
}),
(schema, resources) => ({
phase: resources.release.status.phase,
// ✨ Natural JavaScript expressions - automatically converted to CEL
ready: resources.release.status.phase === 'Ready',
url: `https://${schema.spec.hostname}`
})
);
Multi-Chart Application
typescript
export const helmStack = kubernetesComposition({
{
name: 'helm-stack',
apiVersion: 'example.com/v1alpha1',
kind: 'HelmStack',
spec: type({
name: 'string',
environment: 'string'
})
},
(schema) => ({
// Database chart
database: helmRelease({
name: `${schema.spec.name}-db`, // ✨ Natural JavaScript template literal
chart: {
repository: 'https://charts.bitnami.com/bitnami',
name: 'postgresql'
},
values: {
auth: {
database: schema.spec.name,
username: 'app'
}
}
}),
// Application chart
app: helmRelease({
name: schema.spec.name,
chart: {
repository: 'https://charts.company.com',
name: 'webapp'
},
values: {
database: {
host: `${schema.spec.name}-db-postgresql`, // ✨ Natural JavaScript template literal
port: 5432
},
environment: schema.spec.environment
}
})
}),
(schema, resources) => ({
// ✨ Natural JavaScript expressions - automatically converted to CEL
ready: resources.database.status.phase === 'Ready' &&
resources.app.status.phase === 'Ready'
})
);
Key Patterns
- Chart Dependencies: Database deployed before application
- Value Templating: Using schema references in Helm values
- Status Aggregation: Overall readiness from multiple charts