tazuna apply
Reflects the Manifests declared in tazuna.yaml into the cluster. The central command of Tazuna.
tazuna apply [-f tazuna.yaml] [--tags ...] [--no-cache | --offline]
[--sync [--prune] [--atomic]]
Behavior
The execution order is as follows. Cluster access happens from step 5 onward.
- Load and validate
tazuna.yaml. - If
spec.context_matchesis set, match against the current-context. Abort immediately on mismatch. - Filter by
--tags. - Split
manifests[]into layers derived fromdependsOn. If nodependsOnis used, the number of layers equals the number of manifests, giving behavior identical to the traditional sequential execution in declaration order. - Hand the manifests within each layer to their corresponding Manager in parallel and apply them to the cluster.
- After each Manifest applies successfully, run its
tests. - For Manifests whose apply and tests succeeded, write the content hash back to the state ConfigMap (the starting point for subsequent
state diff/state drift/plan). - After all Manifests are applied, execute
spec.tests(overall Tests).
For dependsOn behavior, see DAG Execution via dependsOn.
State integration (–sync / –prune / –atomic)
tazuna apply is designed to write the state ConfigMap even by default. The role of tazuna state sync, formerly a separate command, has been merged into apply with the --sync flag (see “Migration: replacing the old state sync” below).
| Flag | Behavior |
|---|---|
| None | Apply every Manifest unconditionally via the Manager’s Apply(), then save state. |
--sync | Switches to diff mode. Compares each Manager’s Build() result against the saved state and CreateOrUpdates only resources classified as added / modified / always-sync. |
--sync --prune | In addition to the above, Deletes resources that are in state but absent from the Build result (removed). Requires --sync. |
--sync --atomic | Defers each Manifest’s state save to the end. If even one error occurs partway, it exits without updating state at all. Requires --sync. |
Specifying --prune / --atomic without --sync is a validation error.
Flag
In addition to global flags, the following are accepted.
| Flag | Alias | Type | Default | Description |
|---|---|---|---|---|
--tags | -t | []string | [] | Limits the processing target to Manifests with at least one of the specified tags (OR evaluation). |
--no-cache | - | bool | false | For type: oras Manifests, always refetch from the registry without using the cache. |
--offline | - | bool | false | For type: oras Manifests, forbid access to the registry. If the cache misses, it is an error. |
--sync | - | bool | false | Enables diff mode. Applies only the diff between state and the Build result. |
--prune | - | bool | false | Deletes resources present in state but absent from the Build result. Requires --sync. |
--atomic | - | bool | false | Saves state in a batch after all Manifests succeed. State is not changed on a mid-run error. Requires --sync. |
--no-cache and --offline cannot be specified together.
Examples
# Normal apply (state is saved automatically)
tazuna apply -f tazuna.yaml
# Filter by tags
tazuna apply -f tazuna.yaml --tags web,batch
# Diff mode: apply only resources that differ from state
tazuna apply -f tazuna.yaml --sync
# Diff mode + deletion of obsolete resources
tazuna apply -f tazuna.yaml --sync --prune
# Diff mode + atomic (roll state back on a mid-run error)
tazuna apply -f tazuna.yaml --sync --atomic
# Stream traces to an OTLP/gRPC endpoint
tazuna apply -f tazuna.yaml --otlp-endpoint=localhost:4317
Migration: replacing the old tazuna state sync
Earlier versions of Tazuna had a separate command, tazuna state sync, responsible for applying the diff between state and the Build result. In this refactor that command has been removed and merged into tazuna apply --sync. The correspondence is as follows.
| Old command | New command |
|---|---|
tazuna state sync | tazuna apply --sync |
TAZUNA_STATE_SYNC_DELETE=true tazuna state sync | tazuna apply --sync --prune |
tazuna state sync --atomic | tazuna apply --sync --atomic |
As a behavioral difference, the new apply saves state even without --sync (the old apply wrote no state at all). As a result, a single apply makes state list / state diff / state drift / plan / status always return meaningful results.
Related
- Evaluated
context_matches - Filter spec:
manifests[].tags - Verify rendering before apply:
tazuna build - For a field-level dry-run diff, see
tazuna plan - For readiness checks after applying, see
tazuna status - For State diffs, see
tazuna state diff/tazuna state drift - Remove existing resources:
tazuna destroy - DAG execution model: DAG Execution via
dependsOn