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: vcluster/_fragments/patches.mdx
+4-4
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ When using the asterisk (`*`) notation, vCluster applies changes individually to
25
25
A JavaScript expression patch allows you to use JavaScript ES6 expressions to change specific fields when syncing between virtual and host clusters.
26
26
This is useful when modifying resource configurations to align with differing environments or naming conventions between clusters. If your clusters use different container name prefixes, a JavaScript expression patch can automatically update them.
27
27
28
-
You can define a path for <code>{`<span>${props.path}</span>`}</code> field in `vcluster.yaml` using the following configuration:
28
+
You can define a path for <code>{props.path}</code> field in `vcluster.yaml` using the following configuration:
29
29
30
30
<CodeBlocklanguage="yaml">
31
31
{`sync:
@@ -41,8 +41,8 @@ You can define a path for <code>{`<span>${props.path}</span>`}</code> field in `
41
41
42
42
In the example:
43
43
44
-
- The path targets the <code>{`<span>${props.path}</span>`}</code> field to override when syncing to the host cluster. The `*` wildcard applies the patch to each container individually.
45
-
-`"'my-prefix-' + value"` defines a JavaScript expression that prepends `"my-prefix-"` to the <code>{`<span>${props.path}</span>`}</code> field in the host cluster.
44
+
- The path targets the <code>{props.path}</code> field to override when syncing to the host cluster. The `*` wildcard applies the patch to each container individually.
45
+
-`"'my-prefix-' + value"` defines a JavaScript expression that prepends `"my-prefix-"` to the <code>{props.path}</code> field in the host cluster.
46
46
47
47
:::note Reverse sync
48
48
You can use the `reverseExpression` field to define how to revert changes when syncing from the host cluster back to the virtual cluster.
@@ -87,7 +87,7 @@ You can sync between the virtual cluster and the host cluster by mapping `spec.s
87
87
In the example:
88
88
89
89
- The code uses a patch to add `metadata.annotations["my-secret-ref"]`
90
-
- It references a `Secret` in the host cluster using the patch and ensures <code>{`<span>${props.resource}</span>`}</code> in the host cluster links to the correct `Secret`.
90
+
- It references a `Secret` in the host cluster using the patch and ensures <code>{props.resource}</code> in the host cluster links to the correct `Secret`.
91
91
92
92
:::info Multi namespace mode
93
93
With multi-namespace mode you only need to rewrite references that include a namespace. You can use the `namespacePath` option to specify the path of the namespace of the reference.
0 commit comments