Config Maps
By default, this is enabled.
Sync ConfigMap resources that are used by pods from the virtual cluster to the host cluster. Apps frequently need configuration data to function.
Sync only used ConfigMaps from the virtual to host cluster​
Sync any ConfigMap that is used by a Pod synced from the virtual to host cluster.
sync:
toHost:
configMaps:
enabled: true
Sync all ConfigMaps from the virtual to host cluster​
If you have a resource in the host cluster monitoring ConfigMap objects that aren't required by a Pod to run, then you can enable the all
option.
sync:
toHost:
configMaps:
enabled: true
all: true
Translate Patches​
This feature is available in the vCluster Pro tier. Contact us for more details and to start a trial.
You can modify the sync behaviour with translate patches that target specific paths. Currently there is 2 different kinds of patches supported.
You can use *
in paths to select all entries of an array or object, e.g. spec.containers[*].name
or spec.containers[*].volumeMounts[*]
. vCluster will then just call the patch multiple times.
JavaScript Expressions​
These are powerful JavaScript ES6 compatible expressions to change a field while syncing. You can define how it should changed when syncing from the vCluster into the host cluster or when syncing from the host cluster into the virtual cluster. To change the path metadata.annotations[*] you can do:
sync:
toHost:
secrets:
enabled: true
translate:
- path: metadata.annotations[*]
expression: '"my-prefix-"+value'
# optional reverseExpression to reverse the change from the host cluster
# reverseExpression: 'value.slice("my-prefix".length)'
There is also a variable called context
besides value
that can be used to access vCluster specific data:
context.vcluster.name
: Name of the vClustercontext.vcluster.namespace
: Namespace of the vClustercontext.vcluster.config
: Config of the vCluster, basicallyvcluster.yaml
merged with the defaultscontext.hostObject
: Host object (can be null if not available)context.virtualObject
: Virtual object (can be null if not available)context.path
: The matched path on the object, useful when using wildcard path selectors (*)
Reference patches​
Tell vCluster that this specific field points to a different resource that should get rewritten. vCluster will also automatically import the referenced resource if it can find it in the host cluster. For example:
sync:
toHost:
secrets:
enabled: true
translate:
- path: metadata.annotations["my-secret-ref"]
reference:
apiVersion: v1
kind: Secret
This will tell vCluster to translate the path metadata.annotations["my-secret-ref"]
as it points to a secret. If the secret is created in the host cluster, vCluster will automatically import it.
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.
Config reference​
Disabling the syncing of this resource could cause the vCluster to not work properly.
configMaps
required object pro​
ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster.
configMaps
required object pro​enabled
required boolean true pro​
Enabled defines if this option should be enabled.
enabled
required boolean true pro​all
required boolean false pro​
All defines if all resources of that type should get synced or only the necessary ones that are needed.
all
required boolean false pro​translate
required object[] pro​
Translate the patch according to the given patches.
translate
required object[] pro​path
required string pro​
Path is the path within the patch to target. If the path is not found within the patch, the patch is not applied.
path
required string pro​expression
required string pro​
Expression transforms the value according to the given JavaScript expression.
expression
required string pro​reverseExpression
required string pro​
ReverseExpression transforms the value according to the given JavaScript expression.
reverseExpression
required string pro​reference
required object pro​
Reference treats the path value as a reference to another object and will rewrite it based on the chosen mode
automatically. In single-namespace mode this will translate the name to "vxxxxxxxxx" to avoid conflicts with
other names, in multi-namespace mode this will not translate the name.
reference
required object pro​apiVersion
required string pro​
APIVersion is the apiVersion of the referenced object.
apiVersion
required string pro​apiVersionPath
required string pro​
APIVersionPath is optional relative path to use to determine the kind. If APIVersionPath is not found, will fallback to apiVersion.
apiVersionPath
required string pro​kind
required string pro​
Kind is the kind of the referenced object.
kind
required string pro​kindPath
required string pro​
KindPath is the optional relative path to use to determine the kind. If KindPath is not found, will fallback to kind.
kindPath
required string pro​namePath
required string pro​
NamePath is the optional relative path to the reference name within the object.
namePath
required string pro​namespacePath
required string pro​
NamespacePath is the optional relative path to the reference namespace within the object. If omitted or not found, namespacePath equals to the
metadata.namespace path of the object.
namespacePath
required string pro​labels
required object pro​
Labels treats the path value as a labels selector.
labels
required object pro​