Bug 2130912

Summary: [RFE]Podman support to perform custom actions on unhealthy containers [rhel-8.6.0.z]
Product: Red Hat Enterprise Linux 8 Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: Alex Jia <ajia>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.6CC: bbaude, dornelas, dwalsh, dwojewod, gnecasov, jligon, jnovy, jwboyer, lsm5, mheon, pthomas, snanda, toneata, tsweeney, umohnani, vrothber, wwurzbac, ypu
Target Milestone: rcKeywords: FutureFeature, Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: podman-4.1.1-7.el8 Doc Type: Enhancement
Doc Text:
.Podman now supports the `--health-on-failure` option With the release of the link:https://access.redhat.com/errata/RHBA-2022:7127[RHBA-2022:7127] advisory. the `podman run` and `podman create` commands now support the `--health-on-failure` option to determine the actions to be performed when the status of a container becomes unhealthy. The `--health-on-failure` option supports four actions: * `none`: Take no action, this is the default action. * `kill`: Kill the container. * `restart`: Restart the container. * `stop`: Stop the container. NOTE: Do not combine the `restart` action with the `--restart` option. When running inside of a systemd unit, consider using the `kill` or `stop` action instead to make use of systemd's restart policy.
Story Points: ---
Clone Of: 2097708 Environment:
Last Closed: 2022-10-25 09:33:30 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2097708, 2131741    
Bug Blocks:    

Comment 1 Tom Sweeney 2022-09-29 21:08:39 UTC
Assigning to @jnovy for any further packaging or BZ needs.  Fix in Podman v4.1. branch at: https://github.com/containers/podman/pull/15961

Comment 7 Tom Sweeney 2022-10-11 17:58:57 UTC
And as mentioned in email, Valentin has a fix for a related issue with the changes to the healthcheck.  That PR has just merged to the Podman v4.1.1-rhel branch at: https://github.com/containers/podman/pull/16115

Setting this BZ back to Post so that Jindrich can tie up any further packaging and BZ needs.

Comment 10 Alex Jia 2022-10-13 08:27:07 UTC
This bug has been verified on podman-4.1.1-7.module+el8.6.0+16889+9f154fa9.x86_64.


[root@ibm-x3250m6-06 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 (Ootpa)

[root@ibm-x3250m6-06 ~]# rpm -q podman runc expat systemd kernel
podman-4.1.1-7.module+el8.6.0+16889+9f154fa9.x86_64
runc-1.1.3-2.module+el8.6.0+16771+28dfca77.x86_64
expat-2.2.5-8.el8_6.3.x86_64
systemd-239-58.el8_6.8.x86_64
kernel-4.18.0-372.32.1.el8_6.x86_64

[root@ibm-x3250m6-06 podman]# git branch
  main
* v4.1.1-rhel

[root@ibm-x3250m6-06 podman]# bats -t test/system/220-healthcheck.bats
1..2
ok 1 podman healthcheck
ok 2 podman healthcheck --health-on-failure

[root@ibm-x3250m6-06 podman]# bats -t -f "podman create --health-on-failure=kill" test/system/250-systemd.bats
1..1
ok 1 podman create --health-on-failure=kill

Comment 14 errata-xmlrpc 2022-10-25 09:33:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (container-tools:rhel8 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7127