-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow to specify init container type when using play kube #14877
Comments
I think it should follow the kubernetes behaviour. |
I agree, we should follow k8s behavior for type and restarts. We can add a flag I can work on this. |
@umohnani8 can you elaborate on why we need a flag? If specified in the YAML, I'd expect |
Agreed. I think if anything this option should be managable on a per init container basis, not globally. But I don't see an obvious way of doing this based on K8s Container definition. Perhaps a label on the pod spec but that seems like a lot. |
I agree no reason for a flag, we should work like Kubernetes does with init containers. |
Kuberentes doesn't have a field to set the type of init container in the yaml, there is no If we want to give the user the choice to decided if they want the init containers to be |
That sounds like a good first step.
A label/annotation sounds good. We do that for a number of Podman-specific features already and I see beauty in all these things being part of the YAML such that it works everywhere the same way. |
In my opinion the init container type "always" was the correct default. Excerpt from the Kubernetes documentation:
Excerpt from the podman-create documentation:
Although "always" does not replicate the Kubernetes init container behavior 100% because Podman init containers are not run when the pod is restarted, in my opinion it is more correct because the init container should run when a stopped pod is started. |
@Syquel I believe the issue that was fixed is that the initContainer kept restarting even when it ran successfully (without the pod restarting that is), which is not the correct behaviour compared to Kubernetes. If the issue is that restarting the pod doesn't rerun the initContainer, that's a different issue, and you should raise that as a separate issue for it to be triaged. |
/kind feature
Description
It seems init container type (
podman create ... --init-ctr=type
) cannot be specified in the kubernetes manifest when using play kube (see https://github.com/containers/podman/blob/main/pkg/domain/infra/abi/play.go#L516).This also doesn't match Kubernetes' default initContainers behaviour, which is closer to setting the type to
once
. In addition, when an init container fails, it repeatedly restarts the init container until it passes. The exception to this is when the pod'srestartPolicy
is set toNever
, in which case on failure, the overall pod is failed.It would be nice to either change the behaviour of this to be closer to Kubernetes, or allow for this to be changed so an init container can be set to run once within a manifest.
The text was updated successfully, but these errors were encountered: