Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document ytt overlay/insert via #553

Merged
merged 1 commit into from Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 21 additions & 1 deletion site/content/ytt/docs/develop/lang-ref-ytt-overlay.md
Expand Up @@ -403,7 +403,7 @@ See also:

### @overlay/insert

Inserts "right" node before/after the matched "left" node.
Inserts "right" node before/after the matched "left" node. The inserted node is either the "right" node or that provided by a function.

**Valid on:** Document, Array Item.

Expand All @@ -412,6 +412,26 @@ Inserts "right" node before/after the matched "left" node.
```
- **`before=`**`Bool` whether to insert the "right" node immediately in front of the matched "left" node.
- **`after=`**`Bool` whether to insert the "right" node immediately following the matched "left" node.
- **`via=`**`Function(left, right): (any)` _(optional)_ determines the value to substitute in. If omitted, the value is `right`.
- `left` ([`yamlfragment`](lang-ref-yaml-fragment.md) or scalar) — the matched node's value
- `right` ([`yamlfragment`](lang-ref-yaml-fragment.md) or scalar) — the value of the annotated node

**Examples:**

Add a `ConfigMap` into each `Namespace`:
```yaml
#@ def configMap(namespace):
apiVersion: v1
kind: ConfigMap
metadata:
name: insert
namespace: #@ namespace.metadata.name
#@ end

#@overlay/match overlay.subset({"kind": "Namespace"})
#@overlay/insert after=True, via=lambda namespace, _: configMap(namespace)
---
```

### @overlay/append

Expand Down