summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-02-26 20:54:57 -0600
committerbaude <bbaude@redhat.com>2019-03-05 14:03:55 -0600
commit598bde52d02eb82634c6b1fa357253f03120a4a0 (patch)
tree08c935792c9e1d57ee00f8db98b3f1a74987f4b6 /libpod/container.go
parent645426fe797f90fc75712388e0373158f13bab0a (diff)
downloadpodman-598bde52d02eb82634c6b1fa357253f03120a4a0.tar.gz
podman-598bde52d02eb82634c6b1fa357253f03120a4a0.tar.bz2
podman-598bde52d02eb82634c6b1fa357253f03120a4a0.zip
podman healthcheck run (phase 1)
Add the ability to manually run a container's healthcheck command. This is only the first phase of implementing the healthcheck. Subsequent pull requests will deal with the exposing the results and history of healthchecks as well as the scheduling. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 75f4a4a4f..2381f53ad 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -10,6 +10,7 @@ import (
"github.com/containernetworking/cni/pkg/types"
cnitypes "github.com/containernetworking/cni/pkg/types/current"
+ "github.com/containers/image/manifest"
"github.com/containers/libpod/libpod/lock"
"github.com/containers/libpod/pkg/namespaces"
"github.com/containers/storage"
@@ -365,6 +366,9 @@ type ContainerConfig struct {
// Systemd tells libpod to setup the container in systemd mode
Systemd bool `json:"systemd"`
+
+ // HealtchCheckConfig has the health check command and related timings
+ HealthCheckConfig *manifest.Schema2HealthConfig
}
// ContainerStatus returns a string representation for users
@@ -1085,3 +1089,14 @@ func (c *Container) ContainerState() (*ContainerState, error) {
deepcopier.Copy(c.state).To(returnConfig)
return c.state, nil
}
+
+// HasHealthCheck returns bool as to whether there is a health check
+// defined for the container
+func (c *Container) HasHealthCheck() bool {
+ return c.config.HealthCheckConfig != nil
+}
+
+// HealthCheckConfig returns the command and timing attributes of the health check
+func (c *Container) HealthCheckConfig() *manifest.Schema2HealthConfig {
+ return c.config.HealthCheckConfig
+}