You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/publish-resources/index.md
+7-331Lines changed: 7 additions & 331 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ usually originate on the service cluster and could be for example connection det
35
35
by Crossplane, but could also originate in the user workspace and just be additional, auxiliary
36
36
resources that need to be synced down to the service cluster.
37
37
38
-
###`PublishedResource`
38
+
## `PublishedResource`
39
39
40
40
In its simplest form (which is rarely practical) a `PublishedResource` looks like this:
41
41
@@ -287,333 +287,7 @@ resource represents usually one, but can be multiple objects to synchronize betw
287
287
and service cluster. While the main published resource sync is always workspace->service cluster,
288
288
related resources can originate on either side and so either can work as the source of truth.
289
289
290
-
At the moment, only `ConfigMaps` and `Secrets` are allowed related resource kinds.
291
-
292
-
For each related resource, the Sync Agent needs to be told how to find the object on the origin side
293
-
and where to create it on the destination side. There are multiple options that you can choose from.
294
-
295
-
By default all related objects live in the same namespace as the primary object (their owner/parent).
296
-
If the primary object is cluster scoped, admins must configure additional rules to specify what
297
-
namespace the ConfigMap/Secret shall be read from and created in.
298
-
299
-
Related resources are always optional. Even if references (see below) are used and their path
300
-
expression points to a non-existing field in the primary object (e.g. `spec.secretName` is configured,
301
-
but that field does not exist in Certificate object), this will simply be treated as "not _yet_
302
-
existing" and not create an error.
303
-
304
-
#### References
305
-
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).
323
-
324
-
Here's an example on how to use references to locate the related object.
325
-
326
-
{% raw %}
327
-
```yaml
328
-
apiVersion: syncagent.kcp.io/v1alpha1
329
-
kind: PublishedResource
330
-
metadata:
331
-
name: publish-certmanager-certs
332
-
spec:
333
-
resource:
334
-
kind: Certificate
335
-
apiGroup: cert-manager.io
336
-
versions: [v1]
337
-
338
-
naming:
339
-
# this is where our CA and Issuer live in this example
340
-
namespace: kube-system
341
-
# need to adjust it to prevent collisions (normally clustername is the namespace)
0 commit comments