@intentius/chant-lexicon-helm 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,211 +0,0 @@
1
- ---
2
- skill: chant-helm
3
- description: Build, validate, and deploy Helm charts from a chant project
4
- user-invocable: true
5
- ---
6
-
7
- # Helm Chart Operational Playbook
8
-
9
- ## How chant and Helm relate
10
-
11
- chant is a **synthesis compiler** — it compiles TypeScript source files into a complete Helm chart directory (Chart.yaml, values.yaml, templates/, etc.). `chant build` does not call the Helm CLI; synthesis is pure and deterministic. Your job as an agent is to bridge synthesis and deployment:
12
-
13
- - Use **chant** for: build, lint, diff (local chart comparison)
14
- - Use **helm** for: install, upgrade, rollback, test, dependency update
15
-
16
- The source of truth is the TypeScript in `src/`. The generated chart directory is an intermediate artifact — never edit it by hand.
17
-
18
- ## Scaffolding a new project
19
-
20
- ### Initialize with a template
21
-
22
- ```bash
23
- chant init --lexicon helm # default: Deployment + Service chart
24
- ```
25
-
26
- ### Project structure after init
27
-
28
- ```
29
- my-chart/
30
- src/
31
- chart.ts ← Chart metadata, Values, K8s resources with Helm intrinsics
32
- chant.json ← project configuration
33
- package.json
34
- ```
35
-
36
- ## Key concepts
37
-
38
- ### Values proxy
39
-
40
- The `values` proxy creates `{{ .Values.x }}` template directives:
41
-
42
- ```typescript
43
- import { values } from "@intentius/chant-lexicon-helm";
44
-
45
- // values.replicaCount → {{ .Values.replicaCount }}
46
- // values.image.repository → {{ .Values.image.repository }}
47
- ```
48
-
49
- ### Template functions
50
-
51
- ```typescript
52
- import { include, printf, toYaml, quote, required, helmDefault } from "@intentius/chant-lexicon-helm";
53
-
54
- include("my-app.fullname") // {{ include "my-app.fullname" . }}
55
- printf("%s:%s", values.image.repo, values.image.tag) // {{ printf "%s:%s" ... }}
56
- toYaml(values.resources, 12) // {{ toYaml .Values.resources | nindent 12 }}
57
- ```
58
-
59
- ### Conditional resources
60
-
61
- ```typescript
62
- import { If, values } from "@intentius/chant-lexicon-helm";
63
-
64
- // Wrap an entire resource in {{- if .Values.ingress.enabled }}
65
- export const ingress = If(values.ingress.enabled, new Ingress({ ... }));
66
- ```
67
-
68
- ### Built-in objects
69
-
70
- ```typescript
71
- import { Release, ChartRef } from "@intentius/chant-lexicon-helm";
72
-
73
- Release.Name // {{ .Release.Name }}
74
- Release.Namespace // {{ .Release.Namespace }}
75
- ChartRef.Version // {{ .Chart.Version }}
76
- ```
77
-
78
- ## Build and validate workflow
79
-
80
- ```bash
81
- # Build the chart
82
- chant build
83
-
84
- # Lint the TypeScript (pre-synth rules)
85
- chant lint
86
-
87
- # Validate the generated chart (post-synth checks)
88
- chant check
89
-
90
- # Validate with helm CLI
91
- helm lint dist/
92
- helm template test dist/
93
- ```
94
-
95
- ## Common patterns
96
-
97
- ### Deployment with parameterized image
98
-
99
- ```typescript
100
- export const deployment = new Deployment({
101
- metadata: {
102
- name: include("my-app.fullname"),
103
- labels: include("my-app.labels"),
104
- },
105
- spec: {
106
- replicas: values.replicaCount,
107
- template: {
108
- spec: {
109
- containers: [{
110
- name: "my-app",
111
- image: printf("%s:%s", values.image.repository, values.image.tag),
112
- resources: toYaml(values.resources),
113
- }],
114
- },
115
- },
116
- },
117
- });
118
- ```
119
-
120
- ### Composites for common patterns
121
-
122
- ```typescript
123
- import { HelmWebApp, HelmMicroservice, HelmDaemonSet, HelmWorker } from "@intentius/chant-lexicon-helm";
124
-
125
- // Quick scaffold: Deployment + Service + Ingress + HPA + ServiceAccount
126
- const result = HelmWebApp({ name: "my-app", port: 3000, replicas: 3 });
127
-
128
- // Full microservice: + PDB + ConfigMap + health probes + resource limits
129
- const msvc = HelmMicroservice({ name: "api", port: 8080 });
130
-
131
- // DaemonSet for node-level agents (logging, monitoring)
132
- const agent = HelmDaemonSet({ name: "log-agent", imageRepository: "fluent/fluent-bit" });
133
-
134
- // Worker for background processors (no Service, exec probes, queue config)
135
- const worker = HelmWorker({ name: "job-processor", replicas: 4 });
136
- ```
137
-
138
- ### Secret management with ExternalSecret
139
-
140
- ```typescript
141
- import { HelmExternalSecret } from "@intentius/chant-lexicon-helm";
142
-
143
- const secrets = HelmExternalSecret({
144
- name: "app-secrets",
145
- secretStoreName: "vault",
146
- data: {
147
- DB_PASSWORD: "secret/data/db-password",
148
- API_KEY: "secret/data/api-key",
149
- },
150
- });
151
- ```
152
-
153
- ### Resource ordering
154
-
155
- ```typescript
156
- import { withOrder, argoWave } from "@intentius/chant-lexicon-helm";
157
-
158
- // Helm hook ordering (lower weight = runs first)
159
- metadata: { annotations: { ...withOrder(-5) } }
160
-
161
- // Argo CD sync waves
162
- metadata: { annotations: { ...argoWave(2) } }
163
- ```
164
-
165
- ### CRD lifecycle management
166
-
167
- ```typescript
168
- import { HelmCRDLifecycle } from "@intentius/chant-lexicon-helm";
169
-
170
- // Managed CRD lifecycle via Helm hooks (solves Helm's CRD limitation)
171
- const lifecycle = HelmCRDLifecycle({
172
- name: "my-operator",
173
- crdContent: crdYaml,
174
- });
175
- ```
176
-
177
- ## Lint rules
178
-
179
- | Rule | Description |
180
- |------|-------------|
181
- | WHM001 | Chart must have name, version, apiVersion |
182
- | WHM002 | Values should not contain bare secrets |
183
- | WHM003 | Container images should use values references |
184
- | WHM101 | Chart.yaml has valid apiVersion (v2) |
185
- | WHM102 | values.schema.json present when Values used |
186
- | WHM103 | Go template syntax valid (balanced braces) |
187
- | WHM104 | NOTES.txt exists for application charts |
188
- | WHM105 | _helpers.tpl exists |
189
- | WHM201 | Resources have standard Helm labels |
190
- | WHM301 | At least one test for application charts |
191
- | WHM302 | Resource limits set |
192
- | WHM401 | Image uses :latest tag or no tag |
193
- | WHM402 | runAsNonRoot not set |
194
- | WHM403 | readOnlyRootFilesystem not set |
195
- | WHM404 | privileged: true detected |
196
- | WHM405 | Resource spec missing cpu/memory |
197
- | WHM406 | CRD lifecycle limitation |
198
- | WHM407 | Secret with inline data |
199
- | WHM501 | Unused values keys |
200
- | WHM502 | Deprecated K8s API versions |
201
-
202
- ## Troubleshooting
203
-
204
- ### "apiVersion must be v2"
205
- Helm 3 requires `apiVersion: v2` in Chart.yaml. Update your Chart metadata.
206
-
207
- ### "unbalanced template braces"
208
- A Go template expression has mismatched `{{` / `}}`. Check your intrinsic usage.
209
-
210
- ### "hardcoded image tag"
211
- Use `printf("%s:%s", values.image.repository, values.image.tag)` instead of literal strings for container images.