Skip to content

Commit d660def

Browse files
committed
update docs
On-behalf-of: @SAP [email protected]
1 parent 85ac771 commit d660def

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

docs/content/publish-resources/index.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,23 @@ existing" and not create an error.
303303

304304
#### References
305305

306-
A reference is a JSONPath-like expression that are evaluated on both sides of the synchronization.
307-
You configure a single path expression (like `spec.secretName`) and the sync agent will evaluate it
308-
in the original primary object (in kcp) and again in the copied primary object (on the service
309-
cluster). Since the primary object has already been mutated, the `spec.secretName` is already
310-
rewritten/adjusted to work on the service cluster (for example it was changed from `my-secret` to
311-
`jk23h4wz47329rz2r72r92-secret` on the service cluster side). By doing it this way, admins only have
312-
to think about mutations and rewrites once (when configuring the primary object in the
313-
PublishedResource) and the path will yield 2 ready to use values (`my-secret` and the computed value).
314-
315-
The value selected by the path expression must be a string (or number, but it will be coalesced into
316-
a string) and can then be further adjusted by applying a regular expression to it.
317-
318-
References can only ever select one related object. Their upside is that they are simple to understand
319-
and easy to use, but require a "link" in the primary object that would point to the related object.
306+
A reference is a JSONPath-like expression (more precisely, it follows the [gjson syntax](https://github.com/tidwall/gjson?tab=readme-ov-file#path-syntax))
307+
that are evaluated on both sides of the synchronization. You configure a single path expression
308+
(like `spec.secretName`) and the sync agent will evaluate it in the original primary object (in kcp)
309+
and again in the copied primary object (on the service cluster). Since the primary object has already
310+
been mutated, the `spec.secretName` is already rewritten/adjusted to work on the service cluster
311+
(for example it was changed from `my-secret` to `jk23h4wz47329rz2r72r92-secret` on the service
312+
cluster side). By doing it this way, admins only have to think about mutations and rewrites once
313+
(when configuring the primary object in the PublishedResource) and the path will yield 2 ready to
314+
use values (`my-secret` and the computed value).
315+
316+
References can either return a single scalar (strings or integers that will be auto-converted to a
317+
string) (like in `spec.secretName`) or a list of strings/numbers (like `spec.users.#.name`). A
318+
reference must return the same number of items on both the local and remote object, otherwise the
319+
agent will not be able to map local related names to remote related names correctly.
320+
321+
A regular expression can be configured to be applied to each found value (i.e. if the reference returns
322+
a list of values, the regular expression is applied to each individual value).
320323

321324
Here's an example on how to use references to locate the related object.
322325

0 commit comments

Comments
 (0)