Modifiers
includeWhen, readyWhen, and forEach are the same fields, with the same
meaning, in a Graph node and an RGD resource. Their full semantics are
documented once, under Reconciliation.
This page covers only what is specific to Graphs.
Support by Node Kind
template | ref | def | patch | graph | |
|---|---|---|---|---|---|
includeWhen | Yes | Yes | Yes | Yes | No |
readyWhen | Yes | Yes | Yes | No | No |
forEach | Yes | No | Yes | Yes | No |
A Graph that uses a modifier on a node kind that does not support it is rejected
when it is compiled, with Accepted=False.
graphnodes accept no modifiers. Apply them to the nodes inside the nested Graph instead.refnodes rejectforEach. To read many resources, use aselectorin theref; the node's value is then a list.patchnodes acceptforEach, which fans the same contribution out to one target per iteration. Every iterator must appear inmetadata.nameormetadata.namespaceso each target is distinct.patchnodes rejectreadyWhen. A patch contributes fields to its target and publishes no value into scope, so there is nothing forreadyWhento evaluate. To wait on the target's state, add arefnode for the target and putreadyWhenon that.
No schema Variable
An RGD's modifiers usually reference the instance spec (${schema.spec.enabled}).
A Graph has no instance and no schema variable. Conditions and iterators
reference other nodes: a ref that reads cluster state, a def that computes a
value, or a template that has already been applied.
nodes:
- id: namespaces
ref:
apiVersion: v1
kind: Namespace
metadata:
selector:
matchLabels:
policy: enforced
- id: policies
forEach:
- ns: ${namespaces}
includeWhen:
- ${size(namespaces) > 0}
readyWhen:
- ${each.metadata.name != ""}
template:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny
namespace: ${ns.metadata.name}
spec:
podSelector: {}
policyTypes: [Ingress, Egress]readyWhen Does Not Gate Dependents
In a Graph, readyWhen reports a node's health into the Graph's
ResourcesConverged and Ready conditions. It does not delay nodes that depend
on it; a dependent is applied as soon as the fields it references exist. This is
the one behavioral difference from an RGD, and it is explained in
Readiness.
Next Steps
- Conditional Creation -
includeWhensemantics - Readiness -
readyWhensemantics and the RGD/Graph difference - Collections -
forEachsemantics, identity rules, and limits - Nodes - The node kinds these modifiers attach to