[k8s] Tell glog to log everything into STDERR.
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.
This commit is contained in:
parent
f06e256934
commit
91ce78da46
|
@ -4,6 +4,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -62,6 +63,12 @@ func (p *Provider) newK8sClient() (Client, error) {
|
||||||
// Provide allows the k8s provider to provide configurations to traefik
|
// Provide allows the k8s provider to provide configurations to traefik
|
||||||
// using the given configuration channel.
|
// using the given configuration channel.
|
||||||
func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {
|
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()
|
k8sClient, err := p.newK8sClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue