Is there an existing issue for this?
Describe the bug
When the Kubernetes publisher generates Helm charts and a project resource (e.g. webfrontend) references a secret owned by another resource (e.g. Redis cache password), the generated Helm template references a value path that does not exist in values.yaml, causing helm install to fail with a nil pointer error.
Error:
Error: INSTALLATION FAILED: template: aksredis-apphost/templates/webfrontend/secrets.yaml:11:67:
executing "aksredis-apphost/templates/webfrontend/secrets.yaml"
at <.Values.secrets.webfrontend.cache_password>: nil pointer evaluating interface {}.cache_password
Root Cause
The issue is in AllocateParameter() (KubernetesResource.cs:503). When processing webfrontend's connection string to Redis, it encounters the Redis password ParameterResource. The method creates a Helm expression using TargetResource (the consuming resource — webfrontend) instead of the owning resource (cache):
{{ .Values.secrets.webfrontend.cache_password }} ← generated (WRONG)
{{ .Values.secrets.cache.REDIS_PASSWORD }} ← where the value actually lives
The full flow:
- Redis (cache) is processed → password stored in
values.yaml as secrets.cache.REDIS_PASSWORD: ""
- Webfrontend processes its Redis connection string →
AllocateParameter(param, TargetResource) where TargetResource = webfrontend
- Expression
{{ .Values.secrets.webfrontend.cache_password }} gets embedded in the connection string via string.Format
ProcessEnvironmentStringValue() stores the connection string (with embedded expression) in webfrontend's secrets template
AddValuesToHelmSectionAsync() skips values where ValueContainsHelmExpression == true — so no secrets.webfrontend section is created in values.yaml
- Helm evaluates
{{ .Values.secrets.webfrontend.cache_password }} → secrets.webfrontend is nil → nil pointer error
Impact
This affects any Aspire app that uses container resources with secrets (e.g. Redis with password) and publishes to Kubernetes. The starter template with Redis enabled (aspire new → Yes for Redis) fails to deploy out of the box.
Reproduction
aspire new --name TestApp # Select "Yes" for Redis
cd TestApp.AppHost
# Add Aspire.Hosting.Kubernetes package
aspire publish --publisher kubernetes --output-path ../charts
helm install test ../charts # Fails with nil pointer error
Suggested Fix
AllocateParameter should reference the secret from the owning resource's namespace rather than re-namespacing it under the consuming resource. When a ParameterResource is encountered during cross-resource reference processing, the generated Helm expression should point to where the value actually exists in values.yaml.
Workaround
Provide the missing value manually via --set:
helm install test ../charts --set secrets.webfrontend.cache_password=""
Note: PR #14351 (AKS E2E deployment tests) includes this workaround in AksStarterWithRedisDeploymentTests.cs. When this issue is fixed, that workaround should be removed.
Expected Behavior
The webfrontend Helm template should reference {{ .Values.secrets.cache.REDIS_PASSWORD }} (or equivalent path where the value exists in values.yaml) instead of creating a broken reference under the consuming resource's namespace.
.NET Version info
dotnet --version: 10.0.x
aspire --version: 13.x
Anything else?
Related issues:
Is there an existing issue for this?
Describe the bug
When the Kubernetes publisher generates Helm charts and a project resource (e.g.
webfrontend) references a secret owned by another resource (e.g. Rediscachepassword), the generated Helm template references a value path that does not exist invalues.yaml, causinghelm installto fail with a nil pointer error.Error:
Root Cause
The issue is in
AllocateParameter()(KubernetesResource.cs:503). When processing webfrontend's connection string to Redis, it encounters the Redis passwordParameterResource. The method creates a Helm expression usingTargetResource(the consuming resource — webfrontend) instead of the owning resource (cache):The full flow:
values.yamlassecrets.cache.REDIS_PASSWORD: ""AllocateParameter(param, TargetResource)whereTargetResource= webfrontend{{ .Values.secrets.webfrontend.cache_password }}gets embedded in the connection string viastring.FormatProcessEnvironmentStringValue()stores the connection string (with embedded expression) in webfrontend's secrets templateAddValuesToHelmSectionAsync()skips values whereValueContainsHelmExpression == true— so nosecrets.webfrontendsection is created invalues.yaml{{ .Values.secrets.webfrontend.cache_password }}→secrets.webfrontendis nil → nil pointer errorImpact
This affects any Aspire app that uses container resources with secrets (e.g. Redis with password) and publishes to Kubernetes. The starter template with Redis enabled (
aspire new→ Yes for Redis) fails to deploy out of the box.Reproduction
Suggested Fix
AllocateParametershould reference the secret from the owning resource's namespace rather than re-namespacing it under the consuming resource. When aParameterResourceis encountered during cross-resource reference processing, the generated Helm expression should point to where the value actually exists invalues.yaml.Workaround
Provide the missing value manually via
--set:Note: PR #14351 (AKS E2E deployment tests) includes this workaround in
AksStarterWithRedisDeploymentTests.cs. When this issue is fixed, that workaround should be removed.Expected Behavior
The webfrontend Helm template should reference
{{ .Values.secrets.cache.REDIS_PASSWORD }}(or equivalent path where the value exists invalues.yaml) instead of creating a broken reference under the consuming resource's namespace..NET Version info
Anything else?
Related issues: