Resource Configurations
Place all resource definitions that Nagi needs in resources/.
All resources share the same structure as Kubernetes. The resource type is specified in the kind field.
yaml
apiVersion: nagi.io/v1alpha1
kind: <resource type>
metadata:
name: <unique name>
labels:
team: data-eng
annotations:
description: "..."
owner: "data-team@example.com"
spec:
...
Attributes
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | - | Unique name of the resource. |
annotations |
map[string, string] | — | - | Non-identifying metadata for descriptions, owner contacts, or other arbitrary information. |
labels |
map[string, string] | — | - | Key-value pairs for filtering with --select label:key or --select label:key=value. |
labels
labels are used with --select selectors to filter Assets.
yaml
metadata:
name: daily-sales
labels:
team: data-eng
env: prod
```bash
Select Assets that have the team label
nagi evaluate --select "label:team"
Select Assets where team=data-eng
nagi evaluate --select "label:team=data-eng" ```
Assets auto-generated by Origin (dbt) have dbt tags converted to labels with the dbt/ prefix.
yaml
metadata:
name: my-project.daily-sales
labels:
dbt/finance: ""
dbt/daily: ""
annotations
annotations store supplementary information about a resource. Nagi does not use these values in its processing.
yaml
metadata:
name: daily-sales
annotations:
description: "Aggregated metrics for daily sales"
owner: "data-team@example.com"
kind
Each kind has a different role within the reconciliation loop.
| kind | Role in the reconciliation loop |
|---|---|
| Asset | The target of Evaluate and Sync. onDrift defines pairs of desired state and the corresponding convergence operation. upstreams references upstream Assets. connection specifies an external data source when desired state evaluation needs to query one |
| Connection | Connection information for an external data source. Used by Conditions that query data, such as Freshness and SQL |
| Sync | Sync procedure definition. Three stages: pre, run, post |
| Conditions | A resource that groups desired state definitions. Can be shared across multiple Assets |
| Origin | Auto-generates Assets from data structure information managed by other software |
| Identity | Declares an authentication scope. Referenced from Connection, Sync, and Command conditions to control which credentials are used |
Template Variables
The following template variables can be used within args of Sync and Conditions. They are expanded at compile time.
| Variable | Description |
|---|---|
{{ asset.name }} |
The Asset's metadata.name. For Origin-generated Assets this is prefixed with the Origin name (e.g. my-project.orders) |
{{ asset.modelName }} |
The original model name without the Origin prefix (e.g. orders). For user-defined Assets, same as {{ asset.name }}. Use this for external tool arguments such as dbt run --select |
{{ sync.<key> }} |
The value of <key> from the Asset's onDrift[].with map. For example, {{ sync.selector }} expands to the value of with.selector |
{{ asset.name }} and {{ asset.modelName }}
These variables are always available and do not require with.
yaml
kind: Sync
metadata:
name: my-sync
spec:
run:
type: Command
args: ["echo", "{{ asset.name }}"]
# For Origin "my-project", model "orders": expands to "my-project.orders"
{{ sync.<key> }}
The Asset's onDrift[].with passes key-value pairs to the Sync. Each key becomes a {{ sync.<key> }} variable.
```yaml
Sync definition: uses {{ sync.selector }} as a placeholder
kind: Sync metadata: name: dbt-default spec: run: type: Command args: ["dbt", "run", "--select", "{{ sync.selector }}"] ```
```yaml
Asset passes the value via with
onDrift: - conditions: daily-sla sync: dbt-default with: selector: "+daily_sales" # {{ sync.selector }} expands to "+daily_sales" ```
When with is omitted, {{ asset.name }} and {{ asset.modelName }} are still expanded, but {{ sync.<key> }} remains unexpanded.