Skip to content
DocsTry Aspire
DocsTry

K3sHelmBuilderExtensions Methods

ClassMethods3 members
Extension methods for adding Helm release resources to a k3s cluster.
AddHelmRelease(IResourceBuilder<K3sClusterResource>, string, string, string?, string?, string)Section titled AddHelmRelease(IResourceBuilder<K3sClusterResource>, string, string, string?, string?, string)extensionIResourceBuilder<HelmReleaseResource>
Installs a Helm chart into the k3s cluster.
public static class K3sHelmBuilderExtensions
{
public static IResourceBuilder<HelmReleaseResource> AddHelmRelease(
this IResourceBuilder<K3sClusterResource> builder,
string name,
string chart,
string? repo = null,
string? version = null,
string @namespace = "default")
{
// ...
}
}
builderIResourceBuilder<K3sClusterResource>The k3s cluster resource builder.
namestring The Aspire resource name; also used as the Helm release name passed to helm upgrade --install.
chartstring The chart name, e.g. argo-cd for a repo chart or oci://registry/chart for an OCI reference. Provide repo when using a named repo chart.
repostring?optional Optional Helm repository URL, e.g. https://argoproj.github.io/argo-helm. When provided, the repo is added and updated before installation.
versionstring?optional Optional chart version to pin, e.g. 7.8.0. When null the latest version available in the repository is installed.
namespacestringoptional The Kubernetes namespace to install the release into. The namespace is created automatically if it does not exist. Defaults to default.
IResourceBuilder<HelmReleaseResource>A builder for the HelmReleaseResource.
ArgumentNullExceptionbuilder, name, or chart is null.

The release runs as an alpine/helm container on the DCP network. No host-side helm binary is required. The container exits with code 0 when the release is fully installed and all workloads are ready. Use WaitForCompletion(helmRelease) on resources that must start only after the chart is ready.

Customize the release with K3sHelmBuilderExtensions.WithHelmValue for individual key/value pairs or K3sHelmBuilderExtensions.WithHelmValuesFile to supply a full YAML values file.

WithHelmValue(IResourceBuilder<HelmReleaseResource>, string, string)Section titled WithHelmValue(IResourceBuilder<HelmReleaseResource>, string, string)extensionIResourceBuilder<HelmReleaseResource>
Adds a Helm --set key=value override to the release.
public static class K3sHelmBuilderExtensions
{
public static IResourceBuilder<HelmReleaseResource> WithHelmValue(
this IResourceBuilder<HelmReleaseResource> builder,
string key,
string value)
{
// ...
}
}
builderIResourceBuilder<HelmReleaseResource>The Helm release resource builder.
keystring The Helm value path using dot notation, e.g. server.service.type. If the same key is set more than once, the last call wins.
valuestringThe value to assign.
IResourceBuilder<HelmReleaseResource>The same builder, for chaining.
ArgumentNullExceptionbuilder, key, or value is null.
Helm --set metacharacters ( ,, {, }, \) in key or value are automatically escaped. For values that contain these characters in ways Helm cannot represent safely, use K3sHelmBuilderExtensions.WithHelmValuesFile instead.
WithHelmValuesFile(IResourceBuilder<HelmReleaseResource>, string)Section titled WithHelmValuesFile(IResourceBuilder<HelmReleaseResource>, string)extensionIResourceBuilder<HelmReleaseResource>
Supplies a YAML values file to the Helm release ( --values).
public static class K3sHelmBuilderExtensions
{
public static IResourceBuilder<HelmReleaseResource> WithHelmValuesFile(
this IResourceBuilder<HelmReleaseResource> builder,
string path)
{
// ...
}
}
builderIResourceBuilder<HelmReleaseResource>The Helm release resource builder.
pathstring Path to the YAML values file on the host. Relative paths are resolved against the AppHost project directory. Call this method multiple times to supply additional files; they are applied in declaration order and later files win for duplicate keys.
IResourceBuilder<HelmReleaseResource>The same builder, for chaining.
ArgumentNullExceptionbuilder is null.
ArgumentExceptionpath is null or whitespace.
Use this method for structured overrides — particularly values containing commas, braces, or backslashes that cannot be safely expressed with K3sHelmBuilderExtensions.WithHelmValue. Values files are applied before --set flags, so K3sHelmBuilderExtensions.WithHelmValue always takes precedence.