package restart
import "github.com/containerd/containerd/runtime/restart"
Package restart enables containers to have labels added and monitored to keep the container's task running if it is killed.
Setting the StatusLabel on a container instructs the restart monitor to keep that container's task in a specific status. Setting the LogPathLabel on a container will setup the task's IO to be redirected to a log file when running a task within the restart manager.
The restart labels can be cleared off of a container using the WithNoRestarts Opt.
The restart monitor has one option in the containerd config under the [plugins.restart] section. `interval = "10s" sets the reconcile interval that the restart monitor checks for task state and reconciles the desired status for that task.
Index ¶
- Constants
- func WithBinaryLogURI(binary string, args map[string]string) func(context.Context, *containerd.Client, *containers.Container) error
- func WithFileLogURI(path string) func(context.Context, *containerd.Client, *containers.Container) error
- func WithLogPath(path string) func(context.Context, *containerd.Client, *containers.Container) error
- func WithLogURI(uri *url.URL) func(context.Context, *containerd.Client, *containers.Container) error
- func WithLogURIString(uriString string) func(context.Context, *containerd.Client, *containers.Container) error
- func WithNoRestarts(_ context.Context, _ *containerd.Client, c *containers.Container) error
- func WithStatus(status containerd.ProcessStatus) func(context.Context, *containerd.Client, *containers.Container) error
Constants ¶
const ( // StatusLabel sets the restart status label for a container StatusLabel = "containerd.io/restart.status" // LogURILabel sets the restart log uri label for a container LogURILabel = "containerd.io/restart.loguri" // LogPathLabel sets the restart log path label for a container // // Deprecated(in release 1.5): use LogURILabel LogPathLabel = "containerd.io/restart.logpath" )
Functions ¶
func WithBinaryLogURI ¶
func WithBinaryLogURI(binary string, args map[string]string) func(context.Context, *containerd.Client, *containers.Container) error
WithBinaryLogURI sets the binary-type log uri for a container.
Deprecated(in release 1.5): use WithLogURI
func WithFileLogURI ¶
func WithFileLogURI(path string) func(context.Context, *containerd.Client, *containers.Container) error
WithFileLogURI sets the file-type log uri for a container.
Deprecated(in release 1.5): use WithLogURI
func WithLogPath ¶
func WithLogPath(path string) func(context.Context, *containerd.Client, *containers.Container) error
WithLogPath sets the log path for a container
Deprecated(in release 1.5): use WithLogURI with "file://<path>" URI.
func WithLogURI ¶
func WithLogURI(uri *url.URL) func(context.Context, *containerd.Client, *containers.Container) error
WithLogURI sets the specified log uri for a container.
func WithLogURIString ¶
func WithLogURIString(uriString string) func(context.Context, *containerd.Client, *containers.Container) error
WithLogURIString sets the specified log uri string for a container.
func WithNoRestarts ¶
func WithNoRestarts(_ context.Context, _ *containerd.Client, c *containers.Container) error
WithNoRestarts clears any restart information from the container
func WithStatus ¶
func WithStatus(status containerd.ProcessStatus) func(context.Context, *containerd.Client, *containers.Container) error
WithStatus sets the status for a container
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
runtime/restart/monitor |
- Version
- v1.6.33
- Published
- Jun 5, 2024
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 4 minutes ago –
Tools for package owners.