lynq render (CLI)
Render a LynqForm against rows from a CSV or JSON file and print the objects Lynq would apply, without a cluster or a database. Uses the same rendering code as the controllers.
lynq render prints what Lynq would create for each active row: the objects, in apply order, after every template is filled in. It needs no cluster and no database, and it runs the same rendering code as the controllers (internal/render), so its output and its errors are what a LynqNode would get.
Use it to check a LynqForm before applying it, in CI, or to see what a new column does. For the same thing in a browser, use the Playground.
Install
lynq render ships with the next release. Until then, install it from the main branch (needs Go):
go install github.com/k8s-lynq/lynq/cmd/lynq@mainExample
From examples/customer-web in the repository, with the table as a CSV file:
id,active,image,plan
acme,1,nginx:1.27,pro
beta,0,nginx:1.27,basic
gamma,1,nginx:1.27,basic$ lynq render --hub lynqhub.yaml -f lynqform.yaml --rows rows.csv --namespace customers
# LynqNode acme-web, resource app
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
lynq.sh/deletion-policy: Delete
name: acme-web
namespace: customers
spec:
replicas: 1
selector:
matchLabels:
app: acme-web
template:
metadata:
labels:
app: acme-web
plan: pro
spec:
containers:
- image: nginx:1.27
name: web
ports:
- containerPort: 80
---
# LynqNode acme-web, resource svc
apiVersion: v1
kind: Service
metadata:
annotations:
lynq.sh/deletion-policy: Delete
name: acme-web
namespace: customers
spec:
ports:
- port: 80
targetPort: 80
selector:
app: acme-web
---
# LynqNode gamma-web, resource app
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
lynq.sh/deletion-policy: Delete
name: gamma-web
namespace: customers
spec:
replicas: 1
selector:
matchLabels:
app: gamma-web
template:
metadata:
labels:
app: gamma-web
plan: basic
spec:
containers:
- image: nginx:1.27
name: web
ports:
- containerPort: 80
---
# LynqNode gamma-web, resource svc
apiVersion: v1
kind: Service
metadata:
annotations:
lynq.sh/deletion-policy: Delete
name: gamma-web
namespace: customers
spec:
ports:
- port: 80
targetPort: 80
selector:
app: gamma-web
---
# row beta is inactive: no LynqNodeReal output of the CLI, regenerated on every site build by website/scripts/render-examples.mjs
beta is inactive, so it gets nothing. Each object is commented with its LynqNode and resource ID.
Rows
--rows takes a CSV file with a header row, or a JSON array of objects. Keys are column names, as in the database: the LynqHub's valueMappings and extraValueMappings map them to template variables, exactly as they do against MySQL.
| In the file | Read as |
|---|---|
| CSV cell | the string as written |
JSON true / false | "1" / "0", as MySQL returns a BOOLEAN |
| JSON number | its decimal form |
JSON null | "" |
A row is active when its activate column is 1, true, TRUE, True, yes, YES or Yes — the same rule the LynqHub applies.
Flags
| Flag | Meaning |
|---|---|
--hub | LynqHub manifest (required) |
-f | LynqForm manifest; repeat for several forms (required) |
--rows | rows file, .csv or .json (required) |
--namespace | namespace of the LynqHub when its manifest sets none (default default). LynqNodes, and resources without targetNamespace, go here |
-o | yaml (default): the objects. json: the full result, including dependency levels, inactive rows and errors |
What it does not show
- Apply-time metadata. On apply Lynq adds an ownerReference (or tracking labels for cross-namespace resources and Namespaces) and its own annotations such as
lynq.sh/applied-hash.lynq rendershows the object before that. - Cluster state. Readiness, conflicts with existing objects, and policy behavior (
creationPolicy,conflictPolicy) need a cluster. - Admission. The LynqForm is not run through the validating webhook, so a form the webhook would reject can still render here. Cycles and unknown
dependIdsare reported, because rendering builds the dependency graph.
Exit status
0 when every object rendered. 1 when an input cannot be read, a resource failed to render, or a resource would be skipped because a dependency failed (skipOnDependencyFailure, default true). Each of these is printed as a # comment in place of the object.
Configuration
Lynq operator configuration reference: controller runtime flags, concurrency knobs (node, hub, form), requeue intervals, and feature gates.
Monitoring & Observability
Set up Prometheus metrics, Grafana dashboards, and structured logging for Lynq. Includes metrics catalog, events reference, and alerting overview.