Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete temp files when no longer needed #7029

Open
eerhardt opened this issue Jan 6, 2025 · 0 comments
Open

Delete temp files when no longer needed #7029

eerhardt opened this issue Jan 6, 2025 · 0 comments
Labels
area-orchestrator untriaged New issue has not been triaged

Comments

@eerhardt
Copy link
Member

eerhardt commented Jan 6, 2025

Today, we generate temporary files and bind mount them to local containers. This allows Aspire to configure the container. However, these temporary files never get deleted.

For example:

.WithBindMount(Path.GetTempFileName(), "/pgadmin4/servers.json")
.WithHttpHealthCheck("/browser")
.ExcludeFromManifest();
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var serverFileMount = pgAdminContainer.Annotations.OfType<ContainerMountAnnotation>().Single(v => v.Target == "/pgadmin4/servers.json");
var postgresInstances = builder.ApplicationBuilder.Resources.OfType<PostgresServerResource>();
var serverFileBuilder = new StringBuilder();
using var stream = new FileStream(serverFileMount.Source!, FileMode.Create);
using var writer = new Utf8JsonWriter(stream);

We should have a service for doing this that gets cleaned up on exit. @karolz-ms says:

I can imagine us having the capability for Containers where you can say "here is a blob of JSON that I need to appear as file inside the container, under this path". Sort of like Kubernetes ConfigMaps.

@joperezr joperezr added the untriaged New issue has not been triaged label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-orchestrator untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

3 participants