Skip to content

Commit

Permalink
Container opt-in
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed Nov 21, 2016
1 parent 8f93e22 commit 108dc6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ $ docker run -v /var/run/docker.sock:/var/run/docker.sock:ro --rm -ti camptocamp

You can set containers to only warn if they are outdated by placing an `io.upkick.warn_only=true` label on them.

## Per container opt-in

If the global `--warn-only` flag is passed, you can opt-in for container kicking by placing an `io.upkick.warn_only=false` label on them.


## Metrics

Expand Down
10 changes: 9 additions & 1 deletion handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ func (u *Upkick) Kick(i *image.Image) (err error) {
}

for _, c := range hashS.Containers {
if u.Config.Warn {
cont, err := u.Client.ContainerInspect(context.Background(), c)
if err != nil {
log.Errorf("failed to inspect container %s: %v", c, err)
continue
}

warnOnly, warnLabel := cont.Config.Labels["io.upkick.warn_only"]

if u.Config.Warn && !(warnLabel && warnOnly == "false") {
log.Warnf("Container %s uses an out-of-date image", c)
outWarn++
continue
Expand Down

0 comments on commit 108dc6a

Please sign in to comment.