Skip to content

Commit c84d6d2

Browse files
authored
add lua script doc (#468)
1 parent 815a512 commit c84d6d2

5 files changed

Lines changed: 415 additions & 5 deletions

File tree

generated/routes.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"/overview/management-api-reference": {
1515
"relPath": "/overview/management-api-reference.md",
16-
"lastmod": "2025-05-16T13:24:36.000Z"
16+
"lastmod": "2025-06-06T08:44:49.000Z"
1717
},
1818
"/overview/agent-api-reference": {
1919
"relPath": "/overview/agent-api-reference.md",
@@ -115,6 +115,10 @@
115115
"relPath": "/plural-features/continuous-deployment/helm-service.md",
116116
"lastmod": "2025-03-12T14:59:41.000Z"
117117
},
118+
"/plural-features/continuous-deployment/lua": {
119+
"relPath": "/plural-features/continuous-deployment/lua.md",
120+
"lastmod": "2025-06-09T12:07:35.725Z"
121+
},
118122
"/plural-features/continuous-deployment/global-service": {
119123
"relPath": "/plural-features/continuous-deployment/global-service.md",
120124
"lastmod": "2025-03-12T14:59:41.000Z"
@@ -273,7 +277,7 @@
273277
},
274278
"/plural-features/pr-automation/crds": {
275279
"relPath": "/plural-features/pr-automation/crds.md",
276-
"lastmod": "2025-05-19T07:10:18.000Z"
280+
"lastmod": "2025-06-05T13:01:10.000Z"
277281
},
278282
"/plural-features/pr-automation/testing": {
279283
"relPath": "/plural-features/pr-automation/testing.md",
@@ -293,7 +297,7 @@
293297
},
294298
"/plural-features/service-templating/supporting-liquid-filters": {
295299
"relPath": "/plural-features/service-templating/supporting-liquid-filters.md",
296-
"lastmod": "2025-03-12T14:59:41.000Z"
300+
"lastmod": "2025-06-06T08:44:49.000Z"
297301
},
298302
"/plural-features/projects-and-multi-tenancy": {
299303
"relPath": "/plural-features/projects-and-multi-tenancy/index.md",
@@ -533,7 +537,7 @@
533537
},
534538
"/deployments/pr/crds": {
535539
"relPath": "/plural-features/pr-automation/crds.md",
536-
"lastmod": "2025-05-19T07:10:18.000Z"
540+
"lastmod": "2025-06-05T13:01:10.000Z"
537541
},
538542
"/deployments/pr/testing": {
539543
"relPath": "/plural-features/pr-automation/testing.md",

pages/plural-features/continuous-deployment/helm-service.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ title: Helm-sourced services
33
description: Source manifests from a helm repository registered anywhere
44
---
55

6-
You can also source manifests from a https or OCI-compatible helm repository. This is very useful for provisioning kubernetes add-ons, which are usually packaged using helm, or occasionally for complex release processes where helms versioning independent of git can be valuable. The path here requires creation of a Flux `HelmRepository` CR first, then the service, e.g.:
6+
You can also source manifests from a https or OCI-compatible helm repository. This is very useful for provisioning
7+
kubernetes add-ons, which are usually packaged using helm, or occasionally for complex release processes where helms
8+
versioning independent of git can be valuable. The path here requires creation of a Flux `HelmRepository` CR first, then
9+
the service, e.g.:
710

811
```yaml
912
# the Cluster resource should ideally be defined in separate files in your infra repo
@@ -44,6 +47,44 @@ spec:
4447
namespace: infra
4548
```
4649
50+
## Dynamic Helm Configuration via luaScript
51+
52+
Plural supports runtime configuration generation via Lua scripting. This feature allows Helm deployments to
53+
dynamically compute `values` and `valuesFiles`, enabling powerful CI/CD workflows and context-aware configuration.
54+
55+
```yaml
56+
apiVersion: deployments.plural.sh/v1alpha1
57+
kind: ServiceDeployment
58+
metadata:
59+
name: nginx
60+
namespace: infra
61+
spec:
62+
namespace: ingress-nginx
63+
name: ingress-nginx
64+
helm:
65+
version: 4.4.x
66+
chart: ingress-nginx
67+
url: https://kubernetes.github.io/ingress-nginx
68+
luaScript: |
69+
-- Lua code returning:
70+
-- { values: table<string, any>, valuesFiles: list<string> }
71+
values = {}
72+
values["appName"] = "MyApplication"
73+
values["version"] = "1.2.3"
74+
values["debug"] = true
75+
values["maxConnections"] = 100
76+
77+
valuesFiles = {"config.json", "secrets.yaml"}
78+
repository:
79+
namespace: infra
80+
name: nginx # referenced helm repository above
81+
clusterRef:
82+
kind: Cluster
83+
name: k3s
84+
namespace: infra
85+
```
86+
For more information, see [Dynamic Helm Configuration with Lua Scripts](lua.md).
87+
4788
## Multi-Source Helm
4889

4990
Say you want to source the helm templates from an upstream helm repository, but the values files from a Git repository. In that case, you can define a multi-sourced service, which has both a git and helm repository defined. It would look like so:

0 commit comments

Comments
 (0)