mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
Monitor-only for individual containers (#652)
* Add monitor-only label * Add tests for monitor-only * Treat missing monitor-only label as if the option was set to false * Add docs for container-based monitor-only * Add function doc * Fix monitor-only logic
This commit is contained in:
parent
98b518612b
commit
bde421be0d
7 changed files with 147 additions and 10 deletions
|
@ -90,6 +90,22 @@ func (c Container) Enabled() (bool, bool) {
|
|||
return parsedBool, true
|
||||
}
|
||||
|
||||
// IsMonitorOnly returns the value of the monitor-only label. If the label
|
||||
// is not set then false is returned.
|
||||
func (c Container) IsMonitorOnly() bool {
|
||||
rawBool, ok := c.getLabelValue(monitorOnlyLabel)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
parsedBool, err := strconv.ParseBool(rawBool)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return parsedBool
|
||||
}
|
||||
|
||||
// Scope returns the value of the scope UID label and if the label
|
||||
// was set.
|
||||
func (c Container) Scope() (string, bool) {
|
||||
|
|
|
@ -4,6 +4,7 @@ const (
|
|||
watchtowerLabel = "com.centurylinklabs.watchtower"
|
||||
signalLabel = "com.centurylinklabs.watchtower.stop-signal"
|
||||
enableLabel = "com.centurylinklabs.watchtower.enable"
|
||||
monitorOnlyLabel = "com.centurylinklabs.watchtower.monitor-only"
|
||||
dependsOnLabel = "com.centurylinklabs.watchtower.depends-on"
|
||||
zodiacLabel = "com.centurylinklabs.zodiac.original-image"
|
||||
scope = "com.centurylinklabs.watchtower.scope"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue