microsoft / microsoft/aspire

Add support for fileKeyRef to the Kubernetes Publisher

Open
#19,756 1 comment 0 reactions 0 assignees View on GitHub
area-deployment needs-area-label triage:bot-seen
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

### Is your feature request related to a problem? Please describe the problem.

It's sometimes necessary to derive environment variables from a sidecar or init container. For example, Vault Agent Injector can write files to disk when pods start up that contain secrets from the cluster's Vault instance. Some of those secrets are useful when setting environment variables (for instance, `PostgresServerResource` has `POSTGRES_USER` and `POSTGRES_PASSWORD` environment variables that configure the container _prior to spinning up_).

Current workarounds exist like overriding the `Workload.PodTemplate.Spec.Container[].Command`, to source the injected file and then run the container as normal. However manual work is then needed to determine the image's original entrypoint.

### Describe the solution you'd like

Kubernetes v1.34 introduced a method of injecting environment variables by having an init container write secrets to a shared file, and then having the primary container source the file via a `fileKeyRef`. https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/

It would be great to see `fileKeyRef` added to the `EnvVarSourceV1` object as a means of natively supporting this use-case through Aspire.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Kubernetes fileKeyRef documentation linked in the issue, then locate the Kubernetes Publisher's EnvVarSourceV1 object. Add support for representing fileKeyRef and verify that the publisher emits the expected Kubernetes environment-variable configuration for this use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, kubernetes
Domain
infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.