mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00

Add a new "healthy" sdnotify policy that instructs Podman to send the READY message once the container has turned healthy. Fixes: #6160 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
22 lines
651 B
Go
22 lines
651 B
Go
package define
|
|
|
|
import "fmt"
|
|
|
|
// Strings used for --sdnotify option to podman
|
|
const (
|
|
SdNotifyModeConmon = "conmon"
|
|
SdNotifyModeContainer = "container"
|
|
SdNotifyModeHealthy = "healthy"
|
|
SdNotifyModeIgnore = "ignore"
|
|
)
|
|
|
|
// ValidateSdNotifyMode validates the specified mode.
|
|
func ValidateSdNotifyMode(mode string) error {
|
|
switch mode {
|
|
case "", SdNotifyModeContainer, SdNotifyModeConmon, SdNotifyModeIgnore, SdNotifyModeHealthy:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("%w: invalid sdnotify value %q: must be %s, %s, %s or %s", ErrInvalidArg, mode, SdNotifyModeConmon, SdNotifyModeContainer, SdNotifyModeHealthy, SdNotifyModeIgnore)
|
|
}
|
|
}
|