Open urumo opened 1 month ago
Thoughts @mitchdenny @DamianEdwards @karolz-ms ?
I think it would be good to have this. I'm not sure about IResourceWithRestartPolicy vs just having an annotation.
I'm assuming this is intended to be run mode only? I still have some concern over the proliferation of "unbounded" With
methods where it isn't clear what they apply to, e.g. WithRestartPolicy
vs. RunWithRestartPolicy
.
If we are talking about local run only, one can work around the lack of restart support today by using WithContainerRunArgs()
and --restart
Docker option (which Podman also supports).
Going forward I think we should revisit this once we have health checks in place. "Restart when unhealthy" (after some time, after health probe(s) fail N times) seems more useful than any existing Docker/Podman restart mode.
I also have a concern about target environment (local run, vs Azure Container Apps, vs vanilla Kubernetes, vs...) supporting different functionality for automatic restarts. If we decide to add a restart notion to the app model, I'd love it to be applicable not just to local run, but to deployment environments too, but we need to be able to account for different level of restart support between them.
Background and Motivation
I have a containerised go application which connects to a websocket service and because of that might fail every once in a while, this is why I need an option to specify the restart policy for any and all containers in the project.
Proposed API
IResourceBuilder<ContainerResource>.WithRestart(RestartPolicy)
Usage Examples
Risks
The container might end up in a restart loop if the it is faulty and will need to be killed from the shell.
Implementation
A draft PR with implementation is #5001