Template Functions for Embedded Cluster (Beta)
This topic lists the Replicated template functions for Embedded Cluster. For more imformation about how to use Replicated template functions, including a list of all available template functions, see About Template Functions.
HelmValue
func HelmValue(path string) string
Returns the value from the chart's values.yaml at the given dotted path. Use this to read the chart's default image values and pass them to the ReplicatedImageName or ReplicatedImageRegistry template functions.
Examples
Return a top-level value
# HelmChart custom resource
values:
initImage: '{{repl ReplicatedImageName (HelmValue ".initImage") true }}'
Return a value from a subchart
# HelmChart custom resource
values:
my-subchart:
image:
registry: '{{repl ReplicatedImageRegistry (HelmValue ".my-subchart.image.registry") }}'
ReplicatedImageName
func ReplicatedImageName(image string, noProxy ...bool) string
Returns a full image reference, including the registry, repository, and any tags.
Use this when a chart expects the entire image reference in a single field.
Parameters
image
The image reference to rewrite.
Use the HelmValue function to return the value from the chart's values.yaml at the given dotted path.
noProxy
The following table describes the value returned by ReplicatedImageName in online or air gap installations, when the noProxy field is omitted or set to true:
| Install type | noProxy | Result |
|---|---|---|
| Online | Omitted | Returns the proxy registry URL for the image in the format: proxy.replicated.com/proxy/<app-slug>/<image> (or your custom domain). Images already using the proxy domain are returned unchanged. |
| Online | true | Returns the image reference with no changes |
| Air gap | true or omitted | Returns the location of the image at the local image registry in the format: <local-registry>/<repo-path>:<tag> |
Examples
Public image (noProxy)
# HelmChart custom resource
values:
publicImage: '{{repl ReplicatedImageName (HelmValue ".publicImage") true }}'
Private image
# HelmChart custom resource
apiVersion: kots.io/v1beta2
kind: HelmChart
spec:
values:
initImage: '{{repl ReplicatedImageName (HelmValue ".initImage") }}'
ReplicatedImageRegistry
func ReplicatedImageRegistry(registry string, noProxy ...bool) string
Returns the registry host with the proxy path included.
Use this when the image reference in the Helm chart uses separate registry and repository fields. Only the registry field needs to be templated — the repository passes through from values.yaml unchanged.
Parameters
registry
The registry host to rewrite (for example, ghcr.io or docker.io).
Use the HelmValue function to return the value from the chart's values.yaml at the given dotted path.
noProxy
The following table describes the value returned by ReplicatedImageRegistry in online or air gap installations when the noProxy field is omitted or set to true:
| Install type | noProxy | Result |
|---|---|---|
| Online | Omitted | Returns the proxy registry path in the format: proxy.replicated.com/proxy/<app-slug>/<registry> (or your custom domain). Registries already using the proxy domain are returned unchanged. |
| Online | true | Returns the registry value with no changes |
| Air gap | true or omitted | Returns the local registry address |
Examples
Rewrite image references using HelmValues
# HelmChart custom resource
apiVersion: kots.io/v1beta2
kind: HelmChart
spec:
values:
image:
registry: '{{repl ReplicatedImageRegistry (HelmValue ".image.registry") }}'
The repository field does not need to be templated. It passes through from the chart's values.yaml unchanged.
Rewrite upstream image references for third-party Helm extensions
# Embedded Cluster Config
extensions:
helmCharts:
- chart:
name: ingress-nginx
chartVersion: "4.11.3"
releaseName: ingress-nginx
namespace: ingress-nginx
values: |
controller:
image:
registry: 'repl{{ ReplicatedImageRegistry "registry.k8s.io" }}'