feat(filters): Add a flag/env to explicitly exclude containers by name (#1784)

This commit is contained in:
Rodrigo Damazio Bovendorp 2023-10-04 05:44:52 -03:00 committed by GitHub
parent 9180e9558e
commit 623f4e67fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 118 additions and 19 deletions

View file

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"regexp"
"strings"
"time"
@ -85,6 +86,13 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
envBool("WATCHTOWER_LABEL_ENABLE"),
"Watch containers where the com.centurylinklabs.watchtower.enable label is true")
flags.StringSliceP(
"disable-containers",
"x",
// Due to issue spf13/viper#380, can't use viper.GetStringSlice:
regexp.MustCompile("[, ]+").Split(envString("WATCHTOWER_DISABLE_CONTAINERS"), -1),
"Comma-separated list of containers to explicitly exclude from watching.")
flags.StringP(
"log-format",
"l",
@ -197,8 +205,8 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
"",
false,
"Do health check and exit")
flags.BoolP(
flags.BoolP(
"label-take-precedence",
"",
envBool("WATCHTOWER_LABEL_TAKE_PRECEDENCE"),