Skip to content

Commit

Permalink
[k8s] Tell glog to log everything into STDERR.
Browse files Browse the repository at this point in the history
Logging errors into a file inside a minimalistic container might not be
possible, and glog bails out with an exit code > 0 if it fails.
  • Loading branch information
timoreimann authored and ldez committed Jul 4, 2017
1 parent f06e256 commit 91ce78d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions provider/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"errors"
"flag"
"fmt"
"os"
"reflect"
Expand Down Expand Up @@ -62,6 +63,12 @@ func (p *Provider) newK8sClient() (Client, error) {
// Provide allows the k8s provider to provide configurations to traefik
// using the given configuration channel.
func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {
// Tell glog (used by client-go) to log into STDERR. Otherwise, we risk
// certain kinds of API errors getting logged into a directory not
// available in a `FROM scratch` Docker container, causing glog to abort
// hard with an exit code > 0.
flag.Set("logtostderr", "true")

k8sClient, err := p.newK8sClient()
if err != nil {
return err
Expand Down

0 comments on commit 91ce78d

Please sign in to comment.