-
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
Add --restart flag to pod create #17627
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: umohnani8 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
07aee26
to
02af86a
Compare
After a quick skim, looks good in general. Test aren't at all happy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are to follow how kubernetes does restarts for pods, it doesn't restart the whole pod based on the policy, the containers in the pod are what is restarted. So when we set the restart policy for a pod, we are setting the restart policy for all the containers in the pod and a container in the pod cannot have a different policy set for it. If the whole pod needs to be restarted, k8s removes the pod and creates a new one in place of it and that is a whole different thing that happens when using Deployments or Jobs or when the user deletes the pod and the policy was set to Always. The design doc outlined the object of --restart for pod to apply it to the containers and have the containers restart based on the policy and there were no objections on that. We can continue the discussions in the design doc if needed. |
I personally don't mind K8s in this context as it's outside of
OK, let's do that 👍 I misinterpreted the part in the doc w.r.t "apply it to all containers". If the pod gets restarted it affects all its containers in a way. |
458b5b7
to
b888479
Compare
2339656
to
f002086
Compare
Once this is in, I will create a follow up PR for kube gen and play to start using the pod restart policy. |
@edsantiago @mheon is there a way for me to not list |
/me groans in agony. @Luap99 you might be able to answer that more concisely and accurately than anything I could do. |
The reason this shows up is because it simply speaking a valid go template option. As soon a s you add a public field or function to a type it will be included in the shell completion which the validate script compare against. For now the simple solution is to just rename the field from |
f13a343
to
dea64df
Compare
a190a99
to
2569859
Compare
d1d49ed
to
1f0b641
Compare
Tests are green, @containers/podman-maintainers PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the final nits
Add --restart flag to pod create to allow users to set the restart policy for the pod, which applies to all the containers in the pod. This reuses the restart policy already there for containers and has the same restart policy options. Add "never" to the restart policy options to match k8s syntax. It is a synonym for "no" and does the exact same thing where the containers are not restarted once exited. Only the containers that have exited will be restarted based on the restart policy, running containers will not be restarted when an exited container is restarted in the same pod (same as is done in k8s). Signed-off-by: Urvashi Mohnani <[email protected]>
Add Restarts column to the podman ps output to show how many times a container was restarted based on its restart policy. This column will be displayed when --format={{.Restarts}}. Signed-off-by: Urvashi Mohnani <[email protected]>
Add Restarts column to the podman pod ps output to show the total number of times the containers in a pod were restarted. This is the same as the restarts column displayed by kubernetes with kubectl get pods. This will only be displayed when --format={{.Restarts}}. Signed-off-by: Urvashi Mohnani <[email protected]>
Podman kube generate now uses the pod's restart policy when generating the kube yaml. If generating from containers only, use the restart policy of the first non-init container. Podman kube play applies the pod restart policy from the yaml file to the pod. The containers within a pod inherit this restart policy. Signed-off-by: Urvashi Mohnani <[email protected]>
/lgtm |
Add --restart flag to pod create to allow users to set the restart policy for the pod, which applies to all the containers in the pod. This reuses the restart policy already there for containers and has the same restart policy options. Add "never" to the restart policy options to match k8s syntax. It is a synonym for "no" and does the exact same thing where the containers are not restarted once exited.
Only the containers that have exited will be restarted based on the restart policy, running containers will not be restarted when an exited container is restarted in the same pod (same as is done in k8s).
Add Restarts column to the podman ps and podman pod ps output to show how many times a
container was restarted based on its restart policy when --format={{.Restarts}}.
Signed-off-by: Urvashi Mohnani [email protected]
Does this PR introduce a user-facing change?