microsoft / microsoft/aspire

aspire publish produces invalid helm configuration for database secrets

Open
#10,994 4 comments 0 reactions 0 assignees View on GitHub
area-deployment kubernetes
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

The `aspire publish` produces an invalid helm secret when a project references a database resource. The generated Helm secret embeds the database password secret using the project's name instead of the DB service’s name.

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var k8s = builder.AddKubernetesEnvironment("k8s");

var db = builder
.AddPostgres("postgres")
.AddDatabase("exampledb");

builder.AddProject("exampleapp")
.WithReference(db);
```

`secrets.yaml` refers to an invalid secret `.Values.secrets.exampleapp.postgres_password` (note `exampleapp` not `postgres`):
```yaml
...
stringData:
ConnectionStrings__exampledb: "Host=postgres-service;Port=5432;Username=postgres;Password={{ .Values.secrets.exampleapp.postgres_password }};Database=exampledb"
...
```

`values.yaml` (for reference)
```yaml
parameters:
example:
example_image: "example:latest"
secrets:
postgres:
POSTGRES_PASSWORD: ""
...
```

### Expected Behavior

The `aspire publish` command produces a valid secret:

```yaml
...
stringData:
ConnectionStrings__exampledb: "Host=postgres-service;Port=5432;Username=postgres;Password={{ .Values.secrets.postgres.postgres_password }};Database=exampledb"
...
```

### Steps To Reproduce

See steps above

### Exceptions (if any)

_No response_

### .NET Version info

.NET SDK:
Version: 9.0.302
Commit: bb2550b9af
Workload version: 9.0.300-manifests.5c1085e6
MSBuild version: 17.14.13+65391c53b

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.302\

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.