Skip to main content

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. For more information, see Add support for air gap installations in Configure Embedded Cluster.

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 typenoProxyResult
OnlineOmittedReturns the proxy registry URL for the image in the format: <proxy-registry-domain>/proxy/<app-slug>/<image>. The proxy registry domain is either proxy.replicated.com or your custom domain. If the image is already using the proxy registry URL, then ReplicatedImageName returns the image value unchanged.
OnlinetrueReturns the image reference with no changes
Air gaptrue or omittedReturns 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 Replicated proxy registry path included. The proxy registry path has this format: proxy.replicated.com/proxy/<app-slug>/<registry>.

Use this when the image reference in the Helm chart uses separate registry and repository fields. For more information, see Add support for air gap installations in Configure Embedded Cluster.

note

You do not need to template the repository field. When you template the registry field, ReplicatedImageRegistry returns the full proxy registry path required to pull the image through the proxy registry.

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 typenoProxyResult
OnlineOmittedReturns the proxy registry path in the format: <proxy-registry-domain>/proxy/<app-slug>/<image>. The proxy registry domain is either proxy.replicated.com or your custom domain. If the registry is already using the proxy registry URL, then ReplicatedImageRegistry returns the registry value unchanged.
OnlinetrueReturns the registry value with no changes
Air gaptrue or omittedReturns 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") }}'

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" }}'